diff options
author | Thomas Lively <tlively@google.com> | 2021-04-19 12:43:58 -0700 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2021-04-19 12:43:59 -0700 |
commit | e657c84fa10e36ccf9b36bfeba26219ffbb39773 (patch) | |
tree | 47464dcb289c3540925ef27663cfc36c0dfdb390 /llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp | |
parent | 6c5b0d6beaaa634efce700e0c9cbd098e1c2e8a3 (diff) | |
download | llvm-e657c84fa10e36ccf9b36bfeba26219ffbb39773.zip llvm-e657c84fa10e36ccf9b36bfeba26219ffbb39773.tar.gz llvm-e657c84fa10e36ccf9b36bfeba26219ffbb39773.tar.bz2 |
[WebAssembly] Use v128.const instead of splats for constants
We previously used splats instead of v128.const to materialize vector constants
because V8 did not support v128.const. Now that V8 supports v128.const, we can
use v128.const instead. Although this increases code size, it should also
increase performance (or at least require fewer engine-side optimizations), so
it is an appropriate change to make.
Differential Revision: https://reviews.llvm.org/D100716
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index d474b9a..8c47fcb 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -121,14 +121,9 @@ static void convertImplicitDefToConstZero(MachineInstr *MI, Type::getDoubleTy(MF.getFunction().getContext()))); MI->addOperand(MachineOperand::CreateFPImm(Val)); } else if (RegClass == &WebAssembly::V128RegClass) { - // TODO: Replace this with v128.const 0 once that is supported in V8 - Register TempReg = MRI.createVirtualRegister(&WebAssembly::I32RegClass); - MI->setDesc(TII->get(WebAssembly::SPLAT_I32x4)); - MI->addOperand(MachineOperand::CreateReg(TempReg, false)); - MachineInstr *Const = BuildMI(*MI->getParent(), MI, MI->getDebugLoc(), - TII->get(WebAssembly::CONST_I32), TempReg) - .addImm(0); - LIS.InsertMachineInstrInMaps(*Const); + MI->setDesc(TII->get(WebAssembly::CONST_V128_I64x2)); + MI->addOperand(MachineOperand::CreateImm(0)); + MI->addOperand(MachineOperand::CreateImm(0)); } else { llvm_unreachable("Unexpected reg class"); } |