BLSR: Clear Lowest Set Bit

For information about interpreting this page, see the help page.
Opcode and MnemonicEncoding16 bit Mode32 bit Mode64 bit ModeCPUID Feature FlagDescription
VEX.LZ.0F38.W0 F3 /1
BLSMSK r32, r/m32
VEXInvalidValidValidBMI1Clears the lowest set bit from r/m32, and writes the result into r32.
VEX.LZ.0F38.W1 F3 /1
BLSMSK r64, r/m64
VEXInvalidValidInvalidBMI1Clears the lowest set bit from r/m64, and writes the result into r64.


EncodingOperand 1Operand 2


The BLSMSK instruction clears the lowest set bit of the source operand and writes the result to the destination operand. All other bits in the source operand are untouched.

The CF flag is set if the source is not zero. This can be useful to detect if the destination operand will have anything set without actually testing it.

The operand size (W bit) is always 32 bits if not in Long Mode. In other words, in Protected and Compatibility Mode, VEX.W1 is treated as VEX.W0.

The length field (L bit) must be zero (signifying 128 bit vectors). Attempts to execute with VEX.L1 (256 bit vectors) will cause a #UD exception.


This pseudo-code uses C# syntax. A list of the types used is available here.
public void BLSR_32(ref uint dest, uint src)
  dest = src & (src - 1);
  CF = (src != 0);

public void BLSR_64(ref ulong dest, ulong src)
  dest = src & (src - 1);
  CF = (src != 0);

Flags Affected

CF (carry flag)
Set if the source is not zero. Cleared otherwise.
PF (parity flag)
AF (auxiliary flag)
ZF (zero flag)
Set according to the result.
SF (sign flag)
Set according to the result.
OF (overflow flag)

C Intrinsics


SIMD Floating-Point



See Exceptions Type 13.

Manual Changes

This is a list of changes that have been made from the Intel® 64 and IA-32 Architectures Software Developer’s Manual. These changes were against version 73 (dated ).

  • Officially, this instruction is titled "Reset Lowest Set Bit". This is changed here for consistency (clearing a bit sets it to 0).
  • The BLSR r64, r/m64 form is incorrectly documented as being "not encodable" in 32 bit mode. This is misleading as it is encodable, but is defined to be treated as the 32 bit form.