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

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2385393002: [wasm] Implement I32x4ReplaceLane, I32x4Add, I32x4Sub. (Closed)
Patch Set: Add lanes as compile time constants Created 4 years 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
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 10
(...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3117 3117
3118 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, 3118 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode,
3119 const NodeVector& inputs) { 3119 const NodeVector& inputs) {
3120 switch (opcode) { 3120 switch (opcode) {
3121 case wasm::kExprI32x4Splat: 3121 case wasm::kExprI32x4Splat:
3122 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], 3122 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0],
3123 inputs[0], inputs[0], inputs[0]); 3123 inputs[0], inputs[0], inputs[0]);
3124 case wasm::kExprI32x4Add: 3124 case wasm::kExprI32x4Add:
3125 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], 3125 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0],
3126 inputs[1]); 3126 inputs[1]);
3127 case wasm::kExprF32x4ExtractLane: 3127 case wasm::kExprI32x4Sub:
3128 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), 3128 return graph()->NewNode(jsgraph()->machine()->Int32x4Sub(), inputs[0],
3129 inputs[0], inputs[1]); 3129 inputs[1]);
3130 case wasm::kExprF32x4Splat: 3130 case wasm::kExprF32x4Splat:
3131 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), 3131 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(),
3132 inputs[0], inputs[0], inputs[0], inputs[0]); 3132 inputs[0], inputs[0], inputs[0], inputs[0]);
3133 case wasm::kExprF32x4Add: 3133 case wasm::kExprF32x4Add:
3134 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], 3134 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0],
3135 inputs[1]); 3135 inputs[1]);
3136 default: 3136 default:
3137 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); 3137 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr);
3138 } 3138 }
3139 } 3139 }
3140 3140
3141 Node* WasmGraphBuilder::SimdExtractLane(wasm::WasmOpcode opcode, uint8_t lane, 3141 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane,
3142 Node* input) { 3142 const NodeVector& inputs) {
3143 switch (opcode) { 3143 switch (opcode) {
3144 case wasm::kExprI32x4ExtractLane: 3144 case wasm::kExprI32x4ExtractLane:
3145 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), input, 3145 return graph()->NewNode(jsgraph()->common()->Int32x4ExtractLane(lane),
3146 Int32Constant(lane)); 3146 inputs[0]);
3147 case wasm::kExprI32x4ReplaceLane:
3148 return graph()->NewNode(jsgraph()->common()->Int32x4ReplaceLane(lane),
3149 inputs[0], inputs[1]);
3147 case wasm::kExprF32x4ExtractLane: 3150 case wasm::kExprF32x4ExtractLane:
3148 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), 3151 return graph()->NewNode(jsgraph()->common()->Float32x4ExtractLane(lane),
3149 input, Int32Constant(lane)); 3152 inputs[0]);
3150 default: 3153 default:
3151 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); 3154 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr);
3152 } 3155 }
3153 } 3156 }
3154 3157
3155 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, 3158 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
3156 Isolate* isolate, Handle<Code> code, 3159 Isolate* isolate, Handle<Code> code,
3157 const char* message, uint32_t index, 3160 const char* message, uint32_t index,
3158 const wasm::WasmName& module_name, 3161 const wasm::WasmName& module_name,
3159 const wasm::WasmName& func_name) { 3162 const wasm::WasmName& func_name) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3529 Smi::FromInt(instruction.instr_offset)); 3532 Smi::FromInt(instruction.instr_offset));
3530 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, 3533 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset,
3531 Smi::FromInt(instruction.landing_offset)); 3534 Smi::FromInt(instruction.landing_offset));
3532 } 3535 }
3533 return fn_protected; 3536 return fn_protected;
3534 } 3537 }
3535 3538
3536 } // namespace compiler 3539 } // namespace compiler
3537 } // namespace internal 3540 } // namespace internal
3538 } // namespace v8 3541 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698