Isolate Lowest Set Bit

Encoding

EncodingOperand 1Operand 2
vmVEX.vvvv[w]ModRM.r/m[r]

Description

The BLSI instruction extracts (isolates) the lowest set bit in the source operand and sets the same bit in the destination operand. All other bits in the destination operand are cleared.

The operand size is always 32 bits if not in Long Mode. In other words, VEX.W1 is treated as VEX.W0 outside Long Mode.

Operation

public void BLSI(ref U32 dest, U32 src)
{
    dest = src & -src;
}

public void BLSI(ref U64 dest, U64 src)
{
    dest = src & -src;
}

Flags Affected

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

Intrinsics

Exceptions

SIMD Floating-Point

None.

Other Exceptions

VEX Encoded Form: See Type 13 Exception Conditions.