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

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

Issue 1021183002: [turbofan] Turn Math.clz32 into an inlinable builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months 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/test-disasm-x64.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 293b064a448ed7b96cfc87a0999260d9b598139b..12c471c2fface1519c1141ef9ee701a9fb7c80da 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -2886,6 +2886,28 @@ void MacroAssembler::Pinsrd(XMMRegister dst, const Operand& src, int8_t imm8) {
}
+void MacroAssembler::Lzcntl(Register dst, Register src) {
+ // TODO(intel): Add support for LZCNT (BMI1/ABM).
+ Label not_zero_src;
+ bsrl(dst, src);
+ j(not_zero, &not_zero_src, Label::kNear);
+ Set(dst, 63); // 63^31 == 32
+ bind(&not_zero_src);
+ xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
+}
+
+
+void MacroAssembler::Lzcntl(Register dst, const Operand& src) {
+ // TODO(intel): Add support for LZCNT (BMI1/ABM).
+ Label not_zero_src;
+ bsrl(dst, src);
+ j(not_zero, &not_zero_src, Label::kNear);
+ Set(dst, 63); // 63^31 == 32
+ bind(&not_zero_src);
+ xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
+}
+
+
void MacroAssembler::Pushad() {
Push(rax);
Push(rcx);
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698