TZCNT — Count the Number of Trailing Zero BitsInstruction Operand EncodingDescription TZCNT counts the number of trailing least significant zero bits in source operand (second operand) and returns the result in destination operand (first operand). TZCNT is an extension of the BSF instruction. The key difference between TZCNT and BSF instruction is that TZCNT provides operand size as output when source operand is zero while in the case of BSF instruction, if source operand is zero, the content of destination operand are undefined. On processors that do not support TZCNT, the instruction byte encoding is executed as BSF.Operationtemp := 0DEST := 0DO WHILE ( (temp < OperandSize) and (SRC[ temp] = 0) )temp := temp +1DEST := DEST+ 1ODIF DEST = OperandSizeCF := 1ELSECF := 0FIIF DEST = 0ZF := 1ELSEZF := 0FIFlags AffectedZF is set to 1 in case of zero output (least significant bit of the source is set), and to 0 otherwise, CF is set to 1 if the input was zero and cleared otherwise. OF, SF, PF and AF flags are undefined.Intel C/C++ Compiler Intrinsic EquivalentTZCNT:unsigned __int32 _tzcnt_u32(unsigned __int32 src);TZCNT:unsigned __int64 _tzcnt_u64(unsigned __int64 src);Opcode/InstructionOp/ En64/32-bit ModeCPUID Feature FlagDescriptionF3 0F BC /rTZCNT r16, r/m16AV/VBMI1Count the number of trailing zero bits in r/m16, return result in r16.F3 0F BC /rTZCNT r32, r/m32AV/VBMI1Count the number of trailing zero bits in r/m32, return result in r32.F3 REX.W 0F BC /rTZCNT r64, r/m64AV/N.E.BMI1Count the number of trailing zero bits in r/m64, return result in r64.Op/EnOperand 1Operand 2Operand 3Operand 4AModRM:reg (w)ModRM:r/m (r)NANA
This UNOFFICIAL reference was generated from the official Intel® 64 and IA-32 Architectures Software Developer’s Manual by a dumb script. There is no guarantee that some parts aren't mangled or broken and is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.