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

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 2433813002: Reland "Add DoubleTestOp instruction" (Closed)
Patch Set: Created 4 years, 2 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 | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intrinsifier_arm.cc » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 3742 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 switch (op_kind()) { 3753 switch (op_kind()) {
3754 case Token::kADD: __ addsd(left, right); break; 3754 case Token::kADD: __ addsd(left, right); break;
3755 case Token::kSUB: __ subsd(left, right); break; 3755 case Token::kSUB: __ subsd(left, right); break;
3756 case Token::kMUL: __ mulsd(left, right); break; 3756 case Token::kMUL: __ mulsd(left, right); break;
3757 case Token::kDIV: __ divsd(left, right); break; 3757 case Token::kDIV: __ divsd(left, right); break;
3758 default: UNREACHABLE(); 3758 default: UNREACHABLE();
3759 } 3759 }
3760 } 3760 }
3761 3761
3762 3762
3763 LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone,
3764 bool opt) const {
3765 const intptr_t kNumInputs = 1;
3766 const intptr_t kNumTemps = 0;
3767 LocationSummary* summary = new(zone) LocationSummary(
3768 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3769 summary->set_in(0, Location::RequiresFpuRegister());
3770 summary->set_out(0, Location::RequiresRegister());
3771 return summary;
3772 }
3773
3774
3775 void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3776 ASSERT(compiler->is_optimizing());
3777 const XmmRegister value = locs()->in(0).fpu_reg();
3778 const Register result = locs()->out(0).reg();
3779 if (op_kind() == MethodRecognizer::kDouble_getIsNaN) {
3780 Label is_nan;
3781 __ LoadObject(result, Bool::True());
3782 __ comisd(value, value);
3783 __ j(PARITY_EVEN, &is_nan, Assembler::kNearJump);
3784 __ LoadObject(result, Bool::False());
3785 __ Bind(&is_nan);
3786 } else {
3787 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite);
3788 Label is_inf, done;
3789 __ AddImmediate(RSP, Immediate(-kDoubleSize));
3790 __ movsd(Address(RSP, 0), value);
3791 __ movq(result, Address(RSP, 0));
3792 // Mask off the sign.
3793 __ AndImmediate(result, Immediate(0x7FFFFFFFFFFFFFFFLL));
3794 // Compare with +infinity.
3795 __ CompareImmediate(result, Immediate(0x7FF0000000000000LL));
3796 __ j(EQUAL, &is_inf, Assembler::kNearJump);
3797 __ LoadObject(result, Bool::False());
3798 __ jmp(&done);
3799
3800 __ Bind(&is_inf);
3801 __ LoadObject(result, Bool::True());
3802
3803 __ Bind(&done);
3804 __ AddImmediate(RSP, Immediate(kDoubleSize));
3805 }
3806 }
3807
3808
3763 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, 3809 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
3764 bool opt) const { 3810 bool opt) const {
3765 const intptr_t kNumInputs = 2; 3811 const intptr_t kNumInputs = 2;
3766 const intptr_t kNumTemps = 0; 3812 const intptr_t kNumTemps = 0;
3767 LocationSummary* summary = new(zone) LocationSummary( 3813 LocationSummary* summary = new(zone) LocationSummary(
3768 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3814 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3769 summary->set_in(0, Location::RequiresFpuRegister()); 3815 summary->set_in(0, Location::RequiresFpuRegister());
3770 summary->set_in(1, Location::RequiresFpuRegister()); 3816 summary->set_in(1, Location::RequiresFpuRegister());
3771 summary->set_out(0, Location::SameAsFirstInput()); 3817 summary->set_out(0, Location::SameAsFirstInput());
3772 return summary; 3818 return summary;
(...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after
6637 __ Drop(1); 6683 __ Drop(1);
6638 __ popq(result); 6684 __ popq(result);
6639 } 6685 }
6640 6686
6641 6687
6642 } // namespace dart 6688 } // namespace dart
6643 6689
6644 #undef __ 6690 #undef __
6645 6691
6646 #endif // defined TARGET_ARCH_X64 6692 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intrinsifier_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698