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

Side by Side Diff: src/compiler/simd-lowering.cc

Issue 2235013002: Revert runtime lowering of wasm SIMD ops (Closed) Base URL: https://chromium.googlesource.com/v8/v8.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 unified diff | Download patch
« no previous file with comments | « src/compiler/simd-lowering.h ('k') | src/compiler/wasm-compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 namespace v8 {
8 namespace internal {
9 namespace compiler {
10
11 SimdLowering::~SimdLowering() {}
12
13 void SimdLowering::InitializeSignatures() {
14 // Initialize signatures for runtime calls
15 const int kReturnCount = 1;
16 const int kBinop = 2;
17 const int kSimd32x4 = 4;
18 const int kSimd16x8 = 8;
19 const int kSimd8x16 = 16;
20
21 ConversionSignature::Builder CreateInt32x4Builder(zone_, kReturnCount,
22 kSimd32x4);
23 ConversionSignature::Builder CreateFloat32x4Builder(zone_, kReturnCount,
24 kSimd32x4);
25 ConversionSignature::Builder CreateInt16x8Builder(zone_, kReturnCount,
26 kSimd16x8);
27 ConversionSignature::Builder CreateInt8x16Builder(zone_, kReturnCount,
28 kSimd8x16);
29 ConversionSignature::Builder ExtractLaneIntBuilder(zone_, kReturnCount,
30 kBinop);
31 ConversionSignature::Builder ExtractLaneFloatBuilder(zone_, kReturnCount,
32 kBinop);
33 ConversionSignature::Builder DefaultBuilder(zone_, kReturnCount, kSimd8x16);
34
35 // Initialize Signatures for create functions
36 for (int i = 0; i < kSimd32x4; i++) {
37 CreateInt32x4Builder.AddParam(Conversion::kInt32);
38 CreateFloat32x4Builder.AddParam(Conversion::kFloat32);
39 }
40 CreateInt32x4Builder.AddReturn(Conversion::kOpaque);
41 SigCreateInt32x4 = CreateInt32x4Builder.Build();
42
43 CreateFloat32x4Builder.AddReturn(Conversion::kOpaque);
44 SigCreateFloat32x4 = CreateFloat32x4Builder.Build();
45
46 for (int i = 0; i < kSimd16x8; i++) {
47 CreateInt16x8Builder.AddParam(Conversion::kInt32);
48 }
49 CreateInt16x8Builder.AddReturn(Conversion::kOpaque);
50 SigCreateInt16x8 = CreateInt16x8Builder.Build();
51
52 for (int i = 0; i < kSimd8x16; i++) {
53 CreateInt8x16Builder.AddParam(Conversion::kInt32);
54 }
55 CreateInt8x16Builder.AddReturn(Conversion::kOpaque);
56 SigCreateInt8x16 = CreateInt8x16Builder.Build();
57
58 // Initialize signatures for ExtractLane functions
59 ExtractLaneIntBuilder.AddParam(Conversion::kOpaque);
60 ExtractLaneIntBuilder.AddParam(Conversion::kInt32);
61 ExtractLaneIntBuilder.AddReturn(Conversion::kInt32);
62 SigExtractLaneInt = ExtractLaneIntBuilder.Build();
63 }
64
65 Reduction SimdLowering::Reduce(Node* node) {
66 // For now lower everything to runtime calls.
67 switch (node->opcode()) {
68 case IrOpcode::kCreateInt32x4: {
69 return Replace(builder_->ChangeToRuntimeCall(
70 node, Runtime::kCreateInt32x4, SigCreateInt32x4));
71 }
72 case IrOpcode::kCreateInt16x8: {
73 return Replace(builder_->ChangeToRuntimeCall(
74 node, Runtime::kCreateInt16x8, SigCreateInt16x8));
75 }
76 case IrOpcode::kCreateInt8x16: {
77 return Replace(builder_->ChangeToRuntimeCall(
78 node, Runtime::kCreateInt8x16, SigCreateInt8x16));
79 }
80 case IrOpcode::kCreateFloat32x4: {
81 return Replace(builder_->ChangeToRuntimeCall(
82 node, Runtime::kCreateFloat32x4, SigCreateFloat32x4));
83 }
84 case IrOpcode::kInt8x16ExtractLane:
85 case IrOpcode::kInt16x8ExtractLane:
86 case IrOpcode::kInt32x4ExtractLane: {
87 return Replace(builder_->ChangeToRuntimeCall(
88 node, Runtime::kInt32x4ExtractLane, SigExtractLaneInt));
89 }
90 case IrOpcode::kFloat32x4ExtractLane: {
91 return Replace(builder_->ChangeToRuntimeCall(
92 node, Runtime::kFloat32x4ExtractLane, SigExtractLaneFloat));
93 }
94 default: { break; }
95 }
96
97 // TODO(gdeepti): Implement and test.
98 // Assume the others are all just simd in and out.
99 switch (node->opcode()) {
100 #define F(Opcode) \
101 case IrOpcode::k##Opcode: { \
102 return Replace( \
103 builder_->ChangeToRuntimeCall(node, Runtime::k##Opcode, SigDefault)); \
104 }
105 MACHINE_SIMD_RETURN_SIMD_OP_LIST(F)
106 MACHINE_SIMD_RETURN_BOOL_OP_LIST(F)
107 #undef F
108 default: { return NoChange(); }
109 }
110 UNREACHABLE();
111 return NoChange();
112 }
113
114 } // namespace compiler
115 } // namespace internal
116 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simd-lowering.h ('k') | src/compiler/wasm-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698