EasyManuals Logo

Intel ARCHITECTURE IA-32 User Manual

Intel ARCHITECTURE IA-32
568 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #245 background imageLoading...
Page #245 background image
Optimizing for SIMD Integer Applications 4
4-25
Absolute Value
Use Example 4-18 to compute |x|, where x is signed. This example
assumes signed words to be the operands.
movq MM2, MM0 ; make a copy of source1 (A)
pcmpgtw MM0, MM1 ; create mask of
; source1>source2 (A>B)
movq MM4, MM2 ; make another copy of A
pxor MM2, MM1 ; create the intermediate value of
; the swap operation - xor(A,B)
pand MM2, MM0 ; create a mask of 0s and xor(A,B)
; elements. Where A>B there will
; be a value xor(A,B) and where
; A<=B there will be 0.
pxor MM4, MM2 ; minima-xor(A, swap mask)
pxor MM1, MM2 ; maxima-xor(B, swap mask)
psubw MM1, MM4 ; absolute difference =
; maxima-minima
Example 4-18 Computing Absolute Value
; Input:
; MM0 signed source operand
; Output:
; MM1 ABS(MMO)
pxor MM1, MM1 ; set MM1 to all zeros
psubw MM1, MM0 ; make each MM1 word contain the
; negative of each MM0 word
pmaxsw MM1, MM0 ; MM1 will contain only the positive
; (larger) values - the absolute value
Example 4-17 Absolute Difference of Signed Numbers (continued)

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel ARCHITECTURE IA-32 and is the answer not in the manual?

Intel ARCHITECTURE IA-32 Specifications

General IconGeneral
Instruction Setx86
Instruction Set TypeCISC
Memory SegmentationSupported
Operating ModesReal mode, Protected mode, Virtual 8086 mode
Max Physical Address Size36 bits (with PAE)
Max Virtual Address Size32 bits
ArchitectureIA-32 (Intel Architecture 32-bit)
Addressable Memory4 GB (with Physical Address Extension up to 64 GB)
Floating Point Registers8 x 80-bit
MMX Registers8 x 64-bit
SSE Registers8 x 128-bit
RegistersGeneral-purpose registers (EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP), Segment registers (CS, DS, SS, ES, FS, GS), Instruction pointer (EIP), Flags register (EFLAGS)
Floating Point UnitYes (x87)

Related product manuals