summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-09-28 02:50:38 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-09-28 02:50:38 +0000
commitcd42818d86ba78d4fcc09864c7eaf6b2497a165c (patch)
tree1f7176b5c94be1ba9396f2eec135f8f1feda4d35 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent08690a146f893bada66845b45168816aecce59e4 (diff)
downloadbcm5719-llvm-cd42818d86ba78d4fcc09864c7eaf6b2497a165c.tar.gz
bcm5719-llvm-cd42818d86ba78d4fcc09864c7eaf6b2497a165c.zip
SelectionDAG: Try to expand all condition codes using getCCSwappedOperands()
This is useful for targets like R600, which only support GT, GE, NE, and EQ condition codes as it removes the need to handle unsupported condition codes in target specific code. There are no tests with this commit, but R600 has been updated to take advantage of this new feature, so its existing selectcc tests are now testing the swapped operands path. llvm-svn: 191601
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 25f6aac01d1..b96c4b18d11 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1645,7 +1645,12 @@ SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1,
}
} else {
// Ensure that the constant occurs on the RHS.
- return getSetCC(dl, VT, N2, N1, ISD::getSetCCSwappedOperands(Cond));
+ ISD::CondCode SwappedCond = ISD::getSetCCSwappedOperands(Cond);
+ MVT CompVT = N1.getValueType().getSimpleVT();
+ if (!TM.getTargetLowering()->isCondCodeLegal(SwappedCond, CompVT))
+ return SDValue();
+
+ return getSetCC(dl, VT, N2, N1, SwappedCond);
}
}
OpenPOWER on IntegriCloud