[llvm] [Mips] Do not emit instruction teq if divisor is non-zero immediate value in FastISel implementation (PR #135768)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 19:52:15 PDT 2025


================
@@ -1947,7 +1947,11 @@ bool MipsFastISel::selectDivRem(const Instruction *I, unsigned ISDOpcode) {
     return false;
 
   emitInst(DivOpc).addReg(Src0Reg).addReg(Src1Reg);
-  emitInst(Mips::TEQ).addReg(Src1Reg).addReg(Mips::ZERO).addImm(7);
+  if (!isa<ConstantInt>(I->getOperand(1)) ||
+      (isa<ConstantInt>(I->getOperand(1)) &&
----------------
yingopq wrote:

OK, optimized.

https://github.com/llvm/llvm-project/pull/135768


More information about the llvm-commits mailing list