Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Chapter 9. Comparison > CMP — Packed Comparison - Pg. 264

264 Chapter 9: Comparison Flags O.flow X Sign X Zero X Aux X Parity X Carry X Flags: Based upon whether the operands were signed or unsigned the following table should be used to reflect the results. Comparison op1 > op2 op1 ³ op2 op1 = op2 op1 £ op2 op1 < op2 ; ; (±) Signed OF = SF, ZF=0 OF = SF ZF = 1 OF ¹ SF, ZF = 1 OF ¹ SF (+)Unsigned ZF=0, CF=0 CF=0 ZF=1 ZF=1, CF=1 CF=1 ± Greater GreaterEq Equal LessEq Less + Above AboveEq Equal BelowEq Below Loop for the entire count, flags will only reflect the last comparison. mov ecx,count rep cmpsb Loop while strings match mov ecx,count repe cmpsb test je ecx,ecx $L1 ; ; Repeat while equal ; Jump if done ; Found a mismatch $L1: CMP -- Packed Comparison The two types of comparison are integers and floating-point values. Integers are compared to integers and floating-point values are com- pared to floating-point values. Hint: SSE and SSE2 use an immediate value to determine L of condition for single-precision and double-precision values. the type