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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 1040603002: [x64] Introduce BMI instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix previous Patch Set Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after
2879 } else { 2879 } else {
2880 DCHECK_EQ(0, imm8); 2880 DCHECK_EQ(0, imm8);
2881 psrlq(dst, 32); 2881 psrlq(dst, 32);
2882 punpckldq(xmm0, dst); 2882 punpckldq(xmm0, dst);
2883 movaps(dst, xmm0); 2883 movaps(dst, xmm0);
2884 } 2884 }
2885 } 2885 }
2886 2886
2887 2887
2888 void MacroAssembler::Lzcntl(Register dst, Register src) { 2888 void MacroAssembler::Lzcntl(Register dst, Register src) {
2889 // TODO(intel): Add support for LZCNT (BMI1/ABM). 2889 if (CpuFeatures::IsSupported(LZCNT)) {
2890 CpuFeatureScope scope(this, LZCNT);
2891 lzcntl(dst, src);
2892 return;
2893 }
2890 Label not_zero_src; 2894 Label not_zero_src;
2891 bsrl(dst, src); 2895 bsrl(dst, src);
2892 j(not_zero, &not_zero_src, Label::kNear); 2896 j(not_zero, &not_zero_src, Label::kNear);
2893 Set(dst, 63); // 63^31 == 32 2897 Set(dst, 63); // 63^31 == 32
2894 bind(&not_zero_src); 2898 bind(&not_zero_src);
2895 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x 2899 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
2896 } 2900 }
2897 2901
2898 2902
2899 void MacroAssembler::Lzcntl(Register dst, const Operand& src) { 2903 void MacroAssembler::Lzcntl(Register dst, const Operand& src) {
2900 // TODO(intel): Add support for LZCNT (BMI1/ABM). 2904 if (CpuFeatures::IsSupported(LZCNT)) {
2905 CpuFeatureScope scope(this, LZCNT);
2906 lzcntl(dst, src);
2907 return;
2908 }
2901 Label not_zero_src; 2909 Label not_zero_src;
2902 bsrl(dst, src); 2910 bsrl(dst, src);
2903 j(not_zero, &not_zero_src, Label::kNear); 2911 j(not_zero, &not_zero_src, Label::kNear);
2904 Set(dst, 63); // 63^31 == 32 2912 Set(dst, 63); // 63^31 == 32
2905 bind(&not_zero_src); 2913 bind(&not_zero_src);
2906 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x 2914 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
2907 } 2915 }
2908 2916
2909 2917
2910 void MacroAssembler::Pushad() { 2918 void MacroAssembler::Pushad() {
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5084 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); 5092 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift));
5085 movl(rax, dividend); 5093 movl(rax, dividend);
5086 shrl(rax, Immediate(31)); 5094 shrl(rax, Immediate(31));
5087 addl(rdx, rax); 5095 addl(rdx, rax);
5088 } 5096 }
5089 5097
5090 5098
5091 } } // namespace v8::internal 5099 } } // namespace v8::internal
5092 5100
5093 #endif // V8_TARGET_ARCH_X64 5101 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698