Instructions
www.ti.com
CMPF32 RaH, #0.0
32-bit Floating-Point Compare for Equal, Less Than or Greater Than
Operands
RaH
floating-point source register (R0H to R7H)
#0.0
zero
Opcode
LSW: 1110 0101 1010 0aaa
Description
Set the ZF and NF flags on (RaH - #0.0). The CMPF32 instruction is performed as a
logical compare operation. This is possible because of the IEEE floating-point format
offsets the exponent. Basically the bigger the binary number, the bigger the floating-point
value.
Special cases for inputs:
•
Negative zero will be treated as positive zero.
•
Denormalized value will be treated as positive zero.
•
Not-a-Number (NaN) will be treated as infinity.
Flags
This instruction modifies the following flags in the STF register:
Flag
TF
ZI
NI
ZF
NF
LUF
LVF
Modified
No
No
No
Yes
Yes
No
No
The STF register flags are modified as follows:
If(RaH == #0.0) {ZF=1, NF=0}
If(RaH >
#0.0) {ZF=0, NF=0}
If(RaH <
#0.0) {ZF=0, NF=1}
Pipeline
This is a single-cycle instruction.
Example
; Behavior of ZF and NF flags for different comparisons
MOVIZF32
R0H, #5.0
; R0H =
5.0 (0x40A00000)
MOVIZF32
R1H, #-2.0
; R1H = -2.0 (0xC0000000)
MOVIZF32
R2H, #0.0
; R2H =
0.0 (0x00000000)
CMPF32
R0H, #0.0
; ZF = 0, NF = 0
CMPF32
R1H, #0.0
; ZF = 0, NF = 1
CMPF32
R2H, #0.0
; ZF = 1, NF = 0
; Using the result of a compare for loop control
Loop:
MOV32
R1H,*XAR3++
; Load R1H
CMPF32
R1H, #0.0
; Set/clear ZF and NF
MOVST0
ZF, NF
; Copy ZF and NF to ST0 Z and N bits
BF
Loop, GT
; Loop if R1H > #0.0
See also
Instruction Set
46
SPRUEO2A – June 2007 – Revised August 2008
Содержание TMS320C28 series
Страница 2: ...2 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Страница 12: ...Introduction 12 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Страница 20: ...CPU Register Set 20 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Страница 136: ...Instruction Set 136 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...