Philips Semiconductors
DSPCPU Operations for TM1100
File: ops.fm5, modified 7/23/99
PRELIMINARY INFORMATION
A-57
Sign of oating-point value
SYNTAX
[ IF r
guard ] fsign rsrc1
→ rdest
FUNCTION
if r
guard then {
if (oat)r
src1 = 0.0 then
r
dest
← 0
else if (oat)r
src1 < 0.0 then
r
dest
← 0xffffffff
else
r
dest
← 1
}
ATTRIBUTES
Function unit
fcomp
Operation code
152
Number of operands
1
Modier
No
Modier range
—
Latency
1
Issue slots
3
DESCRIPTION
The fsign operation sets the destination register, r
dest, to either 0, 1, or –1 depending on the sign of the argument
in r
src1. rdest is set to 0 if rsrc1 is equal to zero, to 1 if rsrc1 is positive, or to –1 if rsrc1 is negative. The argument is
treated as an IEEE single-precision oating-point value; the result is an integer. If the argument is denormalized, zero
is substituted before computing the comparison, and the IFZ ag in the PCSW is set; thus, the result of fsign for a
denormalized argument is 0. If fsign causes an IEEE exception, the corresponding exception ags in the PCSW
are set. The PCSW exception ags are sticky: the ags can be set as a side-effect of any oating-point operation but
can only be reset by an explicit writepcsw operation. The update of the PCSW exception ags occurs at the same
time as r
dest is written. If any other oating-point compute operations update the PCSW at the same time, the net
result in each exception ag is the logical OR of all simultaneous updates ORed with the existing PCSW value for that
exception ag.
The fsignflags operation computes the exception ags that would result from an individual fsign.
The fsign operation optionally takes a guard, specied in r
guard. If a guard is present, its LSB controls the
modication of the destination register. If the LSB of r
guard is 1, rdest and the exception ags in PCSW are written;
otherwise, r
dest is not changed and the operation does not affect the exception ags in PCSW.
EXAMPLES
Initial Values
Operation
Result
r30 = 0x40400000 (3.0)
fsign r30
→ r100
r100
← 1
r40 = 0xbf800000 (-1.0)
fsign r40
→ r105
r105
← 0xffffffff (-1)
r50 = 0x80800000 (-1.175494351e-38) fsign r50
→ r110
r110
← 0xffffffff (-1)
r60 = 0x80400000 (-5.877471754e-39) fsign r60
→ r115
r115
← 0, IFZ ag set
r10 = 0, r70 = 0xffffffff (QNaN)
IF r10 fsign r70
→ r116
no change, since guard is false
r20 = 1, r70 = 0xffffffff (QNaN)
IF r20 fsign r70
→ r117
r117
← 0, INV ag set
r80 = 0xff800000 (-INF)
fsign r80
→ r120
r120
← 0xffffffff (-1)
SEE ALSO
fsign