03.03.2013 Views

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

Intel® Architecture Instruction Set Extensions Programming Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INSTRUCTION SET REFERENCE - VEX-ENCODED GPR INSTRUCTIONS<br />

BLSMSK — Get Mask Up to Lowest <strong>Set</strong> Bit<br />

Opcode/<strong>Instruction</strong> Op/<br />

En<br />

Description<br />

<strong>Instruction</strong> Operand Encoding<br />

<strong>Set</strong>s all the lower bits of the destination operand to “1” up to and including lowest set bit (=1) in the source<br />

operand. If source operand is zero, BLSMSK sets all bits of the destination operand to 1 and also sets CF to 1.<br />

This instruction is not supported in real mode and virtual-8086 mode. The operand size is always 32 bits if not in<br />

64-bit mode. In 64-bit mode operand size 64 requires VEX.W1. VEX.W1 is ignored in non-64-bit modes. An<br />

attempt to execute this instruction with VEX.L not equal to 0 will cause #UD.<br />

Operation<br />

temp ← (SRC-1) XOR (SRC) ;<br />

SF ← temp[OperandSize -1];<br />

ZF ← 0;<br />

IF SRC = 0<br />

CF ← 1;<br />

ELSE<br />

CF ← 0;<br />

FI<br />

DEST ← temp;<br />

Flags Affected<br />

SF is updated based on the result. CF is set if the source if zero. ZF and OF flags are cleared. AF and PF flag are<br />

undefined.<br />

Intel C/C++ Compiler Intrinsic Equivalent<br />

BLSMSK: unsigned __int32 _blsmsk_u32(unsigned __int32 src);<br />

BLSMSK: unsigned __int64 _blsmsk_u64(unsigned __int64 src);<br />

SIMD Floating-Point Exceptions<br />

None<br />

Other Exceptions<br />

See Table 2-22.<br />

64/32<br />

-bit<br />

Mode<br />

CPUID<br />

Feature<br />

Flag<br />

Description<br />

VEX.NDD.LZ.0F38.W0 F3 /2 A V/V BMI1 <strong>Set</strong> all lower bits in r32 to “1” starting from bit 0 to lowest set bit in<br />

r/m32.<br />

BLSMSK r32, r/m32<br />

VEX.NDD.LZ.0F38.W1 F3 /2 A V/N.E. BMI1 <strong>Set</strong> all lower bits in r64 to “1” starting from bit 0 to lowest set bit in<br />

r/m64.<br />

BLSMSK r64, r/m64<br />

Op/En Operand 1 Operand 2 Operand 3 Operand 4<br />

A VEX.vvvv (w) ModRM:r/m (r) NA NA<br />

7-6 Ref. # 319433-014

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!