Takes the absolute value of the contents of a general-purpose register and places the result in another general-purpose register.
Note: The abs instruction is supported only in the POWER family architecture.
Bits | Value |
---|---|
0-5 | 31 |
6-10 | RT |
11-15 | RA |
16-20 | /// |
21 | OE |
22-30 | 360 |
31 | Rc |
POWER family | |
---|---|
abs | RT, RA |
abs. | RT, RA |
abso | RT, RA |
abso. | RT, RA |
The abs instruction places the absolute value of the contents of general-purpose register (GPR) RA into the target GPR RT.
If GPR RA contains the most negative number ('8000 0000'), the result of the instruction is the most negative number, and the instruction will set the Overflow bit in the Fixed-Point Exception Register to 1 if the OE bit is set to 1.
The abs 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 |
abs | 0 | None | 0 | None |
abs. | 0 | None | 1 | LT,GT,EQ,SO |
abso | 1 | SO,OV | 0 | None |
abso. | 1 | SO,OV | 1 | LT,GT,EQ,SO |
The four syntax forms of the abs 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.
RT | Specifies the target general-purpose register where result of operation is stored. |
RA | Specifies the source general-purpose register for operation. |
# Assume GPR 4 contains 0x7000 3000. abs 6,4 # GPR 6 now contains 0x7000 3000.
# Assume GPR 4 contains 0xFFFF FFFF. abs. 6,4 # GPR 6 now contains 0x0000 0001.
# Assume GPR 4 contains 0xB004 3000. abso 6,4 # GPR 6 now contains 0x4FFB D000.
# Assume GPR 4 contains 0x8000 0000. abso. 6,4 # GPR 6 now contains 0x8000 0000.
Fixed-Point Arithmetic Instructions .