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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 13818006: Unboxed load/store indexed of Float32x4 (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_x64.cc
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index a13034474da6675a27c22cbe47ef662103d0881f..897b8432ce69a4f56e0b8d81a7872974ff866359 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -991,6 +991,8 @@ CompileType LoadIndexedInstr::ComputeType() const {
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
return CompileType::FromCid(kDoubleCid);
+ case kTypedDataFloat32x4ArrayCid:
+ return CompileType::FromCid(kFloat32x4Cid);
case kTypedDataInt8ArrayCid:
case kTypedDataUint8ArrayCid:
@@ -1031,6 +1033,8 @@ Representation LoadIndexedInstr::representation() const {
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
return kUnboxedDouble;
+ case kTypedDataFloat32x4ArrayCid:
+ return kUnboxedFloat32x4;
default:
UNIMPLEMENTED();
return kTagged;
@@ -1090,7 +1094,8 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Smi::Cast(index.constant()).Value());
}
- if (representation() == kUnboxedDouble) {
+ if ((representation() == kUnboxedDouble) ||
+ (representation() == kUnboxedFloat32x4)) {
if ((index_scale() == 1) && index.IsRegister()) {
__ SmiUntag(index.reg());
}
@@ -1101,9 +1106,11 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ movss(result, element_address);
// Promote to double.
__ cvtss2sd(result, locs()->out().fpu_reg());
- } else {
- ASSERT(class_id() == kTypedDataFloat64ArrayCid);
+ } else if (class_id() == kTypedDataFloat64ArrayCid) {
__ movsd(result, element_address);
+ } else {
+ ASSERT(class_id() == kTypedDataFloat32x4ArrayCid);
+ __ movups(result, element_address);
}
return;
}
@@ -1170,6 +1177,8 @@ Representation StoreIndexedInstr::RequiredInputRepresentation(
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
return kUnboxedDouble;
+ case kTypedDataFloat32x4ArrayCid:
+ return kUnboxedFloat32x4;
default:
UNIMPLEMENTED();
return kTagged;
@@ -1226,6 +1235,9 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
// TODO(srdjan): Support Float64 constants.
locs->set_in(2, Location::RequiresFpuRegister());
break;
+ case kTypedDataFloat32x4ArrayCid:
+ locs->set_in(2, Location::RequiresFpuRegister());
+ break;
default:
UNREACHABLE();
return NULL;
@@ -1339,6 +1351,9 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case kTypedDataFloat64ArrayCid:
__ movsd(element_address, locs()->in(2).fpu_reg());
break;
+ case kTypedDataFloat32x4ArrayCid:
+ __ movups(element_address, locs()->in(2).fpu_reg());
+ break;
default:
UNREACHABLE();
}
@@ -2487,11 +2502,11 @@ class BoxDoubleSlowPath : public SlowPathCode {
locs->live_registers()->Remove(locs->out());
compiler->SaveLiveRegisters(locs);
- compiler->GenerateCall(instruction_->token_pos(),
+ compiler->GenerateCall(Scanner::kDummyTokenIndex, // No token position.
&label,
PcDescriptors::kOther,
locs);
- if (RAX != locs->out().reg()) __ movq(locs->out().reg(), RAX);
+ __ MoveRegister(locs->out().reg(), RAX);
compiler->RestoreLiveRegisters(locs);
__ jmp(exit_label());
@@ -2559,6 +2574,92 @@ void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* BoxFloat32x4Instr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs,
+ kNumTemps,
+ LocationSummary::kCallOnSlowPath);
+ summary->set_in(0, Location::RequiresFpuRegister());
+ summary->set_out(Location::RequiresRegister());
+ return summary;
+}
+
+
+class BoxFloat32x4SlowPath : public SlowPathCode {
+ public:
+ explicit BoxFloat32x4SlowPath(BoxFloat32x4Instr* instruction)
+ : instruction_(instruction) { }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Comment("BoxFloat32x4SlowPath");
+ __ Bind(entry_label());
+ const Class& float32x4_class = compiler->float32x4_class();
+ const Code& stub =
+ Code::Handle(StubCode::GetAllocationStubForClass(float32x4_class));
+ const ExternalLabel label(float32x4_class.ToCString(), stub.EntryPoint());
+
+ LocationSummary* locs = instruction_->locs();
+ locs->live_registers()->Remove(locs->out());
+
+ compiler->SaveLiveRegisters(locs);
+ compiler->GenerateCall(Scanner::kDummyTokenIndex, // No token position.
+ &label,
+ PcDescriptors::kOther,
+ locs);
+ __ MoveRegister(locs->out().reg(), RAX);
+ compiler->RestoreLiveRegisters(locs);
+
+ __ jmp(exit_label());
+ }
+
+ private:
+ BoxFloat32x4Instr* instruction_;
+};
+
+
+void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this);
+ compiler->AddSlowPathCode(slow_path);
+
+ Register out_reg = locs()->out().reg();
+ XmmRegister value = locs()->in(0).fpu_reg();
+
+ __ TryAllocate(compiler->float32x4_class(),
+ slow_path->entry_label(),
+ Assembler::kFarJump,
+ out_reg);
+ __ Bind(slow_path->exit_label());
+ __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value);
+}
+
+
+LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresRegister());
+ summary->set_out(Location::RequiresFpuRegister());
+ return summary;
+}
+
+
+void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const intptr_t value_cid = value()->Type()->ToCid();
+ const Register value = locs()->in(0).reg();
+ const XmmRegister result = locs()->out().fpu_reg();
+
+ if (value_cid != kFloat32x4Cid) {
+ Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptCheckClass);
+ __ CompareClassId(value, kFloat32x4Cid);
+ __ j(NOT_EQUAL, deopt);
+ }
+ __ movups(result, FieldAddress(value, Float32x4::value_offset()));
+}
+
+
LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;
@@ -2943,6 +3044,24 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* CheckNonSmiInstr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresRegister());
+ return summary;
+}
+
+
+void CheckNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ Register value = locs()->in(0).reg();
+ Label* deopt = compiler->AddDeoptStub(deopt_id(),
+ kDeoptCheckNonSmi);
+ __ testq(value, Immediate(kSmiTagMask));
+ __ j(ZERO, deopt);
+}
+
LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;

Powered by Google App Engine
This is Rietveld 408576698