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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 13867006: Inline binary Float32x4 ops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 689f965d55ebccbdc62c85076b7393f045b6224b..caf321681e11680f5f38d0fb542bee17d18027bf 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -2768,10 +2768,15 @@ void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 0;
+ const intptr_t value_cid = value()->Type()->ToCid();
+ const intptr_t kNumTemps = value_cid != kFloat32x4Cid ? 1 : 0;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
+ if (kNumTemps > 0) {
+ ASSERT(kNumTemps == 1);
+ summary->set_temp(0, Location::RequiresRegister());
+ }
summary->set_out(Location::RequiresFpuRegister());
return summary;
}
@@ -2782,7 +2787,14 @@ void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register value = locs()->in(0).reg();
const XmmRegister result = locs()->out().fpu_reg();
- ASSERT(value_cid == kFloat32x4Cid);
+ if (value_cid != kFloat32x4Cid) {
Vyacheslav Egorov (Google) 2013/04/15 11:09:35 See the comment in the optimizer. Emit CheckClass
Cutch 2013/04/15 13:34:56 Done.
+ Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptCheckClass);
+ Register temp = locs()->temp(0).reg();
+ __ testl(value, Immediate(kSmiTagMask));
+ __ j(ZERO, deopt);
+ __ CompareClassId(value, kFloat32x4Cid, temp);
+ __ j(NOT_EQUAL, deopt);
+ }
__ movups(result, FieldAddress(value, Float32x4::value_offset()));
}
@@ -2815,6 +2827,33 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 2;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresFpuRegister());
+ summary->set_in(1, Location::RequiresFpuRegister());
+ summary->set_out(Location::SameAsFirstInput());
+ return summary;
+}
+
+
+void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ XmmRegister left = locs()->in(0).fpu_reg();
+ XmmRegister right = locs()->in(1).fpu_reg();
+
+ ASSERT(locs()->out().fpu_reg() == left);
+
+ switch (op_kind()) {
+ case Token::kADD: __ addps(left, right); break;
+ case Token::kSUB: __ subps(left, right); break;
+ case Token::kMUL: __ mulps(left, right); break;
+ case Token::kDIV: __ divps(left, right); break;
+ default: UNREACHABLE();
+ }
+}
+
LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;

Powered by Google App Engine
This is Rietveld 408576698