Mark i64 SETCC as expand so it is turned into a SELECT_CC.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 20 May 2013 00:28:36 +0000 (00:28 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 20 May 2013 00:28:36 +0000 (00:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182227 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcISelLowering.cpp
test/CodeGen/SPARC/64bit.ll

index 3863e2cc1caf61353d076caafc5d3064877087eb..d470fb312dc58a483029fe74cf67e8ed01421a60 100644 (file)
@@ -1300,6 +1300,8 @@ SparcTargetLowering::SparcTargetLowering(TargetMachine &TM)
   setOperationAction(ISD::SELECT_CC, MVT::f64, Custom);
 
   if (Subtarget->is64Bit()) {
+    setOperationAction(ISD::SELECT, MVT::i64, Expand);
+    setOperationAction(ISD::SETCC, MVT::i64, Expand);
     setOperationAction(ISD::BR_CC, MVT::i64, Custom);
     setOperationAction(ISD::SELECT_CC, MVT::i64, Custom);
   }
index dd6cee30b15803f0cc3b80b2cc22dc9faa70d172..e10237b7d8ad1d2dae9f2909e7c306258fec09d9 100644 (file)
@@ -191,3 +191,13 @@ entry:
 }
 
 declare void @g(i8*)
+
+; CHECK: expand_setcc
+; CHECK: subcc %i0, 1,
+; CHECK: movl %xcc, 1,
+define i32 @expand_setcc(i64 %a) {
+  %cond = icmp sle i64 %a, 0
+  %cast2 = zext i1 %cond to i32
+  %RV = sub i32 1, %cast2
+  ret i32 %RV
+}