Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index 1b4ca5457fe8a3ae45d16d73ebd2c974946bd7f0..1deb09fc5e4383d34c95a260570260aaecb2c023 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -2430,6 +2430,20 @@ void MacroAssembler::Lzcnt(Register dst, const Operand& src) { |
} |
+void MacroAssembler::Tzcnt(Register dst, const Operand& src) { |
+ if (CpuFeatures::IsSupported(BMI1)) { |
+ CpuFeatureScope scope(this, BMI1); |
+ tzcnt(dst, src); |
+ return; |
+ } |
+ Label not_zero_src; |
+ bsf(dst, src); |
+ j(not_zero, ¬_zero_src, Label::kNear); |
+ Move(dst, Immediate(32)); // The result of tzcnt is 32 if src = 0. |
+ bind(¬_zero_src); |
+} |
+ |
+ |
void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
if (FLAG_native_code_counters && counter->Enabled()) { |
mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); |