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

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

Issue 21307004: Implement some conditional moves instructions for ia32/x64. Use them in MinMax instruction implemen… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64_test.cc ('k') | runtime/vm/intermediate_language_x64.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 const intptr_t kNumTemps = 1; 3679 const intptr_t kNumTemps = 1;
3680 LocationSummary* summary = 3680 LocationSummary* summary =
3681 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3681 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3682 summary->set_in(0, Location::RequiresFpuRegister()); 3682 summary->set_in(0, Location::RequiresFpuRegister());
3683 summary->set_in(1, Location::RequiresFpuRegister()); 3683 summary->set_in(1, Location::RequiresFpuRegister());
3684 // Reuse the left register so that code can be made shorter. 3684 // Reuse the left register so that code can be made shorter.
3685 summary->set_out(Location::SameAsFirstInput()); 3685 summary->set_out(Location::SameAsFirstInput());
3686 summary->set_temp(0, Location::RequiresRegister()); 3686 summary->set_temp(0, Location::RequiresRegister());
3687 return summary; 3687 return summary;
3688 } 3688 }
3689
3689 ASSERT(result_cid() == kSmiCid); 3690 ASSERT(result_cid() == kSmiCid);
3690 const intptr_t kNumInputs = 2; 3691 const intptr_t kNumInputs = 2;
3691 const intptr_t kNumTemps = 0; 3692 const intptr_t kNumTemps = 0;
3692 LocationSummary* summary = 3693 LocationSummary* summary =
3693 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3694 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3694 summary->set_in(0, Location::RequiresRegister()); 3695 summary->set_in(0, Location::RequiresRegister());
3695 summary->set_in(1, Location::RequiresRegister()); 3696 summary->set_in(1, Location::RequiresRegister());
3696 // Reuse the left register so that code can be made shorter. 3697 // Reuse the left register so that code can be made shorter.
3697 summary->set_out(Location::SameAsFirstInput()); 3698 summary->set_out(Location::SameAsFirstInput());
3698 return summary; 3699 return summary;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 if (is_min) { 3740 if (is_min) {
3740 __ j(NOT_ZERO, &done, Assembler::kNearJump); // Negative -> return left. 3741 __ j(NOT_ZERO, &done, Assembler::kNearJump); // Negative -> return left.
3741 } else { 3742 } else {
3742 __ j(ZERO, &done, Assembler::kNearJump); // Positive -> return left. 3743 __ j(ZERO, &done, Assembler::kNearJump); // Positive -> return left.
3743 } 3744 }
3744 __ movsd(result, right); 3745 __ movsd(result, right);
3745 __ Bind(&done); 3746 __ Bind(&done);
3746 return; 3747 return;
3747 } 3748 }
3748 3749
3749 Label done;
3750 ASSERT(result_cid() == kSmiCid); 3750 ASSERT(result_cid() == kSmiCid);
3751 Register left = locs()->in(0).reg(); 3751 Register left = locs()->in(0).reg();
3752 Register right = locs()->in(1).reg(); 3752 Register right = locs()->in(1).reg();
3753 Register result = locs()->out().reg(); 3753 Register result = locs()->out().reg();
3754 __ cmpl(left, right); 3754 __ cmpl(left, right);
3755 ASSERT(result == left);
3755 if (is_min) { 3756 if (is_min) {
3756 ASSERT(result == left); 3757 __ cmovgel(result, right);
3757 __ j(LESS_EQUAL, &done, Assembler::kNearJump);
3758 } else { 3758 } else {
3759 __ j(GREATER_EQUAL, &done, Assembler::kNearJump); 3759 __ cmovlessl(result, right);
3760 } 3760 }
3761 __ movl(result, right);
3762 __ Bind(&done);
3763 } 3761 }
3764 3762
3765 3763
3766 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { 3764 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const {
3767 const intptr_t kNumInputs = 1; 3765 const intptr_t kNumInputs = 1;
3768 return LocationSummary::Make(kNumInputs, 3766 return LocationSummary::Make(kNumInputs,
3769 Location::SameAsFirstInput(), 3767 Location::SameAsFirstInput(),
3770 LocationSummary::kNoCall); 3768 LocationSummary::kNoCall);
3771 } 3769 }
3772 3770
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4878 PcDescriptors::kOther, 4876 PcDescriptors::kOther,
4879 locs()); 4877 locs());
4880 __ Drop(2); // Discard type arguments and receiver. 4878 __ Drop(2); // Discard type arguments and receiver.
4881 } 4879 }
4882 4880
4883 } // namespace dart 4881 } // namespace dart
4884 4882
4885 #undef __ 4883 #undef __
4886 4884
4887 #endif // defined TARGET_ARCH_IA32 4885 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64_test.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698