llvm.org GIT mirror llvm / c227c46
[mips] Expand pseudo multiply/divide instructions in MipsCodeEmitter.cpp. This patch fixes the following two tests which have been failing on llvm-mips-linux builder since r178403: LLVM :: Analysis/Profiling/load-branch-weights-ifs.ll LLVM :: Analysis/Profiling/load-branch-weights-loops.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178584 91177308-0d34-0410-b5e6-96231b3b80d8 Akira Hatanaka 7 years ago
1 changed file(s) with 36 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
114114 void emitGlobalAddressUnaligned(const GlobalValue *GV, unsigned Reloc,
115115 int Offset) const;
116116
117 /// Expand pseudo instructions with accumulator register operands.
118 void expandACCInstr(MachineBasicBlock::instr_iterator &MI,
119 MachineBasicBlock &MBB, unsigned Opc) const;
120
117121 /// \brief Expand pseudo instruction. Return true if MI was expanded.
118122 bool expandPseudos(MachineBasicBlock::instr_iterator &MI,
119123 MachineBasicBlock &MBB) const;
297301 MCE.emitWordBE(Word);
298302 }
299303
304 void MipsCodeEmitter::expandACCInstr(MachineBasicBlock::instr_iterator &MI,
305 MachineBasicBlock &MBB,
306 unsigned Opc) const {
307 // Expand "pseudomult $ac0, $t0, $t1" to "mult $t0, $t1".
308 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Opc))
309 .addReg(MI->getOperand(1).getReg()).addReg(MI->getOperand(2).getReg());
310 }
311
300312 bool MipsCodeEmitter::expandPseudos(MachineBasicBlock::instr_iterator &MI,
301313 MachineBasicBlock &MBB) const {
302314 switch (MI->getOpcode()) {
308320 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Mips::JALR), Mips::RA)
309321 .addReg(MI->getOperand(0).getReg());
310322 break;
323 case Mips::PseudoMULT:
324 expandACCInstr(MI, MBB, Mips::MULT);
325 break;
326 case Mips::PseudoMULTu:
327 expandACCInstr(MI, MBB, Mips::MULTu);
328 break;
329 case Mips::PseudoSDIV:
330 expandACCInstr(MI, MBB, Mips::SDIV);
331 break;
332 case Mips::PseudoUDIV:
333 expandACCInstr(MI, MBB, Mips::UDIV);
334 break;
335 case Mips::PseudoMADD:
336 expandACCInstr(MI, MBB, Mips::MADD);
337 break;
338 case Mips::PseudoMADDU:
339 expandACCInstr(MI, MBB, Mips::MADDU);
340 break;
341 case Mips::PseudoMSUB:
342 expandACCInstr(MI, MBB, Mips::MSUB);
343 break;
344 case Mips::PseudoMSUBU:
345 expandACCInstr(MI, MBB, Mips::MSUBU);
346 break;
311347 default:
312348 return false;
313349 }