llvm.org GIT mirror llvm / 7e77dab
[PowerPC] Correct commutable indices for VSX FMA instructions Although the first two operands are the ones that can be swapped, the tied input operand is listed before them, so we need to adjust for that. I have a test case for this, but it goes along with an upcoming commit (so it will come soon). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204748 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 6 years ago
2 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
279279 MI->getOperand(4).setImm((ME+1) & 31);
280280 MI->getOperand(5).setImm((MB-1) & 31);
281281 return MI;
282 }
283
284 bool PPCInstrInfo::findCommutedOpIndices(MachineInstr *MI, unsigned &SrcOpIdx1,
285 unsigned &SrcOpIdx2) const {
286 // For VSX A-Type FMA instructions, it is the first two operands that can be
287 // commuted, however, because the non-encoded tied input operand is listed
288 // first, the operands to swap are actually the second and third.
289
290 int AltOpc = PPC::getAltVSXFMAOpcode(MI->getOpcode());
291 if (AltOpc == -1)
292 return TargetInstrInfo::findCommutedOpIndices(MI, SrcOpIdx1, SrcOpIdx2);
293
294 SrcOpIdx1 = 2;
295 SrcOpIdx2 = 3;
296 return true;
282297 }
283298
284299 void PPCInstrInfo::insertNoop(MachineBasicBlock &MBB,
118118 // rotate amt is zero. We also have to munge the immediates a bit.
119119 virtual MachineInstr *commuteInstruction(MachineInstr *MI, bool NewMI) const;
120120
121 virtual bool findCommutedOpIndices(MachineInstr *MI, unsigned &SrcOpIdx1,
122 unsigned &SrcOpIdx2) const;
123
121124 virtual void insertNoop(MachineBasicBlock &MBB,
122125 MachineBasicBlock::iterator MI) const;
123126