From 338412765288cd6041d31db12f33a39fbad6efcb Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 10 Dec 2015 01:00:19 +0000 Subject: [PATCH] [WebAssembly] Also legalize sign_extend_inreg of i32->i64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255191 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | 2 +- test/CodeGen/WebAssembly/legalize.ll | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 37b82d6385a..21a28e3b767 100644 --- a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -159,7 +159,7 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering( // As a special case, these operators use the type to mean the type to // sign-extend from. - for (auto T : {MVT::i1, MVT::i8, MVT::i16}) + for (auto T : {MVT::i1, MVT::i8, MVT::i16, MVT::i32}) setOperationAction(ISD::SIGN_EXTEND_INREG, T, Expand); // Dynamic stack allocation: use the default expansion. diff --git a/test/CodeGen/WebAssembly/legalize.ll b/test/CodeGen/WebAssembly/legalize.ll index 4bfec212cf7..5279f4fa7a5 100644 --- a/test/CodeGen/WebAssembly/legalize.ll +++ b/test/CodeGen/WebAssembly/legalize.ll @@ -22,3 +22,12 @@ define i53 @shl_i53(i53 %a, i53 %b, i53* %p) { %t = shl i53 %a, %b ret i53 %t } + +; CHECK-LABEL: sext_in_reg_i32_i64: +; CHECK: i64.shl +; CHECK: i64.shr_s +define i64 @sext_in_reg_i32_i64(i64 %a) { + %b = shl i64 %a, 32 + %c = ashr i64 %b, 32 + ret i64 %c +} -- 2.34.1