[llvm] [AArch64][GlobalISel] Add push_mul_through_s/zext (PR #141551)

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 04:05:53 PDT 2025


================
@@ -594,9 +621,9 @@ void applyPushAddSubExt(MachineInstr &MI, MachineRegisterInfo &MRI,
       B.buildInstr(MI.getOpcode(), {MidTy}, {Ext1Reg, Ext2Reg}).getReg(0);
 
   // G_SUB has to sign-extend the result.
-  // G_ADD needs to sext from sext and can sext or zext from zext, so the
-  // original opcode is used.
-  if (MI.getOpcode() == TargetOpcode::G_ADD)
+  // G_ADD needs to sext from sext and can sext or zext from zext, and G_MUL
+  // needs to use the original opcode so the original opcode is used for both.
+  if (MI.getOpcode() != TargetOpcode::G_SUB)
----------------
c-rhodes wrote:

nit: I think it would be clearer if you just spelt it out
```suggestion
  if ((MI.getOpcode() == TargetOpcode::G_ADD) || (MI.getOpcode() == TargetOpcode::G_MUL) )
```

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


More information about the llvm-commits mailing list