[Sparc]: Implement getSetCCResultType() in SparcTargetLowering so that umulo/smulo...
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>
Mon, 9 Dec 2013 04:02:15 +0000 (04:02 +0000)
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>
Mon, 9 Dec 2013 04:02:15 +0000 (04:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196751 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 1b56757c1d6c884e7fe0d1c9502ce004ceca2705..6161488846260d9f244f6989141a4ce9c060659c 100644 (file)
@@ -1607,6 +1607,12 @@ const char *SparcTargetLowering::getTargetNodeName(unsigned Opcode) const {
   }
 }
 
+EVT SparcTargetLowering::getSetCCResultType(LLVMContext &, EVT VT) const {
+  if (!VT.isVector())
+    return MVT::i32;
+  return VT.changeVectorElementTypeToInteger();
+}
+
 /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to
 /// be zero. Op is expected to be a target specific node. Used by DAG
 /// combiner.
index 8d27caaf159bc68b16dd291558157dcac7cdf9ef..2659fc89501de3a029aa599bc99a8d29375eefe7 100644 (file)
@@ -79,6 +79,9 @@ namespace llvm {
     virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
     virtual MVT getScalarShiftAmountTy(EVT LHSTy) const { return MVT::i32; }
 
+    /// getSetCCResultType - Return the ISD::SETCC ValueType
+    virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const;
+
     virtual SDValue
       LowerFormalArguments(SDValue Chain,
                            CallingConv::ID CallConv,
index bdc5e70a2de848a36a2ed0c222239d91ded32df3..7451b04eadfe6f37537b962ae574896f16dac1df 100644 (file)
@@ -109,3 +109,17 @@ entry:
   %rv = select i1 %tobool, i64 123, i64 0
   ret i64 %rv
 }
+
+; CHECK-LABEL: setcc_resultty
+; CHECK:       cmp
+; CHECK:       movne %xcc, 1, [[R:%[gilo][0-7]]]
+; CHECK:       or [[R]], %i1, %i0
+
+define i1 @setcc_resultty(i64 %a, i1 %b) {
+  %a0 = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 32)
+  %a1 = extractvalue { i64, i1 } %a0, 1
+  %a4 = or i1 %a1, %b
+  ret i1 %a4
+}
+
+declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64)