[llvm-commits] [llvm] r160064 - in /llvm/trunk: lib/Target/Mips/MipsISelLowering.cpp lib/Target/Mips/MipsISelLowering.h test/CodeGen/Mips/selectcc.ll
Akira Hatanaka
ahatanaka at mips.com
Wed Jul 11 12:32:27 PDT 2012
Author: ahatanak
Date: Wed Jul 11 14:32:27 2012
New Revision: 160064
URL: http://llvm.org/viewvc/llvm-project?rev=160064&view=rev
Log:
Implement MipsTargetLowering::LowerSELECT_CC to custom lower SELECT_CC.
Added:
llvm/trunk/test/CodeGen/Mips/selectcc.ll
Modified:
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
llvm/trunk/lib/Target/Mips/MipsISelLowering.h
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=160064&r1=160063&r2=160064&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Jul 11 14:32:27 2012
@@ -152,6 +152,8 @@
setOperationAction(ISD::SELECT, MVT::f32, Custom);
setOperationAction(ISD::SELECT, MVT::f64, Custom);
setOperationAction(ISD::SELECT, MVT::i32, Custom);
+ setOperationAction(ISD::SELECT_CC, MVT::f32, Custom);
+ setOperationAction(ISD::SELECT_CC, MVT::f64, Custom);
setOperationAction(ISD::SETCC, MVT::f32, Custom);
setOperationAction(ISD::SETCC, MVT::f64, Custom);
setOperationAction(ISD::BRCOND, MVT::Other, Custom);
@@ -263,9 +265,6 @@
setInsertFencesForAtomic(true);
- if (Subtarget->isSingleFloat())
- setOperationAction(ISD::SELECT_CC, MVT::f64, Expand);
-
if (!Subtarget->hasSEInReg()) {
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i8, Expand);
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16, Expand);
@@ -801,6 +800,7 @@
case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG);
case ISD::JumpTable: return LowerJumpTable(Op, DAG);
case ISD::SELECT: return LowerSELECT(Op, DAG);
+ case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG);
case ISD::SETCC: return LowerSETCC(Op, DAG);
case ISD::VASTART: return LowerVASTART(Op, DAG);
case ISD::FCOPYSIGN: return LowerFCOPYSIGN(Op, DAG);
@@ -1576,6 +1576,19 @@
Op.getDebugLoc());
}
+SDValue MipsTargetLowering::
+LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const
+{
+ DebugLoc DL = Op.getDebugLoc();
+ EVT Ty = Op.getOperand(0).getValueType();
+ SDValue Cond = DAG.getNode(ISD::SETCC, DL, getSetCCResultType(Ty),
+ Op.getOperand(0), Op.getOperand(1),
+ Op.getOperand(4));
+
+ return DAG.getNode(ISD::SELECT, DL, Op.getValueType(), Cond, Op.getOperand(2),
+ Op.getOperand(3));
+}
+
SDValue MipsTargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
SDValue Cond = CreateFPCmp(DAG, Op);
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=160064&r1=160063&r2=160064&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Wed Jul 11 14:32:27 2012
@@ -138,6 +138,7 @@
SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
+ SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
Added: llvm/trunk/test/CodeGen/Mips/selectcc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/selectcc.ll?rev=160064&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/selectcc.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/selectcc.ll Wed Jul 11 14:32:27 2012
@@ -0,0 +1,25 @@
+; RUN: llc -march=mipsel < %s
+
+ at gd0 = external global double
+ at gd1 = external global double
+
+define double @select_cc_f32(float %a, float %b) nounwind {
+entry:
+ store double 0.000000e+00, double* @gd0, align 8
+ store double 1.000000e+00, double* @gd1, align 8
+ %cmp = fcmp olt float %a, %b
+ %conv = zext i1 %cmp to i32
+ %conv1 = sitofp i32 %conv to double
+ ret double %conv1
+}
+
+define double @select_cc_f64(double %a, double %b) nounwind {
+entry:
+ store double 0.000000e+00, double* @gd0, align 8
+ store double 1.000000e+00, double* @gd1, align 8
+ %cmp = fcmp olt double %a, %b
+ %conv = zext i1 %cmp to i32
+ %conv1 = sitofp i32 %conv to double
+ ret double %conv1
+}
+
More information about the llvm-commits
mailing list