[WebAssembly] Fix inline asm support for i64 operands.
authorDan Gohman <dan433584@gmail.com>
Wed, 25 Nov 2015 22:28:50 +0000 (22:28 +0000)
committerDan Gohman <dan433584@gmail.com>
Wed, 25 Nov 2015 22:28:50 +0000 (22:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254106 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
test/CodeGen/WebAssembly/inline-asm.ll

index 5a3e02133f5a4f7ed523f29eb0a83a0f70729d73..8bf25debe6b52c1287dbdf9920a4079c97c41f2d 100644 (file)
@@ -220,7 +220,11 @@ WebAssemblyTargetLowering::getRegForInlineAsmConstraint(
   if (Constraint.size() == 1) {
     switch (Constraint[0]) {
     case 'r':
   if (Constraint.size() == 1) {
     switch (Constraint[0]) {
     case 'r':
-      return std::make_pair(0U, &WebAssembly::I32RegClass);
+      if (VT == MVT::i32)
+        return std::make_pair(0U, &WebAssembly::I32RegClass);
+      if (VT == MVT::i64)
+        return std::make_pair(0U, &WebAssembly::I64RegClass);
+      break;
     default:
       break;
     }
     default:
       break;
     }
index 8afb16290c9ecbf170baebd4b448d472d45ee028..e9d2ebf51f6378c21169a7746e0c06c61aa484a9 100644 (file)
@@ -43,6 +43,19 @@ entry:
   ret i32 %0
 }
 
   ret i32 %0
 }
 
+; CHECK-LABEL: foo_i64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: #APP{{$}}
+; CHECK-NEXT: # $0 = aaa($0){{$}}
+; CHECK-NEXT: #NO_APP{{$}}
+; CHECK-NEXT: return $0{{$}}
+define i64 @foo_i64(i64 %r) {
+entry:
+  %0 = tail call i64 asm sideeffect "# $0 = aaa($1)", "=r,r"(i64 %r) #0, !srcloc !0
+  ret i64 %0
+}
+
 attributes #0 = { nounwind }
 
 !0 = !{i32 47}
 attributes #0 = { nounwind }
 
 !0 = !{i32 47}