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

Unified Diff: runtime/vm/intrinsifier.cc

Issue 2249853002: Add flow-graph generated SIMD array intrinsics. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/method_recognizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier.cc
diff --git a/runtime/vm/intrinsifier.cc b/runtime/vm/intrinsifier.cc
index 93478fc3d866fe8569d7397034f129e31ff5d4ed..02c469dbfa1359be0b886a588d7e0f4f8c03073d 100644
--- a/runtime/vm/intrinsifier.cc
+++ b/runtime/vm/intrinsifier.cc
@@ -265,6 +265,10 @@ static intptr_t CidForRepresentation(Representation rep) {
return kDoubleCid;
case kUnboxedFloat32x4:
return kFloat32x4Cid;
+ case kUnboxedInt32x4:
+ return kInt32x4Cid;
+ case kUnboxedFloat64x2:
+ return kFloat64x2Cid;
case kUnboxedUint32:
return kDynamicCid; // smi or mint.
default:
@@ -435,6 +439,18 @@ static bool IntrinsifyArrayGetIndexed(FlowGraph* flow_graph,
result = builder.AddDefinition(
BoxInstr::Create(kUnboxedDouble, new Value(result)));
break;
+ case kTypedDataFloat32x4ArrayCid:
+ result = builder.AddDefinition(
+ BoxInstr::Create(kUnboxedFloat32x4, new Value(result)));
+ break;
+ case kTypedDataInt32x4ArrayCid:
+ result = builder.AddDefinition(
+ BoxInstr::Create(kUnboxedInt32x4, new Value(result)));
+ break;
+ case kTypedDataFloat64x2ArrayCid:
+ result = builder.AddDefinition(
+ BoxInstr::Create(kUnboxedFloat64x2, new Value(result)));
+ break;
case kArrayCid:
case kImmutableArrayCid:
case kTypedDataInt8ArrayCid:
@@ -499,7 +515,29 @@ static bool IntrinsifyArraySetIndexed(FlowGraph* flow_graph,
/* is_checked = */ false);
break;
case kTypedDataFloat32ArrayCid:
- case kTypedDataFloat64ArrayCid: {
+ case kTypedDataFloat64ArrayCid:
+ case kTypedDataFloat32x4ArrayCid:
+ case kTypedDataInt32x4ArrayCid:
+ case kTypedDataFloat64x2ArrayCid: {
+ intptr_t value_check_cid = kDoubleCid;
+ Representation rep = kUnboxedDouble;
+ switch (array_cid) {
+ case kTypedDataFloat32x4ArrayCid:
+ value_check_cid = kFloat32x4Cid;
+ rep = kUnboxedFloat32x4;
+ break;
+ case kTypedDataInt32x4ArrayCid:
+ value_check_cid = kInt32x4Cid;
+ rep = kUnboxedInt32x4;
+ break;
+ case kTypedDataFloat64x2ArrayCid:
+ value_check_cid = kFloat64x2Cid;
+ rep = kUnboxedFloat64x2;
+ break;
+ default:
+ // Float32/Float64 case already handled.
+ break;
+ }
const ICData& value_check = ICData::ZoneHandle(ICData::New(
flow_graph->function(),
Symbols::Empty(), // Dummy function name.
@@ -507,13 +545,13 @@ static bool IntrinsifyArraySetIndexed(FlowGraph* flow_graph,
Thread::kNoDeoptId,
1,
false));
- value_check.AddReceiverCheck(kDoubleCid, flow_graph->function());
+ value_check.AddReceiverCheck(value_check_cid, flow_graph->function());
builder.AddInstruction(
new CheckClassInstr(new Value(value),
Thread::kNoDeoptId,
value_check,
builder.TokenPos()));
- value = builder.AddUnboxInstr(kUnboxedDouble,
+ value = builder.AddUnboxInstr(rep,
new Value(value),
/* is_checked = */ true);
if (array_cid == kTypedDataFloat32ArrayCid) {
@@ -624,6 +662,42 @@ DEFINE_FLOAT_ARRAY_GETTER_SETTER_INTRINSICS(Float32Array)
#undef DEFINE_FLOAT_ARRAY_SETTER_INTRINSIC
+#define DEFINE_SIMD_ARRAY_GETTER_INTRINSIC(enum_name) \
+bool Intrinsifier::Build_##enum_name##GetIndexed(FlowGraph* flow_graph) { \
+ if (!FlowGraphCompiler::SupportsUnboxedSimd128()) { \
+ return false; \
+ } \
+ return IntrinsifyArrayGetIndexed( \
+ flow_graph, \
+ MethodRecognizer::MethodKindToReceiverCid( \
+ MethodRecognizer::k##enum_name##GetIndexed)); \
+}
+
+
+#define DEFINE_SIMD_ARRAY_SETTER_INTRINSIC(enum_name) \
+bool Intrinsifier::Build_##enum_name##SetIndexed(FlowGraph* flow_graph) { \
+ if (!FlowGraphCompiler::SupportsUnboxedSimd128()) { \
+ return false; \
+ } \
+ return IntrinsifyArraySetIndexed( \
+ flow_graph, \
+ MethodRecognizer::MethodKindToReceiverCid( \
+ MethodRecognizer::k##enum_name##SetIndexed)); \
+}
+
+#define DEFINE_SIMD_ARRAY_GETTER_SETTER_INTRINSICS(enum_name) \
+DEFINE_SIMD_ARRAY_GETTER_INTRINSIC(enum_name) \
+DEFINE_SIMD_ARRAY_SETTER_INTRINSIC(enum_name)
+
+DEFINE_SIMD_ARRAY_GETTER_SETTER_INTRINSICS(Float32x4Array)
+DEFINE_SIMD_ARRAY_GETTER_SETTER_INTRINSICS(Int32x4Array)
+DEFINE_SIMD_ARRAY_GETTER_SETTER_INTRINSICS(Float64x2Array)
+
+#undef DEFINE_SIMD_ARRAY_GETTER_SETTER_INTRINSICS
+#undef DEFINE_SIMD_ARRAY_GETTER_INTRINSIC
+#undef DEFINE_SIMD_ARRAY_SETTER_INTRINSIC
+
+
static bool BuildCodeUnitAt(FlowGraph* flow_graph, intptr_t cid) {
GraphEntryInstr* graph_entry = flow_graph->graph_entry();
TargetEntryInstr* normal_entry = graph_entry->normal_entry();
« no previous file with comments | « no previous file | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698