[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Assembler Language Reference

nabs (Negative Absolute) Instruction

Purpose

Negates the absolute value of the contents of a general-purpose register and stores the result in another general-purpose register.

Note: The nabs instruction is supported only in the POWER architecture.

Syntax

POWER
nabs RT,RA
nabs. RT,RA
nabso RT,RA
nabso. RT,RA

Description

The nabs instruction places the negative absolute value of the contents of general-purpose register (GPR) RA into the target GPR RT.

The nabs 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
nabs 0 None 0 None
nabs. 0 None 1 LT,GT,EQ,SO
nabso 1 SO,OV 0 None
nabso. 1 SO,OV 1 LT,GT,EQ,SO

The four syntax forms of the nabs instruction never affect the Carry bit (CA) in the Fixed-Point Exception Register. If the syntax form sets the Overflow Exception (OE) bit to 1, the Summary Overflow (SO) bit is unchanged and the Overflow (OV) bit is set to zero. 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.

Parameters

RT Specifies target general-purpose register where result of operation is stored.
RA Specifies source general-purpose register for operation.

Examples

  1. The following code takes the negative absolute value of the contents of GPR 4 and stores the result in GPR 6:
    # Assume GPR 4 contains 0x0000 3000.
    nabs 6,4
    # GPR 6 now contains 0xFFFF D000.
  2. The following code takes the negative absolute value of the contents of GPR 4, stores the result in GPR 6, and sets Condition Register Field 0 to reflect the result of the operation:
    # Assume GPR 4 contains 0xFFFF FFFF.
    nabs. 6,4
    # GPR 6 now contains 0xFFFF FFFF.
  3. The following code takes the negative absolute value of the contents of GPR 4, stores the result in GPR 6, and sets the Overflow bit in the Fixed-Point Exception Register to 0:
    # Assume GPR 4 contains 0x0000 0001.
    nabso 6,4
    # GPR 6 now contains 0xFFFF FFFF.
  4. The following code takes the negative absolute value of the contents of GPR 4, stores the result in GPR 6, sets Condition Register Field 0 to reflect the result of the operation, and sets the Overflow bit in the Fixed-Point Exception Register to 0:
    # Assume GPR 4 contains 0x8000 0000.
    nabso 6,4
    # GPR 6 now contains 0x8000 0000.

Related Information

Fixed-Point Processor.

Fixed-Point Arithmetic Instructions.


[ Previous | Next | Contents | Home | Search ]