AngoLinux

80386 Programmer's Reference Manual -- Opcode TEST


TEST -- Logical Compare

OpcodeInstructionClocks DescriptionExample
A8 ibtestb imm8,al2 AND immediate byte with ALtestb $0x7f,%al
A9 iwtestw imm16,ax2 AND immediate word with AXtestw $0x7fff,%ax
A9 idtestl imm32,eax2 AND immediate dword with EAXtestl $0x7fffffff,%eax
F6 /0 ibtestb imm8,r/m82/5 AND immediate byte with r/m bytetestb $0x7f,%dl
testb $0x7f,(%ebx,1)
testb $0x7f,m8(%ebx,1)
testb $0x7f,m8(%ebx,%ebp,1)
F7 /0 iwtestw imm16,r/m162/5 AND immediate word with r/m wordtestw $0x7fff,%cx
testw $0x7fff,(%ebx,1)
testw $0x7fff,(%ebx,2)
testw $0x7fff,(%ebx,%ebp,1)
F7 /0 idtestl imm32,r/m322/5 AND immediate dword with r/m dwordtestl $0x7fffffff,%ecx
testl $0x7fffffff,(%ebx,2)
testl $0x7fffffff,(%ebx,4)
testl $0x7fffffff,(%ebx,%ebp,1)
84 /rtestb r8,r/m82/5 AND byte register with r/m bytetestb %bh,%dl
testb %bh,(%ebx,1)
testb %bh,m8(%ebx,1)
testb %bh,m8(%ebx,%ebp,1)
85 /rtestw r16,r/m162/5 AND word register with r/m wordtestw %bx,%cx
testw %bx,(%ebx,1)
testw %bx,(%ebx,2)
testw %bx,(%ebx,%ebp,1)
85 /rtestl r32,r/m322/5 AND dword register with r/m dwordtestl %ebx,%ecx
testl %ebx,(%ebx,2)
testl %ebx,(%ebx,4)
testl %ebx,(%ebx,%ebp,1)

Operation




DEST := LeftSRC AND RightSRC;
CF := 0;
OF := 0;

Description

TEST computes the bit-wise logical AND of its two operands. Each bit of the result is 1 if both of the corresponding bits of the operands are 1; otherwise, each bit is 0. The result of the operation is discarded and only the flags are modified.

Flags Affected

OF := 0, CF := 0; SF, ZF, and PF as described in Appendix C

Protected Mode Exceptions

#GP(0) for an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments; #SS(0) for an illegal address in the SS segment; #PF(fault-code) for a page fault

Real Address Mode Exceptions

Interrupt 13 if any part of the operand would lie outside of the effective address space from 0 to 0FFFFH

Virtual 8086 Mode Exceptions

Same exceptions as in Real Address Mode; #PF(fault-code) for a page fault


[Home Page dell'ITIS "Fermi"] [80386 Programmer's Reference Manual Index] [Previous] [Next]