diff options
author | Vincent Lejeune <[email protected]> | 2012-09-04 17:28:26 +0200 |
---|---|---|
committer | Vincent Lejeune <[email protected]> | 2012-09-04 17:54:37 +0200 |
commit | 8eaa36317a0a2911cb78066947bc841dd8ce86c8 (patch) | |
tree | b6d8c1993656527541a86e36c4b34fd13b4386c6 /src/gallium/drivers/radeon/R600ISelLowering.cpp | |
parent | a4325b32298cb99b1e99620a33ef0bee52298c3c (diff) |
radeon/llvm: do not convert f32 operand of select_cc node
v2:-use camel coding style
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/R600ISelLowering.cpp')
-rw-r--r-- | src/gallium/drivers/radeon/R600ISelLowering.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gallium/drivers/radeon/R600ISelLowering.cpp b/src/gallium/drivers/radeon/R600ISelLowering.cpp index 79cd6229972..5642ee8fff3 100644 --- a/src/gallium/drivers/radeon/R600ISelLowering.cpp +++ b/src/gallium/drivers/radeon/R600ISelLowering.cpp @@ -441,32 +441,32 @@ SDValue R600TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const // necessary we need to convert LHS and RHS to be the same type True and // False. True and False are guaranteed to have the same type as this // SELECT_CC node. - - if (CompareVT != VT) { - ISD::NodeType ConversionOp = ISD::DELETED_NODE; - if (VT == MVT::f32 && CompareVT == MVT::i32) { - if (isUnsignedIntSetCC(CCOpcode)) { - ConversionOp = ISD::UINT_TO_FP; + + if (isHWTrueValue(True) && isHWFalseValue(False)) { + if (CompareVT != VT) { + if (VT == MVT::f32 && CompareVT == MVT::i32) { + SDValue Boolean = DAG.getNode(ISD::SELECT_CC, DL, CompareVT, + LHS, RHS, + DAG.getConstant(-1, MVT::i32), + DAG.getConstant(0, MVT::i32), + CC); + return DAG.getNode(ISD::UINT_TO_FP, DL, VT, Boolean); + } else if (VT == MVT::i32 && CompareVT == MVT::f32) { + SDValue BoolAsFlt = DAG.getNode(ISD::SELECT_CC, DL, CompareVT, + LHS, RHS, + DAG.getConstantFP(1.0f, MVT::f32), + DAG.getConstantFP(0.0f, MVT::f32), + CC); + return DAG.getNode(ISD::FP_TO_UINT, DL, VT, BoolAsFlt); } else { - ConversionOp = ISD::SINT_TO_FP; + // I don't think there will be any other type pairings. + assert(!"Unhandled operand type parings in SELECT_CC"); } - } else if (VT == MVT::i32 && CompareVT == MVT::f32) { - ConversionOp = ISD::FP_TO_SINT; } else { - // I don't think there will be any other type pairings. - assert(!"Unhandled operand type parings in SELECT_CC"); + return DAG.getNode(ISD::SELECT_CC, DL, VT, LHS, RHS, True, False, CC); } - // XXX Check the value of LHS and RHS and avoid creating sequences like - // (FTOI (ITOF)) - LHS = DAG.getNode(ConversionOp, DL, VT, LHS); - RHS = DAG.getNode(ConversionOp, DL, VT, RHS); } - // If True is a hardware TRUE value and False is a hardware FALSE value or - // vice-versa we can handle this with a native instruction (SET* instructions). - if ((isHWTrueValue(True) && isHWFalseValue(False))) { - return DAG.getNode(ISD::SELECT_CC, DL, VT, LHS, RHS, True, False, CC); - } // XXX If True is a hardware TRUE value and False is a hardware FALSE value, // we can handle this with a native instruction, but we need to swap true |