mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-04 05:31:06 +00:00
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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176103 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b3d1eaded7
commit
b37afdcf3f
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user