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

Side by Side 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 unified diff | 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 »
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 punpckldq(dst, xmm0); 2879 punpckldq(dst, xmm0);
2880 } else { 2880 } else {
2881 DCHECK_EQ(0, imm8); 2881 DCHECK_EQ(0, imm8);
2882 psrlq(dst, 32); 2882 psrlq(dst, 32);
2883 punpckldq(xmm0, dst); 2883 punpckldq(xmm0, dst);
2884 movaps(dst, xmm0); 2884 movaps(dst, xmm0);
2885 } 2885 }
2886 } 2886 }
2887 2887
2888 2888
2889 void MacroAssembler::Lzcntl(Register dst, Register src) {
2890 // TODO(intel): Add support for LZCNT (BMI1/ABM).
2891 Label not_zero_src;
2892 bsrl(dst, src);
2893 j(not_zero, &not_zero_src, Label::kNear);
2894 Set(dst, 63); // 63^31 == 32
2895 bind(&not_zero_src);
2896 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
2897 }
2898
2899
2900 void MacroAssembler::Lzcntl(Register dst, const Operand& src) {
2901 // TODO(intel): Add support for LZCNT (BMI1/ABM).
2902 Label not_zero_src;
2903 bsrl(dst, src);
2904 j(not_zero, &not_zero_src, Label::kNear);
2905 Set(dst, 63); // 63^31 == 32
2906 bind(&not_zero_src);
2907 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
2908 }
2909
2910
2889 void MacroAssembler::Pushad() { 2911 void MacroAssembler::Pushad() {
2890 Push(rax); 2912 Push(rax);
2891 Push(rcx); 2913 Push(rcx);
2892 Push(rdx); 2914 Push(rdx);
2893 Push(rbx); 2915 Push(rbx);
2894 // Not pushing rsp or rbp. 2916 // Not pushing rsp or rbp.
2895 Push(rsi); 2917 Push(rsi);
2896 Push(rdi); 2918 Push(rdi);
2897 Push(r8); 2919 Push(r8);
2898 Push(r9); 2920 Push(r9);
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); 5098 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift));
5077 movl(rax, dividend); 5099 movl(rax, dividend);
5078 shrl(rax, Immediate(31)); 5100 shrl(rax, Immediate(31));
5079 addl(rdx, rax); 5101 addl(rdx, rax);
5080 } 5102 }
5081 5103
5082 5104
5083 } } // namespace v8::internal 5105 } } // namespace v8::internal
5084 5106
5085 #endif // V8_TARGET_ARCH_X64 5107 #endif // V8_TARGET_ARCH_X64
OLDNEW
« 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