TST TEST
Purpose |
arithmetic compare of a scalar to 0. |
Format |
opcode src.rx |
Operation |
src ß 0; |
Condition codes |
N ß src LSS 0; Z ß src EQL 0; V ß 0; C ß 0; |
Exceptions |
None (integer); Reserved operand (floating point) |
Opcodes |
95 TSTB Test Byte B5 TSTW Test Word D5 TSTL Test Long 53 TSTF Test Floating 73 TSTD Test Double |
Description |
The condition codes are affected according to the value of the source operand. |
Notes |
1. TSTx src is equivalent to CMPx src, $0, but is shorter. 2. On a floating reserved operand, the condition codes are unpredictable. |
Example 1
.text
main:
.word 0
movl $0, r0
tstl r0
movpsl r1
pushl r1
pushal format
calls $2, .printf
pushl $0
calls $1, .exit
.data
format: .asciz "PSL is %d\n"