diff options
author | Vincent Lejeune <vljn@ovi.com> | 2013-09-12 23:45:00 +0000 |
---|---|---|
committer | Vincent Lejeune <vljn@ovi.com> | 2013-09-12 23:45:00 +0000 |
commit | 5251d180f4af15414a9c7ae5723dd48bc938576b (patch) | |
tree | abb3c1a366fcfaa32658ef9bffcfc2a7b5b0b3ae /lib/Target/R600/R600ISelLowering.cpp | |
parent | f57d692c11f0ff6e9c45d2c48c5f362f4c575cf7 (diff) | |
download | llvm-5251d180f4af15414a9c7ae5723dd48bc938576b.tar.gz llvm-5251d180f4af15414a9c7ae5723dd48bc938576b.tar.bz2 llvm-5251d180f4af15414a9c7ae5723dd48bc938576b.tar.xz |
R600: Move clamp handling code to R600IselLowering.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/R600/R600ISelLowering.cpp')
-rw-r--r-- | lib/Target/R600/R600ISelLowering.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/R600/R600ISelLowering.cpp b/lib/Target/R600/R600ISelLowering.cpp index 5db793737e..c5e814ff8c 100644 --- a/lib/Target/R600/R600ISelLowering.cpp +++ b/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; |