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

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

Issue 1405453003: CTZ instruction implemented as optional operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a bug when bmi1=false Created 5 years, 2 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/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 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, &not_zero_src, Label::kNear);
+ Set(dst, 32); // The result of tzcnt is 32 if src = 0.
+ bind(&not_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, &not_zero_src, Label::kNear);
+ Set(dst, 32); // The result of tzcnt is 32 if src = 0.
+ bind(&not_zero_src);
+}
+
+
void MacroAssembler::Pushad() {
Push(rax);
Push(rcx);
« 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