| 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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 CpuFeatureScope scope(this, AVX); | 892 CpuFeatureScope scope(this, AVX); |
| 893 vxorpd(dst, dst, dst); | 893 vxorpd(dst, dst, dst); |
| 894 vcvtqsi2sd(dst, dst, src); | 894 vcvtqsi2sd(dst, dst, src); |
| 895 } else { | 895 } else { |
| 896 xorpd(dst, dst); | 896 xorpd(dst, dst); |
| 897 cvtqsi2sd(dst, src); | 897 cvtqsi2sd(dst, src); |
| 898 } | 898 } |
| 899 } | 899 } |
| 900 | 900 |
| 901 | 901 |
| 902 void MacroAssembler::Cvtqui2sd(XMMRegister dst, Register src) { | 902 void MacroAssembler::Cvtqui2sd(XMMRegister dst, Register src, Register tmp) { |
| 903 Label msb_set_src; | 903 Label msb_set_src; |
| 904 Label jmp_return; | 904 Label jmp_return; |
| 905 testq(src, src); | 905 testq(src, src); |
| 906 j(sign, &msb_set_src, Label::kNear); | 906 j(sign, &msb_set_src, Label::kNear); |
| 907 Cvtqsi2sd(dst, src); | 907 Cvtqsi2sd(dst, src); |
| 908 jmp(&jmp_return, Label::kNear); | 908 jmp(&jmp_return, Label::kNear); |
| 909 bind(&msb_set_src); | 909 bind(&msb_set_src); |
| 910 movq(tmp, src); |
| 910 shrq(src, Immediate(1)); | 911 shrq(src, Immediate(1)); |
| 912 // Recover the least significant bit to avoid rounding errors. |
| 913 andq(tmp, Immediate(1)); |
| 914 orq(src, tmp); |
| 911 Cvtqsi2sd(dst, src); | 915 Cvtqsi2sd(dst, src); |
| 912 addsd(dst, dst); | 916 addsd(dst, dst); |
| 913 bind(&jmp_return); | 917 bind(&jmp_return); |
| 914 } | 918 } |
| 915 | 919 |
| 916 | 920 |
| 917 void MacroAssembler::Cvtsd2si(Register dst, XMMRegister src) { | 921 void MacroAssembler::Cvtsd2si(Register dst, XMMRegister src) { |
| 918 if (CpuFeatures::IsSupported(AVX)) { | 922 if (CpuFeatures::IsSupported(AVX)) { |
| 919 CpuFeatureScope scope(this, AVX); | 923 CpuFeatureScope scope(this, AVX); |
| 920 vcvtsd2si(dst, src); | 924 vcvtsd2si(dst, src); |
| (...skipping 4570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5491 movl(rax, dividend); | 5495 movl(rax, dividend); |
| 5492 shrl(rax, Immediate(31)); | 5496 shrl(rax, Immediate(31)); |
| 5493 addl(rdx, rax); | 5497 addl(rdx, rax); |
| 5494 } | 5498 } |
| 5495 | 5499 |
| 5496 | 5500 |
| 5497 } // namespace internal | 5501 } // namespace internal |
| 5498 } // namespace v8 | 5502 } // namespace v8 |
| 5499 | 5503 |
| 5500 #endif // V8_TARGET_ARCH_X64 | 5504 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |