[WebAssembly] Also legalize sign_extend_inreg of i32->i64.
authorDan Gohman <dan433584@gmail.com>
Thu, 10 Dec 2015 01:00:19 +0000 (01:00 +0000)
committerDan Gohman <dan433584@gmail.com>
Thu, 10 Dec 2015 01:00:19 +0000 (01:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255191 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
test/CodeGen/WebAssembly/legalize.ll

index 37b82d6385a1557d8764409dc2daa4adf5f2c446..21a28e3b7673c2f56b51f36f79c6c2bfc74ee236 100644 (file)
@@ -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.
index 4bfec212cf769d134db079164d0cdfba8c2ff0ae..5279f4fa7a588abdd48b0e08f9105f279cd4df16 100644 (file)
@@ -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
+}