Instructions
www.ti.com
SWAPF RaH, RbH{, CNDF}
Conditional Swap
Operands
RaH
floating-point register (R0H to R7H)
RbH
floating-point register (R0H to R7H)
CNDF
condition tested
Opcode
LSW: 1110 0110
1110 CNDF
MSW: 0000 0000
00bb baaa
Description
Conditional swap of RaH and RbH.
if (CNDF == true) swap RaH and RbH
CNDF is one of the following conditions:
Encode
(1)
CNDF
Description
STF Flags Tested
0000
NEQ
Not equal to zero
ZF == 0
0001
EQ
Equal to zero
ZF == 1
0010
GT
Greater than zero
ZF == 0 AND NF == 0
0011
GEQ
Greater than or equal to zero
NF == 0
0100
LT
Less than zero
NF == 1
0101
LEQ
Less than or equal to zero
ZF == 1 AND NF == 1
1010
TF
Test flag set
TF == 1
1011
NTF
Test flag not set
TF == 0
1100
LU
Latched underflow
LUF == 1
1101
LV
Latched overflow
LVF == 1
1110
UNC
Unconditional
None
1111
UNCF
(2)
Unconditional with flag
None
modification
(1)
Values not shown are reserved.
(2)
This is the default operation if no CNDF field is specified. This
condition will allow the ZF, NF, ZI, and NI flags to be modified when
a conditional operation is executed. All other conditions will not
modify these flags.
Flags
This instruction modifies the following flags in the STF register:
Flag
TF
ZI
NI
ZF
NF
LUF
LVF
Modified
No
No
No
No
No
No
No
No flags affected
Pipeline
This is a single-cycle instruction.
Example
;find the largest element and put it in R1H
MOVL
XAR1, #0xB000
;
MOV32
R1H, *XAR1
; Initialize R1H
.align 2
NOP
RPTB
LOOP_END, #(10-1); Execute the block 10 times
MOV32
R2H, *XAR1++
; Update R2H with next element
CMPF32
R2H, R1H
; Compare R2H with R1H
SWAPF
R1H, R2H, GT
; Swap R1H and R2H if R2 > R1
NOP
; For minimum repeat block size
NOP
; For minimum repeat block size
LOOP_END:
See also
128
Instruction Set
SPRUEO2A – June 2007 – Revised August 2008
Summary of Contents for TMS320C28 series
Page 2: ...2 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Page 12: ...Introduction 12 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Page 20: ...CPU Register Set 20 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Page 136: ...Instruction Set 136 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...