OLD | NEW |
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 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3228 has_simd_ = true; | 3228 has_simd_ = true; |
3229 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), | 3229 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), |
3230 Int32Constant(value), Int32Constant(value), | 3230 Int32Constant(value), Int32Constant(value), |
3231 Int32Constant(value), Int32Constant(value)); | 3231 Int32Constant(value), Int32Constant(value)); |
3232 } | 3232 } |
3233 | 3233 |
3234 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, | 3234 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
3235 const NodeVector& inputs) { | 3235 const NodeVector& inputs) { |
3236 has_simd_ = true; | 3236 has_simd_ = true; |
3237 switch (opcode) { | 3237 switch (opcode) { |
| 3238 case wasm::kExprF32x4Splat: |
| 3239 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), |
| 3240 inputs[0], inputs[0], inputs[0], inputs[0]); |
| 3241 case wasm::kExprF32x4FromInt32x4: |
| 3242 return graph()->NewNode(jsgraph()->machine()->Float32x4FromInt32x4(), |
| 3243 inputs[0]); |
| 3244 case wasm::kExprF32x4FromUint32x4: |
| 3245 return graph()->NewNode(jsgraph()->machine()->Float32x4FromUint32x4(), |
| 3246 inputs[0]); |
| 3247 case wasm::kExprF32x4Add: |
| 3248 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], |
| 3249 inputs[1]); |
| 3250 case wasm::kExprF32x4Sub: |
| 3251 return graph()->NewNode(jsgraph()->machine()->Float32x4Sub(), inputs[0], |
| 3252 inputs[1]); |
3238 case wasm::kExprI32x4Splat: | 3253 case wasm::kExprI32x4Splat: |
3239 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], | 3254 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], |
3240 inputs[0], inputs[0], inputs[0]); | 3255 inputs[0], inputs[0], inputs[0]); |
| 3256 case wasm::kExprI32x4FromFloat32x4: |
| 3257 return graph()->NewNode(jsgraph()->machine()->Int32x4FromFloat32x4(), |
| 3258 inputs[0]); |
| 3259 case wasm::kExprUi32x4FromFloat32x4: |
| 3260 return graph()->NewNode(jsgraph()->machine()->Uint32x4FromFloat32x4(), |
| 3261 inputs[0]); |
3241 case wasm::kExprI32x4Add: | 3262 case wasm::kExprI32x4Add: |
3242 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], | 3263 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], |
3243 inputs[1]); | 3264 inputs[1]); |
3244 case wasm::kExprI32x4Sub: | 3265 case wasm::kExprI32x4Sub: |
3245 return graph()->NewNode(jsgraph()->machine()->Int32x4Sub(), inputs[0], | 3266 return graph()->NewNode(jsgraph()->machine()->Int32x4Sub(), inputs[0], |
3246 inputs[1]); | 3267 inputs[1]); |
3247 case wasm::kExprF32x4Splat: | 3268 case wasm::kExprI32x4Eq: |
3248 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), | 3269 return graph()->NewNode(jsgraph()->machine()->Int32x4Equal(), inputs[0], |
3249 inputs[0], inputs[0], inputs[0], inputs[0]); | |
3250 case wasm::kExprF32x4Add: | |
3251 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], | |
3252 inputs[1]); | 3270 inputs[1]); |
| 3271 case wasm::kExprI32x4Ne: |
| 3272 return graph()->NewNode(jsgraph()->machine()->Int32x4NotEqual(), |
| 3273 inputs[0], inputs[1]); |
| 3274 case wasm::kExprS32x4Select: |
| 3275 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0], |
| 3276 inputs[1], inputs[2]); |
3253 default: | 3277 default: |
3254 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3278 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3255 } | 3279 } |
3256 } | 3280 } |
3257 | 3281 |
3258 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, | 3282 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, |
3259 const NodeVector& inputs) { | 3283 const NodeVector& inputs) { |
3260 has_simd_ = true; | 3284 has_simd_ = true; |
3261 switch (opcode) { | 3285 switch (opcode) { |
3262 case wasm::kExprI32x4ExtractLane: | 3286 case wasm::kExprI32x4ExtractLane: |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3659 Smi::FromInt(instruction.instr_offset)); | 3683 Smi::FromInt(instruction.instr_offset)); |
3660 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, | 3684 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, |
3661 Smi::FromInt(instruction.landing_offset)); | 3685 Smi::FromInt(instruction.landing_offset)); |
3662 } | 3686 } |
3663 return fn_protected; | 3687 return fn_protected; |
3664 } | 3688 } |
3665 | 3689 |
3666 } // namespace compiler | 3690 } // namespace compiler |
3667 } // namespace internal | 3691 } // namespace internal |
3668 } // namespace v8 | 3692 } // namespace v8 |
OLD | NEW |