mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-17 00:27:31 +00:00
PPC: Teach FMA mutate to respect register classes.
This was causing bad code gen and assembly that won't assemble, as mixed altivec and vsx code would end up with a vsx high register assigned to an altivec instruction, which won't work. Constraining the classes allows the optimization to proceed. llvm-svn: 255299
This commit is contained in:
parent
28da4411df
commit
706d39a054
@ -220,6 +220,14 @@ protected:
|
||||
if (OldFMAReg == KilledProdReg)
|
||||
continue;
|
||||
|
||||
// If there isn't a class that fits, we can't perform the transform.
|
||||
// This is needed for correctness with a mixture of VSX and Altivec
|
||||
// instructions to make sure that a low VSX register is not assigned to
|
||||
// the Altivec instruction.
|
||||
if (!MRI.constrainRegClass(KilledProdReg,
|
||||
MRI.getRegClass(OldFMAReg)))
|
||||
continue;
|
||||
|
||||
assert(OldFMAReg == AddendMI->getOperand(0).getReg() &&
|
||||
"Addend copy not tied to old FMA output!");
|
||||
|
||||
@ -262,8 +270,7 @@ protected:
|
||||
if (UseMI == AddendMI)
|
||||
continue;
|
||||
|
||||
UseMO.setReg(KilledProdReg);
|
||||
UseMO.setSubReg(KilledProdSubReg);
|
||||
UseMO.substVirtReg(KilledProdReg, KilledProdSubReg, *TRI);
|
||||
}
|
||||
|
||||
// Extend the live intervals of the killed product operand to hold the
|
||||
|
89
test/CodeGen/PowerPC/fma-mutate-register-constraint.ll
Normal file
89
test/CodeGen/PowerPC/fma-mutate-register-constraint.ll
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user