TEST (x86 instruction)
Appearance
This article needs additional citations for verification. (March 2023) |
![]() | The topic of this article may not meet Wikipedia's general notability guideline. (March 2024) |
In the
register indirect values.[1]
TEST opcode variations
The TEST operation clears the flags CF
and OF
to zero. The least significant byte of the result, 1
if the number of ones in that byte is even, 0
otherwise. The value of AF
is undefined.
Examples
; Conditional Jump
test cl,cl ; set ZF to 1 if cl == 0
jz 0x8004f430 ; jump if ZF == 1
; Conditional Jump with NOT
test cl, cl ; set ZF to 1 if cl == 0
jnz 0x8004f430 ; jump if ZF == 0
; or
test eax, eax ; set SF to 1 if eax < 0 (negative)
js error ; jump if SF == 1
; regular application
test al, $0F ; set ZF if "al AND $0f = 0" (here: address-align test for 16b)
jnz @destination ; jump if eax IS NOT "MODULO 16=0"
References
- ^ "Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2B: Instruction Set Reference, N-Z" (PDF). Retrieved 2019-12-21.