BLENDPS

Blend Packed Single Precision Floating-Point Values

Opcodes

Hex Mnemonic Encoding Long Mode Legacy Mode Description
66 0F 3A 0C /r ib BLENDPS xmm1, xmm2/m128, imm8 A Valid Valid Select packed single precision floating-point values from xmm1 and xmm2/m128 from mask specified in imm8 and store the values into xmm1.

Instruction Operand Encoding

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

Description

Packed single-precision floating-point values from the source operand (second operand) are conditionally copied to the destination operand (first operand) depending on the mask bits in the immediate operand. The mask bits are bits [3:0] of the immediate byte (third operand). Each mask bit corresponds to a dword element in a 128-bit operand.

If a mask bit is "1", then the corresponding dword in the source operand is copied to the destination, else the dword element in the destination operand is left unchanged.

Pseudo Code

IF (imm8[0] = 1)
	DEST[31:0] = SRC[31:0];
ELSE
	DEST[31:0] = DEST[31:0];
FI;
IF (imm8[1] = 1)
	DEST[63:32] = SRC[63:32];
ELSE
	DEST[63:32] = DEST[63:32];
FI;
IF (imm8[2] = 1)
	DEST[95:64] = SRC[95:64];
ELSE
	DEST[95:64] = DEST[95:64];
FI;
IF (imm8[3] = 1)
	DEST[127:96] = SRC[127:96];
ELSE
	DEST[127:96] = DEST[127:96];
FI;

Exceptions

SIMD Floating-Point Exceptions

None

64-Bit Mode Exceptions

Exception Description
#UD If EM in CR0 is set. If OSFXSR in CR4 is 0. If CPUID feature flag ECX.SSE4_1 is 0. If LOCK prefix is used. Either the prefix REP (F3h) or REPN (F2H) is used.
#NM If TS in CR0 is set.
#PF(fault-code) For a page fault.
#GP(0) If the memory address is in a non-canonical form. If not aligned on 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 exceptions as in Protected Mode.

Virtual-8086 Mode Exceptions

Exception Description
#PF(fault-code) For a page fault.
Same exceptions as in Real Address Mode.

Real-Address Mode Exceptions

Exception Description
#UD If CR0.EM[bit 2] = 1. If CR4.OSFXSR[bit 9] = 0 If CPUID.01H:ECX.SSE4_1[bit 19] = 0. If LOCK prefix is used. Either the prefix REP (F3h) or REPN (F2H) is used.
#GP(0) if any part of the operand lies outside of the effective address space from 0 to 0FFFFH. If not aligned on 16-byte boundary, regardless of segment #NM If CR0.TS[bit 3] = 1.

Protected Mode Exceptions

Exception Description
#UD If CR0.EM[bit 2] = 1. If CR4.OSFXSR[bit 9] = 0. If CPUID.01H:ECX.SSE4_1[bit 19] = 0. If LOCK prefix is used. Either the prefix REP (F3h) or REPN (F2H) is used.
#NM If CR0.TS[bit 3] = 1.
#PF(fault-code) For a page fault.
#SS(0) For an illegal address in the SS segment.
#GP(0) For an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments. If a memory operand is not aligned on a 16-byte boundary, regardless of segment.