[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 5a3e021..8bf25de 100644 (file)
@@ -220,7 +220,11 @@ WebAssemblyTargetLowering::getRegForInlineAsmConstraint(
   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;
     }
index 8afb162..e9d2ebf 100644 (file)
@@ -43,6 +43,19 @@ entry:
   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}