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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 } | 2819 } |
2820 Label not_zero_src; | 2820 Label not_zero_src; |
2821 bsrl(dst, src); | 2821 bsrl(dst, src); |
2822 j(not_zero, ¬_zero_src, Label::kNear); | 2822 j(not_zero, ¬_zero_src, Label::kNear); |
2823 Set(dst, 63); // 63^31 == 32 | 2823 Set(dst, 63); // 63^31 == 32 |
2824 bind(¬_zero_src); | 2824 bind(¬_zero_src); |
2825 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x | 2825 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x |
2826 } | 2826 } |
2827 | 2827 |
2828 | 2828 |
| 2829 void MacroAssembler::Tzcntl(Register dst, Register src) { |
| 2830 if (CpuFeatures::IsSupported(BMI1)) { |
| 2831 CpuFeatureScope scope(this, BMI1); |
| 2832 tzcntl(dst, src); |
| 2833 return; |
| 2834 } |
| 2835 Label not_zero_src; |
| 2836 bsfl(dst, src); |
| 2837 j(not_zero, ¬_zero_src, Label::kNear); |
| 2838 Set(dst, 32); // The result of tzcnt is 32 if src = 0. |
| 2839 bind(¬_zero_src); |
| 2840 } |
| 2841 |
| 2842 |
| 2843 void MacroAssembler::Tzcntl(Register dst, const Operand& src) { |
| 2844 if (CpuFeatures::IsSupported(BMI1)) { |
| 2845 CpuFeatureScope scope(this, BMI1); |
| 2846 tzcntl(dst, src); |
| 2847 return; |
| 2848 } |
| 2849 Label not_zero_src; |
| 2850 bsfl(dst, src); |
| 2851 j(not_zero, ¬_zero_src, Label::kNear); |
| 2852 Set(dst, 32); // The result of tzcnt is 32 if src = 0. |
| 2853 bind(¬_zero_src); |
| 2854 } |
| 2855 |
| 2856 |
2829 void MacroAssembler::Pushad() { | 2857 void MacroAssembler::Pushad() { |
2830 Push(rax); | 2858 Push(rax); |
2831 Push(rcx); | 2859 Push(rcx); |
2832 Push(rdx); | 2860 Push(rdx); |
2833 Push(rbx); | 2861 Push(rbx); |
2834 // Not pushing rsp or rbp. | 2862 // Not pushing rsp or rbp. |
2835 Push(rsi); | 2863 Push(rsi); |
2836 Push(rdi); | 2864 Push(rdi); |
2837 Push(r8); | 2865 Push(r8); |
2838 Push(r9); | 2866 Push(r9); |
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5001 movl(rax, dividend); | 5029 movl(rax, dividend); |
5002 shrl(rax, Immediate(31)); | 5030 shrl(rax, Immediate(31)); |
5003 addl(rdx, rax); | 5031 addl(rdx, rax); |
5004 } | 5032 } |
5005 | 5033 |
5006 | 5034 |
5007 } // namespace internal | 5035 } // namespace internal |
5008 } // namespace v8 | 5036 } // namespace v8 |
5009 | 5037 |
5010 #endif // V8_TARGET_ARCH_X64 | 5038 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |