summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChristian Konig <christian.koenig@amd.com>2013-02-26 17:52:36 +0000
committerChristian Konig <christian.koenig@amd.com>2013-02-26 17:52:36 +0000
commit6612ac39c98edc5fb24b7f4b12f4e92a9e02b626 (patch)
tree655bab8f6f701b6260431f8a914b90169322fa5d /llvm/lib
parent76edd4f2bc422313869cfbdc14dc1c288ef44b0f (diff)
downloadbcm5719-llvm-6612ac39c98edc5fb24b7f4b12f4e92a9e02b626.tar.gz
bcm5719-llvm-6612ac39c98edc5fb24b7f4b12f4e92a9e02b626.zip
R600/SI: swap operands if it helps folding
Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 176103
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/R600/SIISelLowering.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Target/R600/SIISelLowering.cpp b/llvm/lib/Target/R600/SIISelLowering.cpp
index bf1f3bf750d..da30c078c74 100644
--- a/llvm/lib/Target/R600/SIISelLowering.cpp
+++ b/llvm/lib/Target/R600/SIISelLowering.cpp
@@ -545,8 +545,22 @@ SDNode *SITargetLowering::PostISelFolding(MachineSDNode *Node,
// Is this a VSrc or SSrc operand ?
unsigned RegClass = Desc->OpInfo[Op].RegClass;
- if (!isVSrc(RegClass) && !isSSrc(RegClass))
+ if (!isVSrc(RegClass) && !isSSrc(RegClass)) {
+
+ if (i == 1 && Desc->isCommutable() &&
+ fitsRegClass(DAG, Ops[0], RegClass) &&
+ foldImm(Ops[1], Immediate, ScalarSlotUsed)) {
+
+ assert(isVSrc(Desc->OpInfo[NumDefs].RegClass) ||
+ isSSrc(Desc->OpInfo[NumDefs].RegClass));
+
+ // Swap commutable operands
+ SDValue Tmp = Ops[1];
+ Ops[1] = Ops[0];
+ Ops[0] = Tmp;
+ }
continue;
+ }
// Try to fold the immediates
if (!foldImm(Ops[i], Immediate, ScalarSlotUsed)) {
OpenPOWER on IntegriCloud