aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Osborne <richard@xmos.com>2010-03-09 16:13:57 +0000
committerRichard Osborne <richard@xmos.com>2010-03-09 16:13:57 +0000
commit36439e28fc68c7205daade81259f810cc4ae0750 (patch)
tree2682c6ddc80e537551734517dce58232bfae04f1 /lib
parent4d1abd81c10fdba4fa6308ea6dc3c24a49f067de (diff)
downloadexternal_llvm-36439e28fc68c7205daade81259f810cc4ae0750.zip
external_llvm-36439e28fc68c7205daade81259f810cc4ae0750.tar.gz
external_llvm-36439e28fc68c7205daade81259f810cc4ae0750.tar.bz2
Canonicalize ladd constant to RHS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/XCore/XCoreISelLowering.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/XCore/XCoreISelLowering.cpp b/lib/Target/XCore/XCoreISelLowering.cpp
index e59b18c..d8cbd03 100644
--- a/lib/Target/XCore/XCoreISelLowering.cpp
+++ b/lib/Target/XCore/XCoreISelLowering.cpp
@@ -1105,6 +1105,10 @@ SDValue XCoreTargetLowering::PerformDAGCombine(SDNode *N,
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
EVT VT = N0.getValueType();
+ // canonicalize constant to RHS
+ if (N0C && !N1C)
+ return DAG.getNode(XCoreISD::LADD, dl, DAG.getVTList(VT, VT), N1, N0, N2);
+
// fold (ladd 0, 0, x) -> 0, x & 1
if (N0C && N0C->isNullValue() && N1C && N1C->isNullValue()) {
SDValue Carry = DAG.getConstant(0, VT);