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

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

Issue 2847663005: [WASM SIMD] Replace primitive shuffles with general Shuffle. (Closed)
Patch Set: Rebase. Created 3 years, 7 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/wasm-compiler.h ('k') | src/wasm/function-body-decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/assembler-inl.h" 9 #include "src/assembler-inl.h"
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 3460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3471 return graph()->NewNode(jsgraph()->machine()->S128And(), inputs[0], 3471 return graph()->NewNode(jsgraph()->machine()->S128And(), inputs[0],
3472 inputs[1]); 3472 inputs[1]);
3473 case wasm::kExprS128Or: 3473 case wasm::kExprS128Or:
3474 return graph()->NewNode(jsgraph()->machine()->S128Or(), inputs[0], 3474 return graph()->NewNode(jsgraph()->machine()->S128Or(), inputs[0],
3475 inputs[1]); 3475 inputs[1]);
3476 case wasm::kExprS128Xor: 3476 case wasm::kExprS128Xor:
3477 return graph()->NewNode(jsgraph()->machine()->S128Xor(), inputs[0], 3477 return graph()->NewNode(jsgraph()->machine()->S128Xor(), inputs[0],
3478 inputs[1]); 3478 inputs[1]);
3479 case wasm::kExprS128Not: 3479 case wasm::kExprS128Not:
3480 return graph()->NewNode(jsgraph()->machine()->S128Not(), inputs[0]); 3480 return graph()->NewNode(jsgraph()->machine()->S128Not(), inputs[0]);
3481 case wasm::kExprS32x4ZipLeft:
3482 return graph()->NewNode(jsgraph()->machine()->S32x4ZipLeft(), inputs[0],
3483 inputs[1]);
3484 case wasm::kExprS32x4ZipRight:
3485 return graph()->NewNode(jsgraph()->machine()->S32x4ZipRight(), inputs[0],
3486 inputs[1]);
3487 case wasm::kExprS32x4UnzipLeft:
3488 return graph()->NewNode(jsgraph()->machine()->S32x4UnzipLeft(), inputs[0],
3489 inputs[1]);
3490 case wasm::kExprS32x4UnzipRight:
3491 return graph()->NewNode(jsgraph()->machine()->S32x4UnzipRight(),
3492 inputs[0], inputs[1]);
3493 case wasm::kExprS32x4TransposeLeft:
3494 return graph()->NewNode(jsgraph()->machine()->S32x4TransposeLeft(),
3495 inputs[0], inputs[1]);
3496 case wasm::kExprS32x4TransposeRight:
3497 return graph()->NewNode(jsgraph()->machine()->S32x4TransposeRight(),
3498 inputs[0], inputs[1]);
3499 case wasm::kExprS32x4Select: 3481 case wasm::kExprS32x4Select:
3500 return graph()->NewNode(jsgraph()->machine()->S32x4Select(), inputs[0], 3482 return graph()->NewNode(jsgraph()->machine()->S32x4Select(), inputs[0],
3501 inputs[1], inputs[2]); 3483 inputs[1], inputs[2]);
3502 case wasm::kExprS16x8ZipLeft:
3503 return graph()->NewNode(jsgraph()->machine()->S16x8ZipLeft(), inputs[0],
3504 inputs[1]);
3505 case wasm::kExprS16x8ZipRight:
3506 return graph()->NewNode(jsgraph()->machine()->S16x8ZipRight(), inputs[0],
3507 inputs[1]);
3508 case wasm::kExprS16x8UnzipLeft:
3509 return graph()->NewNode(jsgraph()->machine()->S16x8UnzipLeft(), inputs[0],
3510 inputs[1]);
3511 case wasm::kExprS16x8UnzipRight:
3512 return graph()->NewNode(jsgraph()->machine()->S16x8UnzipRight(),
3513 inputs[0], inputs[1]);
3514 case wasm::kExprS16x8TransposeLeft:
3515 return graph()->NewNode(jsgraph()->machine()->S16x8TransposeLeft(),
3516 inputs[0], inputs[1]);
3517 case wasm::kExprS16x8TransposeRight:
3518 return graph()->NewNode(jsgraph()->machine()->S16x8TransposeRight(),
3519 inputs[0], inputs[1]);
3520 case wasm::kExprS16x8Select: 3484 case wasm::kExprS16x8Select:
3521 return graph()->NewNode(jsgraph()->machine()->S16x8Select(), inputs[0], 3485 return graph()->NewNode(jsgraph()->machine()->S16x8Select(), inputs[0],
3522 inputs[1], inputs[2]); 3486 inputs[1], inputs[2]);
3523 case wasm::kExprS8x16ZipLeft:
3524 return graph()->NewNode(jsgraph()->machine()->S8x16ZipLeft(), inputs[0],
3525 inputs[1]);
3526 case wasm::kExprS8x16ZipRight:
3527 return graph()->NewNode(jsgraph()->machine()->S8x16ZipRight(), inputs[0],
3528 inputs[1]);
3529 case wasm::kExprS8x16UnzipLeft:
3530 return graph()->NewNode(jsgraph()->machine()->S8x16UnzipLeft(), inputs[0],
3531 inputs[1]);
3532 case wasm::kExprS8x16UnzipRight:
3533 return graph()->NewNode(jsgraph()->machine()->S8x16UnzipRight(),
3534 inputs[0], inputs[1]);
3535 case wasm::kExprS8x16TransposeLeft:
3536 return graph()->NewNode(jsgraph()->machine()->S8x16TransposeLeft(),
3537 inputs[0], inputs[1]);
3538 case wasm::kExprS8x16TransposeRight:
3539 return graph()->NewNode(jsgraph()->machine()->S8x16TransposeRight(),
3540 inputs[0], inputs[1]);
3541 case wasm::kExprS8x16Select: 3487 case wasm::kExprS8x16Select:
3542 return graph()->NewNode(jsgraph()->machine()->S8x16Select(), inputs[0], 3488 return graph()->NewNode(jsgraph()->machine()->S8x16Select(), inputs[0],
3543 inputs[1], inputs[2]); 3489 inputs[1], inputs[2]);
3544 case wasm::kExprS32x2Reverse:
3545 return graph()->NewNode(jsgraph()->machine()->S32x2Reverse(), inputs[0]);
3546 case wasm::kExprS16x4Reverse:
3547 return graph()->NewNode(jsgraph()->machine()->S16x4Reverse(), inputs[0]);
3548 case wasm::kExprS16x2Reverse:
3549 return graph()->NewNode(jsgraph()->machine()->S16x2Reverse(), inputs[0]);
3550 case wasm::kExprS8x8Reverse:
3551 return graph()->NewNode(jsgraph()->machine()->S8x8Reverse(), inputs[0]);
3552 case wasm::kExprS8x4Reverse:
3553 return graph()->NewNode(jsgraph()->machine()->S8x4Reverse(), inputs[0]);
3554 case wasm::kExprS8x2Reverse:
3555 return graph()->NewNode(jsgraph()->machine()->S8x2Reverse(), inputs[0]);
3556 case wasm::kExprS1x4And: 3490 case wasm::kExprS1x4And:
3557 return graph()->NewNode(jsgraph()->machine()->S1x4And(), inputs[0], 3491 return graph()->NewNode(jsgraph()->machine()->S1x4And(), inputs[0],
3558 inputs[1]); 3492 inputs[1]);
3559 case wasm::kExprS1x4Or: 3493 case wasm::kExprS1x4Or:
3560 return graph()->NewNode(jsgraph()->machine()->S1x4Or(), inputs[0], 3494 return graph()->NewNode(jsgraph()->machine()->S1x4Or(), inputs[0],
3561 inputs[1]); 3495 inputs[1]);
3562 case wasm::kExprS1x4Xor: 3496 case wasm::kExprS1x4Xor:
3563 return graph()->NewNode(jsgraph()->machine()->S1x4Xor(), inputs[0], 3497 return graph()->NewNode(jsgraph()->machine()->S1x4Xor(), inputs[0],
3564 inputs[1]); 3498 inputs[1]);
3565 case wasm::kExprS1x4Not: 3499 case wasm::kExprS1x4Not:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 return graph()->NewNode(jsgraph()->machine()->I8x16ShrS(shift), 3596 return graph()->NewNode(jsgraph()->machine()->I8x16ShrS(shift),
3663 inputs[0]); 3597 inputs[0]);
3664 case wasm::kExprI8x16ShrU: 3598 case wasm::kExprI8x16ShrU:
3665 return graph()->NewNode(jsgraph()->machine()->I8x16ShrU(shift), 3599 return graph()->NewNode(jsgraph()->machine()->I8x16ShrU(shift),
3666 inputs[0]); 3600 inputs[0]);
3667 default: 3601 default:
3668 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); 3602 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr);
3669 } 3603 }
3670 } 3604 }
3671 3605
3672 Node* WasmGraphBuilder::SimdConcatOp(uint8_t bytes, const NodeVector& inputs) { 3606 Node* WasmGraphBuilder::SimdShuffleOp(uint8_t shuffle[16], unsigned lanes,
3607 const NodeVector& inputs) {
3673 has_simd_ = true; 3608 has_simd_ = true;
3674 return graph()->NewNode(jsgraph()->machine()->S8x16Concat(bytes), inputs[0], 3609 switch (lanes) {
3675 inputs[1]); 3610 case 4:
3611 return graph()->NewNode(jsgraph()->machine()->S32x4Shuffle(shuffle),
3612 inputs[0], inputs[1]);
3613 case 8:
3614 return graph()->NewNode(jsgraph()->machine()->S16x8Shuffle(shuffle),
3615 inputs[0], inputs[1]);
3616 case 16:
3617 return graph()->NewNode(jsgraph()->machine()->S8x16Shuffle(shuffle),
3618 inputs[0], inputs[1]);
3619 default:
3620 UNREACHABLE();
3621 return nullptr;
3622 }
3676 } 3623 }
3677 3624
3678 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, 3625 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
3679 Isolate* isolate, Handle<Code> code, 3626 Isolate* isolate, Handle<Code> code,
3680 const char* message, uint32_t index, 3627 const char* message, uint32_t index,
3681 const wasm::WasmName& module_name, 3628 const wasm::WasmName& module_name,
3682 const wasm::WasmName& func_name) { 3629 const wasm::WasmName& func_name) {
3683 DCHECK(isolate->logger()->is_logging_code_events() || 3630 DCHECK(isolate->logger()->is_logging_code_events() ||
3684 isolate->is_profiling()); 3631 isolate->is_profiling());
3685 3632
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
4142 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { 4089 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) {
4143 WasmCompilationUnit unit(isolate, module_env, function); 4090 WasmCompilationUnit unit(isolate, module_env, function);
4144 unit.InitializeHandles(); 4091 unit.InitializeHandles();
4145 unit.ExecuteCompilation(); 4092 unit.ExecuteCompilation();
4146 return unit.FinishCompilation(thrower); 4093 return unit.FinishCompilation(thrower);
4147 } 4094 }
4148 4095
4149 } // namespace compiler 4096 } // namespace compiler
4150 } // namespace internal 4097 } // namespace internal
4151 } // namespace v8 4098 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/wasm/function-body-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698