summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsInstructionSelector.cpp
diff options
context:
space:
mode:
authorPetar Avramovic <Petar.Avramovic@rt-rk.com>2019-03-01 07:25:44 +0000
committerPetar Avramovic <Petar.Avramovic@rt-rk.com>2019-03-01 07:25:44 +0000
commita48285a1900ed17b019ef291ecae743a91d2f8b6 (patch)
treee6432165b2edfc21a45b3cb75910821d096e6e97 /llvm/lib/Target/Mips/MipsInstructionSelector.cpp
parent524b3c181012caf2197abdff8cf96d0d75873125 (diff)
downloadbcm5719-llvm-a48285a1900ed17b019ef291ecae743a91d2f8b6.tar.gz
bcm5719-llvm-a48285a1900ed17b019ef291ecae743a91d2f8b6.zip
[MIPS GlobalISel] Select G_UMULH
Legalize G_UMULO and select G_UMULH for MIPS32. Differential Revision: https://reviews.llvm.org/D58714 llvm-svn: 355177
Diffstat (limited to 'llvm/lib/Target/Mips/MipsInstructionSelector.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsInstructionSelector.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsInstructionSelector.cpp b/llvm/lib/Target/Mips/MipsInstructionSelector.cpp
index c97fac9d21b..92a62b5186b 100644
--- a/llvm/lib/Target/Mips/MipsInstructionSelector.cpp
+++ b/llvm/lib/Target/Mips/MipsInstructionSelector.cpp
@@ -139,6 +139,26 @@ bool MipsInstructionSelector::select(MachineInstr &I,
using namespace TargetOpcode;
switch (I.getOpcode()) {
+ case G_UMULH: {
+ unsigned PseudoMULTuReg = MRI.createVirtualRegister(&Mips::ACC64RegClass);
+ MachineInstr *PseudoMULTu, *PseudoMove;
+
+ PseudoMULTu = BuildMI(MBB, I, I.getDebugLoc(), TII.get(Mips::PseudoMULTu))
+ .addDef(PseudoMULTuReg)
+ .add(I.getOperand(1))
+ .add(I.getOperand(2));
+ if (!constrainSelectedInstRegOperands(*PseudoMULTu, TII, TRI, RBI))
+ return false;
+
+ PseudoMove = BuildMI(MBB, I, I.getDebugLoc(), TII.get(Mips::PseudoMFHI))
+ .addDef(I.getOperand(0).getReg())
+ .addUse(PseudoMULTuReg);
+ if (!constrainSelectedInstRegOperands(*PseudoMove, TII, TRI, RBI))
+ return false;
+
+ I.eraseFromParent();
+ return true;
+ }
case G_GEP: {
MI = BuildMI(MBB, I, I.getDebugLoc(), TII.get(Mips::ADDu))
.add(I.getOperand(0))
OpenPOWER on IntegriCloud