summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/R600/R600ISelLowering.cpp
diff options
context:
space:
mode:
authorVincent Lejeune <vljn@ovi.com>2013-09-12 23:45:00 +0000
committerVincent Lejeune <vljn@ovi.com>2013-09-12 23:45:00 +0000
commit0167a313dadfeb3239568dbe39f781e07ea4be9e (patch)
tree320cbcada3a229a9bcad270a4f05b9fd8d4aa8f4 /llvm/lib/Target/R600/R600ISelLowering.cpp
parent9a248e5c2d9646a615df01a4761ec69b4552b60d (diff)
downloadbcm5719-llvm-0167a313dadfeb3239568dbe39f781e07ea4be9e.tar.gz
bcm5719-llvm-0167a313dadfeb3239568dbe39f781e07ea4be9e.zip
R600: Move clamp handling code to R600IselLowering.cpp
llvm-svn: 190645
Diffstat (limited to 'llvm/lib/Target/R600/R600ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/R600/R600ISelLowering.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/R600ISelLowering.cpp b/llvm/lib/Target/R600/R600ISelLowering.cpp
index 5db793737e0..c5e814ff8c6 100644
--- a/llvm/lib/Target/R600/R600ISelLowering.cpp
+++ b/llvm/lib/Target/R600/R600ISelLowering.cpp
@@ -1822,6 +1822,22 @@ SDNode *R600TargetLowering::PostISelFolding(MachineSDNode *Node,
if (FoldOperand(Node, i, Src, FakeOp, FakeOp, FakeOp, FakeOp, DAG))
return DAG.getMachineNode(Opcode, SDLoc(Node), Node->getVTList(), Ops);
}
+ } else if (Opcode == AMDGPU::CLAMP_R600) {
+ SDValue Src = Node->getOperand(0);
+ if (!Src.isMachineOpcode() ||
+ !TII->hasInstrModifiers(Src.getMachineOpcode()))
+ return Node;
+ int ClampIdx = TII->getOperandIdx(Src.getMachineOpcode(),
+ AMDGPU::OpName::clamp);
+ if (ClampIdx < 0)
+ return Node;
+ std::vector<SDValue> Ops;
+ unsigned NumOp = Src.getNumOperands();
+ for(unsigned i = 0; i < NumOp; ++i)
+ Ops.push_back(Src.getOperand(i));
+ Ops[ClampIdx - 1] = DAG.getTargetConstant(1, MVT::i32);
+ return DAG.getMachineNode(Src.getMachineOpcode(), SDLoc(Node),
+ Node->getVTList(), Ops);
} else {
if (!TII->hasInstrModifiers(Opcode))
return Node;
OpenPOWER on IntegriCloud