Subtracts the contents of a general-purpose register from the contents of another general-purpose register and places the result in a third general-purpose register.
PowerPC | |
---|---|
subfc | RT,RA,RB |
subfc. | RT,RA,RB |
subfco | RT,RA,RB |
subfco. | RT,RA,RB |
POWER | |
---|---|
sf | RT,RA,RB |
sf. | RT,RA,RB |
sfo | RT,RA,RB |
sfo. | RT,RA,RB |
See "Extended Mnemonics of Fixed-Point Arithmetic Instructions" for more information.
The subfc and sf instructions add the ones complement of the contents of general-purpose register (GPR) RA and 1 to the contents of GPR RB and stores the result in the target GPR RT.
The subfc instruction has four syntax forms. Each syntax form has a different effect on Condition Register Field 0 and the Fixed-Point Exception Register.
The sf instruction has four syntax forms. Each syntax form has a different effect on Condition Register Field 0 and the Fixed-Point Exception Register.
Syntax Form | Overflow Exception (OE) | Fixed-Point Exception Register | Record Bit (Rc) | Condition Register Field 0 |
subfc | 0 | CA | 0 | None |
subfc. | 0 | CA | 1 | LT,GT,EQ,SO |
subfco | 1 | SO,OV,CA | 0 | None |
subfco. | 1 | SO,OV,CA | 1 | LT,GT,EQ,SO |
sf | 0 | CA | 0 | None |
sf. | 0 | CA | 1 | LT,GT,EQ,SO |
sfo | 1 | SO,OV,CA | 0 | None |
sfo. | 1 | SO,OV,CA | 1 | LT,GT,EQ,SO |
The four syntax forms of the subfc instruction, and the four syntax forms of the sf instruction, always affect the Carry bit (CA) in the Fixed-Point Exception Register. If the syntax form sets the Overflow Exception (OE) bit to 1, the instruction affects the Summary Overflow (SO) and Overflow (OV) bits in the Fixed-Point Exception Register. If the syntax form sets the Record (Rc) bit to 1, the instruction affects the Less Than (LT) zero, Greater Than (GT) zero, Equal To (EQ) zero, and Summary Overflow (SO) bits in Condition Register Field 0.
# Assume GPR 4 contains 0x8000 7000. # Assume GPR 10 contains 0x9000 3000. subfc 6,4,10 # GPR 6 now contains 0x0FFF C000.
# Assume GPR 4 contains 0x0000 4500. # Assume GPR 10 contains 0x8000 7000. subfc. 6,4,10 # GPR 6 now contains 0x8000 2B00.
# Assume GPR 4 contains 0x8000 0000. # Assume GPR 10 contains 0x0000 4500. subfco 6,4,10 # GPR 6 now contains 0x8000 4500.
# Assume GPR 4 contains 0x8000 0000. # Assume GPR 10 contains 0x0000 7000. subfco. 6,4,10 # GPR 6 now contains 0x8000 7000.
Fixed-Point Arithmetic Instructions.