[fast-isel] Add support for returning non-legal types with no sign- or zero-
authorChad Rosier <mcrosier@apple.com>
Fri, 17 Feb 2012 01:21:28 +0000 (01:21 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 17 Feb 2012 01:21:28 +0000 (01:21 +0000)
entend flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150774 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMFastISel.cpp
test/CodeGen/ARM/fast-isel-ret.ll

index 21c1f86442e9b941bf3cbc672618381f399377ca..51c44d0adb0f2f62ef82526133ca91e23225bac1 100644 (file)
@@ -2037,14 +2037,14 @@ bool ARMFastISel::SelectRet(const Instruction *I) {
       if (RVVT != MVT::i1 && RVVT != MVT::i8 && RVVT != MVT::i16)
         return false;
 
-      if (!Outs[0].Flags.isZExt() && !Outs[0].Flags.isSExt())
-        return false;
-
       assert(DestVT == MVT::i32 && "ARM should always ext to i32");
 
-      bool isZExt = Outs[0].Flags.isZExt();
-      SrcReg = ARMEmitIntExt(RVVT, SrcReg, DestVT, isZExt);
-      if (SrcReg == 0) return false;
+      // Perform extension if flagged as either zext or sext.  Otherwise, do
+      // nothing.
+      if (Outs[0].Flags.isZExt() || Outs[0].Flags.isSExt()) {
+        SrcReg = ARMEmitIntExt(RVVT, SrcReg, DestVT, Outs[0].Flags.isZExt());
+        if (SrcReg == 0) return false;
+      }
     }
 
     // Make the copy.
index 175cd9034ce775ed7f8040986c6966635f69c173..689b169ee32f6285358ff5ea3ea2f86eb641362b 100644 (file)
@@ -46,3 +46,12 @@ entry:
 ; CHECK: bx lr
   ret i16 %a
 }
+
+define i16 @ret6(i16 %a) nounwind uwtable ssp {
+entry:
+; CHECK: ret6
+; CHECK-NOT: uxth
+; CHECK-NOT: sxth
+; CHECK: bx lr
+  ret i16 %a
+}