[llvm] [Mips] Do not emit instruction teq if divisor is non-zero immediate value in FastISel implementation (PR #135768)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 03:00:57 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)) &&
+ dyn_cast<ConstantInt>(I->getOperand(1))->isZero())) {
----------------
wzssyqa wrote:
`I->getConstantOperandVal(1) == 0` can be short and more readable.
https://github.com/llvm/llvm-project/pull/135768
More information about the llvm-commits
mailing list