Instructions
www.ti.com
CMPF32 RaH, RbH
32-bit Floating-Point Compare for Equal, Less Than or Greater Than
Operands
RaH
floating-point source register (R0H to R7H)
RbH
floating-point source register (R0H to R7H)
Opcode
LSW: 1110 0110
1001 0100
MSW: 0000 0000
00bb baaa
Description
Set ZF and NF flags on the result of RaH - RbH. The CMPF32 instruction is performed
as a logical compare operation. This is possible because of the IEEE format offsetting
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.
•
A 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 == RbH) {ZF=1, NF=0}
If(RaH >
RbH) {ZF=0, NF=0}
If(RaH <
RbH) {ZF=0, NF=1}
Pipeline
This is a single-cycle instruction.
Example
; Behavior of ZF and NF flags for different comparisons
MOVIZF32
R1H, #-2.0
; R1H = -2.0 (0xC0000000)
MOVIZF32
R0H, #5.0
; R0H =
5.0 (0x40A00000)
CMPF32
R1H, R0H
; ZF = 0, NF = 1
CMPF32
R0H, R1H
; ZF = 0, NF = 0
CMPF32
R0H, R0H
; ZF = 1, NF = 0
; Using the result of a compare for loop control
Loop:
MOV32
R0H,*XAR4++
; Load R0H
MOV32
R1H,*XAR3++
; Load R1H
CMPF32
R1H, R0H
; Set/clear ZF and NF
MOVST0
ZF, NF
; Copy ZF and NF to ST0 Z and N bits
BF
Loop, GT
; Loop if R1H > R0H
See also
Instruction Set
44
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 ...