Index: src/x87/macro-assembler-x87.cc |
diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc |
index 96a265afefe270ace838f83bfb3809bf42253962..bb877fe69775b5c904dcd900769db5e994c95a61 100644 |
--- a/src/x87/macro-assembler-x87.cc |
+++ b/src/x87/macro-assembler-x87.cc |
@@ -2317,6 +2317,16 @@ void MacroAssembler::Lzcnt(Register dst, const Operand& src) { |
} |
+void MacroAssembler::Tzcnt(Register dst, const Operand& src) { |
+ // TODO(intel): Add support for TZCNT (with ABM/BMI1). |
+ 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)); |