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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 | 789 |
790 void MacroAssembler::Cvtlsi2sd(XMMRegister dst, Register src) { | 790 void MacroAssembler::Cvtlsi2sd(XMMRegister dst, Register src) { |
791 if (CpuFeatures::IsSupported(AVX)) { | 791 if (CpuFeatures::IsSupported(AVX)) { |
792 CpuFeatureScope scope(this, AVX); | 792 CpuFeatureScope scope(this, AVX); |
793 vxorpd(dst, dst, dst); | 793 vxorpd(dst, dst, dst); |
794 vcvtlsi2sd(dst, dst, src); | 794 vcvtlsi2sd(dst, dst, src); |
795 } else { | 795 } else { |
796 xorps(dst, dst); | 796 xorpd(dst, dst); |
797 cvtlsi2sd(dst, src); | 797 cvtlsi2sd(dst, src); |
798 } | 798 } |
799 } | 799 } |
800 | 800 |
801 | 801 |
802 void MacroAssembler::Cvtlsi2sd(XMMRegister dst, const Operand& src) { | 802 void MacroAssembler::Cvtlsi2sd(XMMRegister dst, const Operand& src) { |
803 if (CpuFeatures::IsSupported(AVX)) { | 803 if (CpuFeatures::IsSupported(AVX)) { |
804 CpuFeatureScope scope(this, AVX); | 804 CpuFeatureScope scope(this, AVX); |
805 vxorpd(dst, dst, dst); | 805 vxorpd(dst, dst, dst); |
806 vcvtlsi2sd(dst, dst, src); | 806 vcvtlsi2sd(dst, dst, src); |
807 } else { | 807 } else { |
808 xorps(dst, dst); | 808 xorpd(dst, dst); |
809 cvtlsi2sd(dst, src); | 809 cvtlsi2sd(dst, src); |
810 } | 810 } |
811 } | 811 } |
812 | 812 |
813 | 813 |
814 void MacroAssembler::Load(Register dst, const Operand& src, Representation r) { | 814 void MacroAssembler::Load(Register dst, const Operand& src, Representation r) { |
815 DCHECK(!r.IsDouble()); | 815 DCHECK(!r.IsDouble()); |
816 if (r.IsInteger8()) { | 816 if (r.IsInteger8()) { |
817 movsxbq(dst, src); | 817 movsxbq(dst, src); |
818 } else if (r.IsUInteger8()) { | 818 } else if (r.IsUInteger8()) { |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 Move(dst, Smi::cast(*source)); | 2398 Move(dst, Smi::cast(*source)); |
2399 } else { | 2399 } else { |
2400 MoveHeapObject(kScratchRegister, source); | 2400 MoveHeapObject(kScratchRegister, source); |
2401 movp(dst, kScratchRegister); | 2401 movp(dst, kScratchRegister); |
2402 } | 2402 } |
2403 } | 2403 } |
2404 | 2404 |
2405 | 2405 |
2406 void MacroAssembler::Move(XMMRegister dst, uint32_t src) { | 2406 void MacroAssembler::Move(XMMRegister dst, uint32_t src) { |
2407 if (src == 0) { | 2407 if (src == 0) { |
2408 xorps(dst, dst); | 2408 Xorpd(dst, dst); |
2409 } else { | 2409 } else { |
2410 unsigned pop = base::bits::CountPopulation32(src); | 2410 unsigned pop = base::bits::CountPopulation32(src); |
2411 DCHECK_NE(0u, pop); | 2411 DCHECK_NE(0u, pop); |
2412 if (pop == 32) { | 2412 if (pop == 32) { |
2413 pcmpeqd(dst, dst); | 2413 pcmpeqd(dst, dst); |
2414 } else { | 2414 } else { |
2415 movl(kScratchRegister, Immediate(src)); | 2415 movl(kScratchRegister, Immediate(src)); |
2416 Movq(dst, kScratchRegister); | 2416 Movq(dst, kScratchRegister); |
2417 } | 2417 } |
2418 } | 2418 } |
2419 } | 2419 } |
2420 | 2420 |
2421 | 2421 |
2422 void MacroAssembler::Move(XMMRegister dst, uint64_t src) { | 2422 void MacroAssembler::Move(XMMRegister dst, uint64_t src) { |
2423 if (src == 0) { | 2423 if (src == 0) { |
2424 xorps(dst, dst); | 2424 Xorpd(dst, dst); |
2425 } else { | 2425 } else { |
2426 unsigned nlz = base::bits::CountLeadingZeros64(src); | 2426 unsigned nlz = base::bits::CountLeadingZeros64(src); |
2427 unsigned ntz = base::bits::CountTrailingZeros64(src); | 2427 unsigned ntz = base::bits::CountTrailingZeros64(src); |
2428 unsigned pop = base::bits::CountPopulation64(src); | 2428 unsigned pop = base::bits::CountPopulation64(src); |
2429 DCHECK_NE(0u, pop); | 2429 DCHECK_NE(0u, pop); |
2430 if (pop == 64) { | 2430 if (pop == 64) { |
2431 pcmpeqd(dst, dst); | 2431 pcmpeqd(dst, dst); |
2432 } else if (pop + ntz == 64) { | 2432 } else if (pop + ntz == 64) { |
2433 pcmpeqd(dst, dst); | 2433 pcmpeqd(dst, dst); |
2434 psllq(dst, ntz); | 2434 psllq(dst, ntz); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 void MacroAssembler::Movq(Register dst, XMMRegister src) { | 2532 void MacroAssembler::Movq(Register dst, XMMRegister src) { |
2533 if (CpuFeatures::IsSupported(AVX)) { | 2533 if (CpuFeatures::IsSupported(AVX)) { |
2534 CpuFeatureScope scope(this, AVX); | 2534 CpuFeatureScope scope(this, AVX); |
2535 vmovq(dst, src); | 2535 vmovq(dst, src); |
2536 } else { | 2536 } else { |
2537 movq(dst, src); | 2537 movq(dst, src); |
2538 } | 2538 } |
2539 } | 2539 } |
2540 | 2540 |
2541 | 2541 |
| 2542 void MacroAssembler::Xorpd(XMMRegister dst, XMMRegister src) { |
| 2543 if (CpuFeatures::IsSupported(AVX)) { |
| 2544 CpuFeatureScope scope(this, AVX); |
| 2545 vxorpd(dst, dst, src); |
| 2546 } else { |
| 2547 xorpd(dst, src); |
| 2548 } |
| 2549 } |
| 2550 |
| 2551 |
2542 void MacroAssembler::Cmp(Register dst, Handle<Object> source) { | 2552 void MacroAssembler::Cmp(Register dst, Handle<Object> source) { |
2543 AllowDeferredHandleDereference smi_check; | 2553 AllowDeferredHandleDereference smi_check; |
2544 if (source->IsSmi()) { | 2554 if (source->IsSmi()) { |
2545 Cmp(dst, Smi::cast(*source)); | 2555 Cmp(dst, Smi::cast(*source)); |
2546 } else { | 2556 } else { |
2547 MoveHeapObject(kScratchRegister, source); | 2557 MoveHeapObject(kScratchRegister, source); |
2548 cmpp(dst, kScratchRegister); | 2558 cmpp(dst, kScratchRegister); |
2549 } | 2559 } |
2550 } | 2560 } |
2551 | 2561 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3207 decb(reg); // 0 if negative, 255 if positive. | 3217 decb(reg); // 0 if negative, 255 if positive. |
3208 bind(&done); | 3218 bind(&done); |
3209 } | 3219 } |
3210 | 3220 |
3211 | 3221 |
3212 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, | 3222 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, |
3213 XMMRegister temp_xmm_reg, | 3223 XMMRegister temp_xmm_reg, |
3214 Register result_reg) { | 3224 Register result_reg) { |
3215 Label done; | 3225 Label done; |
3216 Label conv_failure; | 3226 Label conv_failure; |
3217 xorps(temp_xmm_reg, temp_xmm_reg); | 3227 Xorpd(temp_xmm_reg, temp_xmm_reg); |
3218 cvtsd2si(result_reg, input_reg); | 3228 cvtsd2si(result_reg, input_reg); |
3219 testl(result_reg, Immediate(0xFFFFFF00)); | 3229 testl(result_reg, Immediate(0xFFFFFF00)); |
3220 j(zero, &done, Label::kNear); | 3230 j(zero, &done, Label::kNear); |
3221 cmpl(result_reg, Immediate(1)); | 3231 cmpl(result_reg, Immediate(1)); |
3222 j(overflow, &conv_failure, Label::kNear); | 3232 j(overflow, &conv_failure, Label::kNear); |
3223 movl(result_reg, Immediate(0)); | 3233 movl(result_reg, Immediate(0)); |
3224 setcc(sign, result_reg); | 3234 setcc(sign, result_reg); |
3225 subl(result_reg, Immediate(1)); | 3235 subl(result_reg, Immediate(1)); |
3226 andl(result_reg, Immediate(255)); | 3236 andl(result_reg, Immediate(255)); |
3227 jmp(&done, Label::kNear); | 3237 jmp(&done, Label::kNear); |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5131 movl(rax, dividend); | 5141 movl(rax, dividend); |
5132 shrl(rax, Immediate(31)); | 5142 shrl(rax, Immediate(31)); |
5133 addl(rdx, rax); | 5143 addl(rdx, rax); |
5134 } | 5144 } |
5135 | 5145 |
5136 | 5146 |
5137 } // namespace internal | 5147 } // namespace internal |
5138 } // namespace v8 | 5148 } // namespace v8 |
5139 | 5149 |
5140 #endif // V8_TARGET_ARCH_X64 | 5150 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |