Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index bde32be47e584ceaa00de4f69ba72f7696f7fed8..02fcebf3a14b48c5743adeab890f7ebf548a2456 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -2826,6 +2826,34 @@ void MacroAssembler::Lzcntl(Register dst, const Operand& src) { |
} |
+void MacroAssembler::Tzcntl(Register dst, Register src) { |
+ if (CpuFeatures::IsSupported(BMI1)) { |
+ CpuFeatureScope scope(this, BMI1); |
+ tzcntl(dst, src); |
+ return; |
+ } |
+ Label not_zero_src; |
+ bsfl(dst, src); |
+ j(not_zero, ¬_zero_src, Label::kNear); |
+ Set(dst, 32); // The result of tzcnt is 32 if src = 0. |
+ bind(¬_zero_src); |
+} |
+ |
+ |
+void MacroAssembler::Tzcntl(Register dst, const Operand& src) { |
+ if (CpuFeatures::IsSupported(BMI1)) { |
+ CpuFeatureScope scope(this, BMI1); |
+ tzcntl(dst, src); |
+ return; |
+ } |
+ Label not_zero_src; |
+ bsfl(dst, src); |
+ j(not_zero, ¬_zero_src, Label::kNear); |
+ Set(dst, 32); // The result of tzcnt is 32 if src = 0. |
+ bind(¬_zero_src); |
+} |
+ |
+ |
void MacroAssembler::Pushad() { |
Push(rax); |
Push(rcx); |