[PATCH] D52108: [WebAssembly] Handle V128RegClass in more places
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 14 11:11:35 PDT 2018
tlively created this revision.
tlively added reviewers: aheejin, dschuff.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, sbc100.
Adds logic to handle V128RegClass wherever possible. It is still not
handled in `selectSelect` in WebAssemblyFastISel, but there is no v128
select, so that would be more complicated anyway.
Repository:
rL LLVM
https://reviews.llvm.org/D52108
Files:
lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
lib/Target/WebAssembly/WebAssemblyFastISel.cpp
lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
Index: lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -117,6 +117,10 @@
ConstantFP *Val = cast<ConstantFP>(Constant::getNullValue(
Type::getDoubleTy(MF.getFunction().getContext())));
MI->addOperand(MachineOperand::CreateFPImm(Val));
+ } else if (RegClass == &WebAssembly::V128RegClass) {
+ MI->setDesc(TII->get(WebAssembly::CONST_V128_v2i64));
+ MI->addOperand(MachineOperand::CreateImm(0));
+ MI->addOperand(MachineOperand::CreateImm(0));
} else {
llvm_unreachable("Unexpected reg class");
}
Index: lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
+++ lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
@@ -70,6 +70,8 @@
CopyOpcode = WebAssembly::COPY_F32;
else if (RC == &WebAssembly::F64RegClass)
CopyOpcode = WebAssembly::COPY_F64;
+ else if (RC == &WebAssembly::V128RegClass)
+ CopyOpcode = WebAssembly::COPY_V128;
else
llvm_unreachable("Unexpected register class");
Index: lib/Target/WebAssembly/WebAssemblyFastISel.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -1173,6 +1173,30 @@
Opc = WebAssembly::LOAD_F64;
RC = &WebAssembly::F64RegClass;
break;
+ case MVT::v16i8:
+ Opc = WebAssembly::LOAD_v16i8;
+ RC = &WebAssembly::V128RegClass;
+ break;
+ case MVT::v8i16:
+ Opc = WebAssembly::LOAD_v8i16;
+ RC = &WebAssembly::V128RegClass;
+ break;
+ case MVT::v4i32:
+ Opc = WebAssembly::LOAD_v4i32;
+ RC = &WebAssembly::V128RegClass;
+ break;
+ case MVT::v2i64:
+ Opc = WebAssembly::LOAD_v2i64;
+ RC = &WebAssembly::V128RegClass;
+ break;
+ case MVT::v4f32:
+ Opc = WebAssembly::LOAD_v4f32;
+ RC = &WebAssembly::V128RegClass;
+ break;
+ case MVT::v2f64:
+ Opc = WebAssembly::LOAD_v2f64;
+ RC = &WebAssembly::V128RegClass;
+ break;
default:
return false;
}
Index: lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
+++ lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
@@ -157,6 +157,8 @@
return MVT::f32;
if (RC == &WebAssembly::F64RegClass)
return MVT::f64;
+ if (RC == &WebAssembly::V128RegClass)
+ return MVT::v16i8;
if (RC == &WebAssembly::EXCEPT_REFRegClass)
return MVT::ExceptRef;
llvm_unreachable("unrecognized register class");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52108.165542.patch
Type: text/x-patch
Size: 2777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180914/fdabfa58/attachment.bin>
More information about the llvm-commits
mailing list