tdi

Trap Doubleword Immediate

tdi TO, RA, SIM

Compares the contents of a register with an immediate value and invokes a trap handler if specified conditions are met.

Details

The contents of register RA are compared with the sign-extended value of the SI field. If any bit in the TO field is set to 1 and its corresponding condition is met by the result of the comparison, the system trap handler is invoked.

Pseudocode Operation

a ← (RA)
b ← EXTS(SI)
if (a < b) & TO0 then TRAP
if (a > b) & TO1 then TRAP
if (a = b) & TO2 then TRAP
if (a <u b) & TO3 then TRAP
if (a >u b) & TO4 then TRAP

Programming Note

Generates a program exception (System Call or Trap type) when the trap condition is true. The condition codes in TO select which comparisons trigger the trap: bit 0 = LT, bit 1 = GT, bit 2 = EQ, bit 3 = LU (unsigned), bit 4 = GU (unsigned). TO=31 (all bits set) always traps.

Extended Mnemonics

Extended Mnemonic Equivalent Instruction
tdge
tdlnl
tdnei

Example

tdi 4, r4, 4

Encoding

Binary Layout
000010
0
CRb
16
RA
21
SIMM
26
 
Format D-form
Opcode 0x08000000
Extension Base
Registers Altered CRb, XER

Operands

  • TO
    Options
  • RA
    Src
  • SIM
    Imm
  • SI
    Sign-Extended Immediate Value
  • CRb
    Condition Register Field
  • SIMM
    Signed Immediate Value