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

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

Issue 1755013003: [wasm] add rotate opcodes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: no renumbering Created 4 years, 9 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/wasm-macro-gen.h » ('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 "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 10
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 break; 442 break;
443 case wasm::kExprI32Shl: 443 case wasm::kExprI32Shl:
444 op = m->Word32Shl(); 444 op = m->Word32Shl();
445 break; 445 break;
446 case wasm::kExprI32ShrU: 446 case wasm::kExprI32ShrU:
447 op = m->Word32Shr(); 447 op = m->Word32Shr();
448 break; 448 break;
449 case wasm::kExprI32ShrS: 449 case wasm::kExprI32ShrS:
450 op = m->Word32Sar(); 450 op = m->Word32Sar();
451 break; 451 break;
452 case wasm::kExprI32Ror:
453 op = m->Word32Ror();
454 break;
455 case wasm::kExprI32Rol:
456 return BuildI32Rol(left, right);
452 case wasm::kExprI32Eq: 457 case wasm::kExprI32Eq:
453 op = m->Word32Equal(); 458 op = m->Word32Equal();
454 break; 459 break;
455 case wasm::kExprI32Ne: 460 case wasm::kExprI32Ne:
456 return Invert(Binop(wasm::kExprI32Eq, left, right)); 461 return Invert(Binop(wasm::kExprI32Eq, left, right));
457 case wasm::kExprI32LtS: 462 case wasm::kExprI32LtS:
458 op = m->Int32LessThan(); 463 op = m->Int32LessThan();
459 break; 464 break;
460 case wasm::kExprI32LeS: 465 case wasm::kExprI32LeS:
461 op = m->Int32LessThanOrEqual(); 466 op = m->Int32LessThanOrEqual();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 trap_->ZeroCheck64(kTrapRemByZero, right)); 619 trap_->ZeroCheck64(kTrapRemByZero, right));
615 case wasm::kExprI64Shl: 620 case wasm::kExprI64Shl:
616 op = m->Word64Shl(); 621 op = m->Word64Shl();
617 break; 622 break;
618 case wasm::kExprI64ShrU: 623 case wasm::kExprI64ShrU:
619 op = m->Word64Shr(); 624 op = m->Word64Shr();
620 break; 625 break;
621 case wasm::kExprI64ShrS: 626 case wasm::kExprI64ShrS:
622 op = m->Word64Sar(); 627 op = m->Word64Sar();
623 break; 628 break;
629 case wasm::kExprI64Ror:
630 op = m->Word64Ror();
631 break;
632 case wasm::kExprI64Rol:
633 return BuildI64Rol(left, right);
624 #endif 634 #endif
625 635
626 case wasm::kExprF32CopySign: 636 case wasm::kExprF32CopySign:
627 return BuildF32CopySign(left, right); 637 return BuildF32CopySign(left, right);
628 case wasm::kExprF64CopySign: 638 case wasm::kExprF64CopySign:
629 return BuildF64CopySign(left, right); 639 return BuildF64CopySign(left, right);
630 case wasm::kExprF32Add: 640 case wasm::kExprF32Add:
631 op = m->Float32Add(); 641 op = m->Float32Add();
632 break; 642 break;
633 case wasm::kExprF32Sub: 643 case wasm::kExprF32Sub:
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 case wasm::kAstStmt: 1697 case wasm::kAstStmt:
1688 num = jsgraph()->Int32Constant(0); 1698 num = jsgraph()->Int32Constant(0);
1689 break; 1699 break;
1690 default: 1700 default:
1691 UNREACHABLE(); 1701 UNREACHABLE();
1692 return nullptr; 1702 return nullptr;
1693 } 1703 }
1694 return num; 1704 return num;
1695 } 1705 }
1696 1706
1707 Node* WasmGraphBuilder::BuildI32Rol(Node* left, Node* right) {
1708 // Implement Rol by Ror since TurboFan does not have Rol opcode.
1709 // TODO(weiliang): support Word32Rol opcode in TurboFan.
1710 Int32Matcher m(right);
1711 if (m.HasValue()) {
1712 return Binop(wasm::kExprI32Ror, left,
1713 jsgraph()->Int32Constant(32 - m.Value()));
1714 } else {
1715 return Binop(wasm::kExprI32Ror, left,
1716 Binop(wasm::kExprI32Sub, jsgraph()->Int32Constant(32), right));
1717 }
1718 }
1719
1720 Node* WasmGraphBuilder::BuildI64Rol(Node* left, Node* right) {
1721 // Implement Rol by Ror since TurboFan does not have Rol opcode.
1722 // TODO(weiliang): support Word64Rol opcode in TurboFan.
1723 Int64Matcher m(right);
1724 if (m.HasValue()) {
1725 return Binop(wasm::kExprI64Ror, left,
1726 jsgraph()->Int64Constant(64 - m.Value()));
1727 } else {
1728 return Binop(wasm::kExprI64Ror, left,
1729 Binop(wasm::kExprI64Sub, jsgraph()->Int64Constant(64), right));
1730 }
1731 }
1697 1732
1698 Node* WasmGraphBuilder::Invert(Node* node) { 1733 Node* WasmGraphBuilder::Invert(Node* node) {
1699 return Unop(wasm::kExprI32Eqz, node); 1734 return Unop(wasm::kExprI32Eqz, node);
1700 } 1735 }
1701 1736
1702 1737
1703 void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, 1738 void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
1704 wasm::FunctionSig* sig) { 1739 wasm::FunctionSig* sig) {
1705 int params = static_cast<int>(sig->parameter_count()); 1740 int params = static_cast<int>(sig->parameter_count());
1706 int count = params + 3; 1741 int count = params + 3;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 module_env->module->GetName(function.name_offset)); 2298 module_env->module->GetName(function.name_offset));
2264 } 2299 }
2265 2300
2266 return code; 2301 return code;
2267 } 2302 }
2268 2303
2269 2304
2270 } // namespace compiler 2305 } // namespace compiler
2271 } // namespace internal 2306 } // namespace internal
2272 } // namespace v8 2307 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698