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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/compiler/simd-lowering.h"
6
7 #include "src/assembler.h"
8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/linkage.h"
10 #include "src/compiler/machine-operator.h"
11 #include "src/compiler/operator-properties.h"
12 #include "src/compiler/simplified-operator.h"
13
14 namespace v8 {
15 namespace internal {
16 namespace compiler {
17
18 SimdLowering::~SimdLowering() {}
19
20 Reduction SimdLowering::Reduce(Node* node) {
21 // For now lower everything to runtime calls.
22 switch (node->opcode()) {
23 case IrOpcode::kCreateInt32x4: {
24 static const Conversion signature[] = {
25 Conversion::kOpaque, Conversion::kInt32, Conversion::kInt32,
26 Conversion::kInt32, Conversion::kInt32};
27 return Replace(builder_->ChangeToRuntimeCall(
28 node, Runtime::kCreateInt32x4, signature));
29 }
30 case IrOpcode::kCreateInt16x8: {
31 static const Conversion signature[] = {
32 Conversion::kOpaque, Conversion::kInt32, Conversion::kInt32,
33 Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
34 Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
35 };
36 return Replace(builder_->ChangeToRuntimeCall(
37 node, Runtime::kCreateInt16x8, signature));
38 }
39 case IrOpcode::kCreateInt8x16: {
40 static const Conversion signature[] = {
41 Conversion::kOpaque, Conversion::kInt32, Conversion::kInt32,
42 Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
43 Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
44 Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
45 Conversion::kInt32, Conversion::kInt32, Conversion::kInt32,
46 Conversion::kInt32, Conversion::kInt32,
47 };
48 return Replace(builder_->ChangeToRuntimeCall(
49 node, Runtime::kCreateInt8x16, signature));
50 }
51 case IrOpcode::kCreateFloat32x4: {
52 static const Conversion signature[] = {
53 Conversion::kOpaque, Conversion::kFloat32, Conversion::kFloat32,
54 Conversion::kFloat32, Conversion::kFloat32};
55 return Replace(builder_->ChangeToRuntimeCall(
56 node, Runtime::kCreateFloat32x4, signature));
57 }
58 case IrOpcode::kInt8x16ExtractLane:
59 case IrOpcode::kInt16x8ExtractLane:
60 case IrOpcode::kInt32x4ExtractLane: {
61 static const Conversion signature[] = {
62 Conversion::kInt32, Conversion::kOpaque, Conversion::kInt32};
63 return Replace(builder_->ChangeToRuntimeCall(
64 node, Runtime::kInt32x4ExtractLane, signature));
65 }
66 case IrOpcode::kFloat32x4ExtractLane: {
67 static const Conversion signature[] = {
68 Conversion::kFloat32, Conversion::kOpaque, Conversion::kInt32};
69 return Replace(builder_->ChangeToRuntimeCall(
70 node, Runtime::kFloat32x4ExtractLane, signature));
71 }
72 default: { break; }
73 }
74
75 // TODO(gdeepti): Implement and test.
76 // Assume the others are all just simd in and out.
77 Conversion signature[17] = {
78 Conversion::kNone, Conversion::kNone, Conversion::kNone,
79 Conversion::kNone, Conversion::kNone, Conversion::kNone,
80 Conversion::kNone, Conversion::kNone, Conversion::kNone,
81 Conversion::kNone, Conversion::kNone, Conversion::kNone,
82 Conversion::kNone, Conversion::kNone, Conversion::kNone,
83 Conversion::kNone, Conversion::kNone,
84 };
85 switch (node->opcode()) {
86 #define F(Opcode) \
87 case IrOpcode::k##Opcode: { \
88 return Replace( \
89 builder_->ChangeToRuntimeCall(node, Runtime::k##Opcode, signature)); \
90 }
91 MACHINE_SIMD_RETURN_SIMD_OP_LIST(F)
92 MACHINE_SIMD_RETURN_BOOL_OP_LIST(F)
93 #undef F
94 default: { return NoChange(); }
95 }
96 UNREACHABLE();
97 return NoChange();
98 }
99
100 } // namespace compiler
101 } // namespace internal
102 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698