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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 23654026: Use xorps to break the cvtsi2sd unnecessary dependence due to its partially written (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: rebase to master and address comments Created 7 years, 3 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/codegen-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after
3513 __ cvttsd2si(output_reg, input_reg); 3513 __ cvttsd2si(output_reg, input_reg);
3514 // Overflow is signalled with minint. 3514 // Overflow is signalled with minint.
3515 __ cmpl(output_reg, Immediate(0x80000000)); 3515 __ cmpl(output_reg, Immediate(0x80000000));
3516 DeoptimizeIf(equal, instr->environment()); 3516 DeoptimizeIf(equal, instr->environment());
3517 __ jmp(&done, Label::kNear); 3517 __ jmp(&done, Label::kNear);
3518 3518
3519 // Non-zero negative reaches here. 3519 // Non-zero negative reaches here.
3520 __ bind(&negative_sign); 3520 __ bind(&negative_sign);
3521 // Truncate, then compare and compensate. 3521 // Truncate, then compare and compensate.
3522 __ cvttsd2si(output_reg, input_reg); 3522 __ cvttsd2si(output_reg, input_reg);
3523 __ cvtlsi2sd(xmm_scratch, output_reg); 3523 __ Cvtlsi2sd(xmm_scratch, output_reg);
3524 __ ucomisd(input_reg, xmm_scratch); 3524 __ ucomisd(input_reg, xmm_scratch);
3525 __ j(equal, &done, Label::kNear); 3525 __ j(equal, &done, Label::kNear);
3526 __ subl(output_reg, Immediate(1)); 3526 __ subl(output_reg, Immediate(1));
3527 DeoptimizeIf(overflow, instr->environment()); 3527 DeoptimizeIf(overflow, instr->environment());
3528 3528
3529 __ bind(&done); 3529 __ bind(&done);
3530 } 3530 }
3531 } 3531 }
3532 3532
3533 3533
(...skipping 28 matching lines...) Expand all
3562 // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then 3562 // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then
3563 // compare and compensate. 3563 // compare and compensate.
3564 __ movq(kScratchRegister, input_reg); // Back up input_reg. 3564 __ movq(kScratchRegister, input_reg); // Back up input_reg.
3565 __ subsd(input_reg, xmm_scratch); 3565 __ subsd(input_reg, xmm_scratch);
3566 __ cvttsd2si(output_reg, input_reg); 3566 __ cvttsd2si(output_reg, input_reg);
3567 // Catch minint due to overflow, and to prevent overflow when compensating. 3567 // Catch minint due to overflow, and to prevent overflow when compensating.
3568 __ cmpl(output_reg, Immediate(0x80000000)); 3568 __ cmpl(output_reg, Immediate(0x80000000));
3569 __ RecordComment("D2I conversion overflow"); 3569 __ RecordComment("D2I conversion overflow");
3570 DeoptimizeIf(equal, instr->environment()); 3570 DeoptimizeIf(equal, instr->environment());
3571 3571
3572 __ cvtlsi2sd(xmm_scratch, output_reg); 3572 __ Cvtlsi2sd(xmm_scratch, output_reg);
3573 __ ucomisd(input_reg, xmm_scratch); 3573 __ ucomisd(input_reg, xmm_scratch);
3574 __ j(equal, &restore, Label::kNear); 3574 __ j(equal, &restore, Label::kNear);
3575 __ subl(output_reg, Immediate(1)); 3575 __ subl(output_reg, Immediate(1));
3576 // No overflow because we already ruled out minint. 3576 // No overflow because we already ruled out minint.
3577 __ bind(&restore); 3577 __ bind(&restore);
3578 __ movq(input_reg, kScratchRegister); // Restore input_reg. 3578 __ movq(input_reg, kScratchRegister); // Restore input_reg.
3579 __ jmp(&done); 3579 __ jmp(&done);
3580 3580
3581 __ bind(&round_to_zero); 3581 __ bind(&round_to_zero);
3582 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if 3582 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
4442 __ StoreToSafepointRegisterSlot(result, rax); 4442 __ StoreToSafepointRegisterSlot(result, rax);
4443 } 4443 }
4444 4444
4445 4445
4446 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { 4446 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
4447 LOperand* input = instr->value(); 4447 LOperand* input = instr->value();
4448 ASSERT(input->IsRegister() || input->IsStackSlot()); 4448 ASSERT(input->IsRegister() || input->IsStackSlot());
4449 LOperand* output = instr->result(); 4449 LOperand* output = instr->result();
4450 ASSERT(output->IsDoubleRegister()); 4450 ASSERT(output->IsDoubleRegister());
4451 if (input->IsRegister()) { 4451 if (input->IsRegister()) {
4452 __ cvtlsi2sd(ToDoubleRegister(output), ToRegister(input)); 4452 __ Cvtlsi2sd(ToDoubleRegister(output), ToRegister(input));
4453 } else { 4453 } else {
4454 __ cvtlsi2sd(ToDoubleRegister(output), ToOperand(input)); 4454 __ Cvtlsi2sd(ToDoubleRegister(output), ToOperand(input));
4455 } 4455 }
4456 } 4456 }
4457 4457
4458 4458
4459 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { 4459 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) {
4460 LOperand* input = instr->value(); 4460 LOperand* input = instr->value();
4461 ASSERT(input->IsRegister()); 4461 ASSERT(input->IsRegister());
4462 LOperand* output = instr->result(); 4462 LOperand* output = instr->result();
4463 __ Integer32ToSmi(ToRegister(output), ToRegister(input)); 4463 __ Integer32ToSmi(ToRegister(output), ToRegister(input));
4464 if (!instr->hydrogen()->value()->HasRange() || 4464 if (!instr->hydrogen()->value()->HasRange() ||
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
4661 DeoptimizeIf(not_zero, env); 4661 DeoptimizeIf(not_zero, env);
4662 } 4662 }
4663 __ jmp(&done, Label::kNear); 4663 __ jmp(&done, Label::kNear);
4664 } else { 4664 } else {
4665 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); 4665 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI);
4666 } 4666 }
4667 4667
4668 // Smi to XMM conversion 4668 // Smi to XMM conversion
4669 __ bind(&load_smi); 4669 __ bind(&load_smi);
4670 __ SmiToInteger32(kScratchRegister, input_reg); 4670 __ SmiToInteger32(kScratchRegister, input_reg);
4671 __ cvtlsi2sd(result_reg, kScratchRegister); 4671 __ Cvtlsi2sd(result_reg, kScratchRegister);
4672 __ bind(&done); 4672 __ bind(&done);
4673 } 4673 }
4674 4674
4675 4675
4676 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { 4676 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
4677 Label heap_number; 4677 Label heap_number;
4678 Register input_reg = ToRegister(instr->value()); 4678 Register input_reg = ToRegister(instr->value());
4679 4679
4680 4680
4681 if (instr->truncating()) { 4681 if (instr->truncating()) {
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
5493 FixedArray::kHeaderSize - kPointerSize)); 5493 FixedArray::kHeaderSize - kPointerSize));
5494 __ bind(&done); 5494 __ bind(&done);
5495 } 5495 }
5496 5496
5497 5497
5498 #undef __ 5498 #undef __
5499 5499
5500 } } // namespace v8::internal 5500 } } // namespace v8::internal
5501 5501
5502 #endif // V8_TARGET_ARCH_X64 5502 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698