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

Unified Diff: src/compiler/simd-lowering.cc

Issue 1991143002: Convert SIMD wasm ops to runtime function calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 4 years, 5 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: src/compiler/simd-lowering.cc
diff --git a/src/compiler/simd-lowering.cc b/src/compiler/simd-lowering.cc
new file mode 100644
index 0000000000000000000000000000000000000000..13fcd82d93303d4c3658a7dd560ac87b9f4c299b
--- /dev/null
+++ b/src/compiler/simd-lowering.cc
@@ -0,0 +1,102 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/compiler/simd-lowering.h"
+
+#include "src/assembler.h"
+#include "src/compiler/js-graph.h"
+#include "src/compiler/linkage.h"
+#include "src/compiler/machine-operator.h"
+#include "src/compiler/operator-properties.h"
+#include "src/compiler/simplified-operator.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+SimdLowering::~SimdLowering() {}
+
+Reduction SimdLowering::Reduce(Node* node) {
+ // For now lower everything to runtime calls.
+ switch (node->opcode()) {
+ case IrOpcode::kCreateInt32x4: {
+ static const Conversion signature[] = {
+ Conversion::kOpaque, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32};
+ return Replace(builder_->ChangeToRuntimeCall(
+ node, Runtime::kCreateInt32x4, signature));
+ }
+ case IrOpcode::kCreateInt16x8: {
+ static const Conversion signature[] = {
+ Conversion::kOpaque, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
+ };
+ return Replace(builder_->ChangeToRuntimeCall(
+ node, Runtime::kCreateInt16x8, signature));
+ }
+ case IrOpcode::kCreateInt8x16: {
+ static const Conversion signature[] = {
+ Conversion::kOpaque, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
+ Conversion::kInt32, Conversion::kInt32,
+ };
+ return Replace(builder_->ChangeToRuntimeCall(
+ node, Runtime::kCreateInt8x16, signature));
+ }
+ case IrOpcode::kCreateFloat32x4: {
+ static const Conversion signature[] = {
+ Conversion::kOpaque, Conversion::kFloat32, Conversion::kFloat32,
+ Conversion::kFloat32, Conversion::kFloat32};
+ return Replace(builder_->ChangeToRuntimeCall(
+ node, Runtime::kCreateFloat32x4, signature));
+ }
+ case IrOpcode::kInt8x16ExtractLane:
+ case IrOpcode::kInt16x8ExtractLane:
+ case IrOpcode::kInt32x4ExtractLane: {
+ static const Conversion signature[] = {
+ Conversion::kInt32, Conversion::kOpaque, Conversion::kInt32};
+ return Replace(builder_->ChangeToRuntimeCall(
+ node, Runtime::kInt32x4ExtractLane, signature));
+ }
+ case IrOpcode::kFloat32x4ExtractLane: {
+ static const Conversion signature[] = {
+ Conversion::kFloat32, Conversion::kOpaque, Conversion::kInt32};
+ return Replace(builder_->ChangeToRuntimeCall(
+ node, Runtime::kFloat32x4ExtractLane, signature));
+ }
+ default: { break; }
+ }
+
+ // TODO(gdeepti): Implement and test.
+ // Assume the others are all just simd in and out.
+ Conversion signature[17] = {
+ Conversion::kNone, Conversion::kNone, Conversion::kNone,
+ Conversion::kNone, Conversion::kNone, Conversion::kNone,
+ Conversion::kNone, Conversion::kNone, Conversion::kNone,
+ Conversion::kNone, Conversion::kNone, Conversion::kNone,
+ Conversion::kNone, Conversion::kNone, Conversion::kNone,
+ Conversion::kNone, Conversion::kNone,
+ };
+ switch (node->opcode()) {
+#define F(Opcode) \
+ case IrOpcode::k##Opcode: { \
+ return Replace( \
+ builder_->ChangeToRuntimeCall(node, Runtime::k##Opcode, signature)); \
+ }
+ MACHINE_SIMD_RETURN_SIMD_OP_LIST(F)
+ MACHINE_SIMD_RETURN_BOOL_OP_LIST(F)
+#undef F
+ default: { return NoChange(); }
+ }
+ UNREACHABLE();
+ return NoChange();
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698