Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Unified Diff: src/x64/macro-assembler-x64.cc

Issue 1413463009: Implemented the Word64Clz TurboFan operator for x64, arm64, and mips64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a typing problem, and added mips64. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 3374fc323a196c397ec729c1fa85df61d61f02aa..611e893e043f36abe508cc49ea7cb879a376b3c6 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -3159,6 +3159,36 @@ void MacroAssembler::Lzcntl(Register dst, const Operand& src) {
}
+void MacroAssembler::Lzcntq(Register dst, Register src) {
+ if (CpuFeatures::IsSupported(LZCNT)) {
+ CpuFeatureScope scope(this, LZCNT);
+ lzcntq(dst, src);
+ return;
+ }
+ Label not_zero_src;
+ bsrq(dst, src);
+ j(not_zero, &not_zero_src, Label::kNear);
+ Set(dst, 127); // 127^63 == 64
+ bind(&not_zero_src);
+ xorl(dst, Immediate(63)); // for x in [0..63], 63^x == 63 - x
+}
+
+
+void MacroAssembler::Lzcntq(Register dst, const Operand& src) {
+ if (CpuFeatures::IsSupported(LZCNT)) {
+ CpuFeatureScope scope(this, LZCNT);
+ lzcntq(dst, src);
+ return;
+ }
+ Label not_zero_src;
+ bsrq(dst, src);
+ j(not_zero, &not_zero_src, Label::kNear);
+ Set(dst, 127); // 127^63 == 64
+ bind(&not_zero_src);
+ xorl(dst, Immediate(63)); // for x in [0..63], 63^x == 63 - x
+}
+
+
void MacroAssembler::Tzcntl(Register dst, Register src) {
if (CpuFeatures::IsSupported(BMI1)) {
CpuFeatureScope scope(this, BMI1);
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698