Generates a program interrupt when a specified condition is true.
| PowerPC | |
|---|---|
| tw | TO,RA,RB |
| POWER | |
|---|---|
| t | TO,RA,RB |
See "Extended Mnemonics of Fixed-Point Trap Instructions" for more information.
The tw and t instructions compare the contents of general-purpose register (GPR) RA with the contents of GPR RB, AND the compared results with TO, and generate a trap-type Program Interrupt if the result is not 0.
The TO bit conditions are defined as follows.
| TO bit | ANDed with Condition |
|---|---|
| 0 | Compares Less Than. |
| 1 | Compares Greater Than. |
| 2 | Compares Equal. |
| 3 | Compares Logically Less Than. |
| 4 | Compares Logically Greater Than. |
The tw and t instructions have one syntax form and do not affect the Fixed-Point Exception Register or Condition Register Field 0.
| TO | Specifies TO bits that are ANDed with compare results. |
| RA | Specifies source general-purpose register for compare. |
| RB | Specifies source general-purpose register for compare. |
The following code generates a Program Interrupt:
# Assume GPR 4 contains 0x9000 3000. # Assume GPR 7 contains 0x789A 789B. tw 0x10,4,7 # A trap type Program Interrupt occurs.
Fixed-Point Trap Instructions.