| Index: src/x64/macro-assembler-x64.cc
|
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
|
| index 611e893e043f36abe508cc49ea7cb879a376b3c6..5b0b9a04146904b787a5144d813922963448949d 100644
|
| --- a/src/x64/macro-assembler-x64.cc
|
| +++ b/src/x64/macro-assembler-x64.cc
|
| @@ -3189,6 +3189,36 @@ void MacroAssembler::Lzcntq(Register dst, const Operand& src) {
|
| }
|
|
|
|
|
| +void MacroAssembler::Tzcntq(Register dst, Register src) {
|
| + if (CpuFeatures::IsSupported(BMI1)) {
|
| + CpuFeatureScope scope(this, BMI1);
|
| + tzcntq(dst, src);
|
| + return;
|
| + }
|
| + Label not_zero_src;
|
| + bsfq(dst, src);
|
| + j(not_zero, ¬_zero_src, Label::kNear);
|
| + // Define the result of tzcnt(0) separately, because bsf(0) is undefined.
|
| + Set(dst, 64);
|
| + bind(¬_zero_src);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::Tzcntq(Register dst, const Operand& src) {
|
| + if (CpuFeatures::IsSupported(BMI1)) {
|
| + CpuFeatureScope scope(this, BMI1);
|
| + tzcntq(dst, src);
|
| + return;
|
| + }
|
| + Label not_zero_src;
|
| + bsfq(dst, src);
|
| + j(not_zero, ¬_zero_src, Label::kNear);
|
| + // Define the result of tzcnt(0) separately, because bsf(0) is undefined.
|
| + Set(dst, 64);
|
| + bind(¬_zero_src);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::Tzcntl(Register dst, Register src) {
|
| if (CpuFeatures::IsSupported(BMI1)) {
|
| CpuFeatureScope scope(this, BMI1);
|
|
|