OLD | NEW |
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 Loading... |
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, ¬_zero_src, Label::kNear); |
| 2894 Set(dst, 63); // 63^31 == 32 |
| 2895 bind(¬_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, ¬_zero_src, Label::kNear); |
| 2905 Set(dst, 63); // 63^31 == 32 |
| 2906 bind(¬_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 Loading... |
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 |
OLD | NEW |