PABSB/PABSW/PABSD

Packed Absolute Value

Opcodes

Hex Mnemonic Encoding Long Mode Legacy Mode Description
66 0F 38 1E /r PABSD xmm1, xmm2/m128 A Valid Valid Compute the absolute value of 32-bit integers in xmm2/m128 and store UNSIGNED result in xmm1.
0F 38 1E /r PABSD mm1, mm2/m64 A Valid Valid Compute the absolute value of 32-bit integers in mm2/m64 and store UNSIGNED result in mm1.
66 0F 38 1D /r PABSW xmm1, xmm2/m128 A Valid Valid Compute the absolute value of 16-bit integers in xmm2/m128 and store UNSIGNED result in xmm1.
0F 38 1D /r PABSW mm1, mm2/m64 A Valid Valid Compute the absolute value of 16-bit integers in mm2/m64 and store UNSIGNED result in mm1.
66 0F 38 1C /r PABSB xmm1, xmm2/m128 A Valid Valid Compute the absolute value of bytes in xmm2/m128 and store UNSIGNED result in xmm1.
0F 38 1C /r PABSB mm1, mm2/m64 A Valid Valid Compute the absolute value of bytes in mm2/m64 and store UNSIGNED result in mm1.

Instruction Operand Encoding

Op/En Operand 0 Operand 1 Operand 2 Operand 3
A NA NA ModRM:r/m (r) ModRM:reg (w)

Description

PABSB/W/D computes the absolute value of each data element of the source operand (the second operand) and stores the UNSIGNED results in the destination operand (the first operand). PABSB operates on signed bytes, PABSW operates on 16-bit words, and PABSD operates on signed 32-bit integers. The source operand can be an MMX register or a 64-bit memory location, or it can be an XMM register or a 128-bit memory location. The destination operand can be an MMX or an XMM register. Both operands can be MMX register or XMM registers. When the source operand is a 128-bit memory operand, the operand must be aligned on a 16byte boundary or a general-protection exception (#GP) will be generated.

In 64-bit mode, use the REX prefix to access additional registers.

Pseudo Code

(* PABSB with 64 bit operands *)
Unsigned DEST[7:0] = ABS(SRC[7:0])
(* Repeat operation for 2nd through 7th bytes *)
Unsigned DEST[63:56] = ABS(SRC[63:56])
(* PABSB with 128 bit operands: *)
Unsigned DEST[7:0] = ABS(SRC[7:.0])
(* Repeat operation for 2nd through 15th bytes *)
Unsigned DEST[127:120] = ABS(SRC[127:120])
(* PABSW with 64 bit operands: *)
Unsigned DEST[15:0] = ABS(SRC[15:0])
(* Repeat operation for 2nd through 3rd 16-bit words *)
Unsigned DEST[63:48] = ABS(SRC[63:48])
(* PABSW with 128 bit operands: *)
Unsigned DEST[15:0] = ABS(SRC[15:0])
(* Repeat operation for 2nd through 7th 16-bit words *)
Unsigned DEST[127:112] = ABS(SRC[127:112])
(* PABSD with 64 bit operands: *)
Unsigned DEST[31:0] = ABS(SRC[31:0])
Unsigned DEST[63:32] = ABS(SRC[63:32])
(* PABSD with 128 bit operands: *)
Unsigned DEST[31:0] = ABS(SRC[31:0])
(* Repeat operation for 2nd through 3rd 32-bit double words *)
Unsigned DEST[127:96] = ABS(SRC[127:96])

Exceptions

64-Bit Mode Exceptions

Exception Description
#AC(0) (64-bit operations only) If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3.
#PF(fault-code) If a page fault occurs.
#MF (64-bit operations only) If there is a pending x87 FPU exception.
#NM If CR0.TS[bit 3] = 1.
#UD If CR0.EM[bit 2] = 1. (128-bit operations only) If CR4.OSFXSR[bit 9] = 0. If CPUID.01H:ECX.SSSE3[bit 9] = 0. If the LOCK prefix is used.
#GP(0) If the memory address is in a non-canonical form. (128-bit operations only) If memory operand is not aligned on a 16-byte boundary, regardless of segment.
#SS(0) If a memory address referencing the SS segment is in a non- canonical form.

Compatibility Mode Exceptions

Same as for protected mode exceptions.

Virtual-8086 Mode Exceptions

Exception Description
#AC(0) (64-bit operations only) If alignment checking is enabled and unaligned memory reference is made.
#PF(fault-code) If a page fault occurs.
Same exceptions as in real address mode.

Real-Address Mode Exceptions

Exception Description
#MF (64-bit operations only) If there is a pending x87 FPU exception.
#NM If TS bit in CR0 is set.
#GP(0): If any part of the operand lies outside of the effective address space from 0 to 0FFFFH. (128-bit operations only) If not aligned on 16-byte boundary, regardless of segment. #UD: If CR0.EM = 1. (128-bit operations only) If CR4.OSFXSR(bit 9) = 0. If CPUID.SSSE3(ECX bit 9) = 0. If the LOCK prefix is used.

Protected Mode Exceptions

Exception Description
#AC(0) (64-bit operations only) If alignment checking is enabled and unaligned memory reference is made while the current privilege level is 3.
#MF (64-bit operations only) If there is a pending x87 FPU exception.
#NM If TS bit in CR0 is set.
#UD If CR0.EM = 1. (128-bit operations only) If CR4.OSFXSR(bit 9) = 0. If CPUID.SSSE3(ECX bit 9) = 0. If the LOCK prefix is used.
#PF(fault-code) If a page fault occurs.
#SS(0) If a memory operand effective address is outside the SS segment limit.
#GP(0): If a memory operand effective address is outside the CS, DS, ES, FS or GS segments. (128-bit operations only) If not aligned on 16-byte boundary, regardless of segment.