From d5a489c81295f8d50cfceb61161a996b9677ccd4 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 25 Nov 2015 22:28:50 +0000 Subject: [PATCH] [WebAssembly] Fix inline asm support for i64 operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254106 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | 6 +++++- test/CodeGen/WebAssembly/inline-asm.ll | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 5a3e02133f5..8bf25debe6b 100644 --- a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -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; } diff --git a/test/CodeGen/WebAssembly/inline-asm.ll b/test/CodeGen/WebAssembly/inline-asm.ll index 8afb16290c9..e9d2ebf51f6 100644 --- a/test/CodeGen/WebAssembly/inline-asm.ll +++ b/test/CodeGen/WebAssembly/inline-asm.ll @@ -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} -- 2.34.1