[llvm] r254861 - [WebAssembly] Support inline asm constraints of type i16 and similar.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 5 12:03:44 PST 2015
Author: djg
Date: Sat Dec 5 14:03:44 2015
New Revision: 254861
URL: http://llvm.org/viewvc/llvm-project?rev=254861&view=rev
Log:
[WebAssembly] Support inline asm constraints of type i16 and similar.
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/trunk/test/CodeGen/WebAssembly/inline-asm.ll
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=254861&r1=254860&r2=254861&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp Sat Dec 5 14:03:44 2015
@@ -228,10 +228,13 @@ WebAssemblyTargetLowering::getRegForInli
if (Constraint.size() == 1) {
switch (Constraint[0]) {
case 'r':
- if (VT == MVT::i32)
- return std::make_pair(0U, &WebAssembly::I32RegClass);
- if (VT == MVT::i64)
- return std::make_pair(0U, &WebAssembly::I64RegClass);
+ assert(VT != MVT::iPTR && "Pointer MVT not expected here");
+ if (VT.isInteger() && !VT.isVector()) {
+ if (VT.getSizeInBits() <= 32)
+ return std::make_pair(0U, &WebAssembly::I32RegClass);
+ if (VT.getSizeInBits() <= 64)
+ return std::make_pair(0U, &WebAssembly::I64RegClass);
+ }
break;
default:
break;
Modified: llvm/trunk/test/CodeGen/WebAssembly/inline-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/inline-asm.ll?rev=254861&r1=254860&r2=254861&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/inline-asm.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/inline-asm.ll Sat Dec 5 14:03:44 2015
@@ -56,6 +56,22 @@ entry:
ret i64 %0
}
+; CHECK-LABEL: X_i16:
+; CHECK: foo $1{{$}}
+; CHECK: i32.store16 $discard=, 0($0), $1{{$}}
+define void @X_i16(i16 * %t) {
+ call void asm sideeffect "foo $0", "=*X,~{dirflag},~{fpsr},~{flags},~{memory}"(i16* %t)
+ ret void
+}
+
+; CHECK-LABEL: X_ptr:
+; CHECK: foo $1{{$}}
+; CHECK: i32.store $discard=, 0($0), $1
+define void @X_ptr(i16 ** %t) {
+ call void asm sideeffect "foo $0", "=*X,~{dirflag},~{fpsr},~{flags},~{memory}"(i16** %t)
+ ret void
+}
+
attributes #0 = { nounwind }
!0 = !{i32 47}
More information about the llvm-commits
mailing list