diff options
author | Tom Stellard <[email protected]> | 2012-07-19 13:28:25 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-07-27 17:08:07 +0000 |
commit | 4cab682184640242d1e6f034f2b6bd7c4378c162 (patch) | |
tree | 5da0b4fea05245797b0b70f04c459386fc98a026 /src/gallium/drivers/radeon | |
parent | ba76684292e568c164cb7cbe7537181af4b452b8 (diff) |
radeon/llvm: Add custom lowering for SELECT_CC nodes on SI
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/SIISelLowering.cpp | 19 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/SIISelLowering.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/SIISelLowering.cpp b/src/gallium/drivers/radeon/SIISelLowering.cpp index 11f79b9927a..79400851470 100644 --- a/src/gallium/drivers/radeon/SIISelLowering.cpp +++ b/src/gallium/drivers/radeon/SIISelLowering.cpp @@ -37,6 +37,11 @@ SITargetLowering::SITargetLowering(TargetMachine &TM) : setOperationAction(ISD::ADD, MVT::i32, Legal); setOperationAction(ISD::BR_CC, MVT::i32, Custom); + + setOperationAction(ISD::SELECT_CC, MVT::f32, Custom); + setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); + + setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); } MachineBasicBlock * SITargetLowering::EmitInstrWithCustomInserter( @@ -208,6 +213,7 @@ SDValue SITargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const switch (Op.getOpcode()) { default: return AMDGPUTargetLowering::LowerOperation(Op, DAG); case ISD::BR_CC: return LowerBR_CC(Op, DAG); + case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG); } } @@ -235,3 +241,16 @@ SDValue SITargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG) const return Result; } +SDValue SITargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const +{ + SDValue LHS = Op.getOperand(0); + SDValue RHS = Op.getOperand(1); + SDValue True = Op.getOperand(2); + SDValue False = Op.getOperand(3); + SDValue CC = Op.getOperand(4); + EVT VT = Op.getValueType(); + DebugLoc DL = Op.getDebugLoc(); + + SDValue Cond = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, CC); + return DAG.getNode(ISD::SELECT, DL, VT, Cond, True, False); +} diff --git a/src/gallium/drivers/radeon/SIISelLowering.h b/src/gallium/drivers/radeon/SIISelLowering.h index 952e0253149..f16202abcc5 100644 --- a/src/gallium/drivers/radeon/SIISelLowering.h +++ b/src/gallium/drivers/radeon/SIISelLowering.h @@ -39,6 +39,7 @@ class SITargetLowering : public AMDGPUTargetLowering MachineRegisterInfo & MRI) const; SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; public: SITargetLowering(TargetMachine &tm); |