Comparison To Zero; Minimum And Maximum; Simple If-Then-Else Constructions; Notes - IBM A2 User Manual

Table of Contents

Advertisement

E.3.1 Comparison to Zero
if a  0.0 then x  y
else x  z
if a > 0.0 then x  y
else x  z
if a = 0.0 then x  y
else x  z
E.3.2 Minimum and Maximum
x  min(a,b)
x  max(a,b)
E.3.3 Simple If-Then-Else Constructions
if a  b then x  y
else x  z
if a > b then x  y
else x  z
if a = b then x  y
else x  z
E.4 Notes
The following notes apply to the preceding examples and to the corresponding cases using the other three
arithmetic relations (<, , and ). They should also be considered when any other use of fsel is contemplated.
In these notes, the "optimized program" is the Book III-E program shown, and the "unoptimized program" (not
shown) is the corresponding Book III-E program that uses fcmpu and Branch Conditional instructions instead
of fsel.
1. The unoptimized program affects the VXSNAN bit of the FPSCR, and therefore can cause the system
error handler to be invoked if the corresponding exception is enabled. The optimized program does not
affect this bit. This property of the optimized program is incompatible with the IEEE standard.
2. The optimized program gives the incorrect result if a is a NaN.
3. The optimized program gives the incorrect result if a and/or b is a NaN (except that it can give the correct
result in some cases for the minimum and maximum functions, depending on how those functions are
defined to operate on NaNs).
Version 1.3
October 23, 2012
High-Level Language
High-Level Language
High-Level Language
Book III-E
fsel fx, fa, fy, fz
fneg fs, fa
fsel fx, fs, fz, fy
fsel fx, fa, fy, fz
fneg fs, fa
fsel fx, fs, fx, fz
Book III-E
fsub fs, fa, fb
fsel fx, fs, fb, fa
fsub fs, fa, fb
fsel fx, fs, fa, fb
Book III-E
fsub fs, fa, fb
fsel fx, fs, fy, fz
fsub fs, fb, fa
fsel fx, fs, fz, fy
fsub fs, fa, fb
fsel fx, fs, fy, fz
fneg fs, fs
fsel fx, fs, fx, fz
Programming Examples
User's Manual
A2 Processor

Notes

1
1, 2
1
Notes
3, 4, 5
3, 4, 5
Notes
4, 5
3, 4, 5
4, 5
Page 863 of 864

Advertisement

Table of Contents
loading

Table of Contents