summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/XCore/XCoreISelLowering.cpp
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
commitc5ff63d70fbb220fc2c80af39eef987c4738f797 (patch)
tree4b210cf7d6bfc0a58a9514434dbeb59abbd7cabe /llvm/lib/Target/XCore/XCoreISelLowering.cpp
parentf4e76cf44de41aba7c55e21be38b261eb586a0cf (diff)
downloadbcm5719-llvm-c5ff63d70fbb220fc2c80af39eef987c4738f797.tar.gz
bcm5719-llvm-c5ff63d70fbb220fc2c80af39eef987c4738f797.zip
Canonicalize ladd constant to RHS.
llvm-svn: 98058
Diffstat (limited to 'llvm/lib/Target/XCore/XCoreISelLowering.cpp')
-rw-r--r--llvm/lib/Target/XCore/XCoreISelLowering.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp
index e59b18cd2a3..d8cbd037cb2 100644
--- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud