[clang] [llvm] [AArch64] Add CodeGen support for scalar FEAT_CPA (PR #105669)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 05:53:00 PDT 2025


================
@@ -10716,6 +10716,21 @@ let Predicates = [HasCPA] in {
   // Scalar multiply-add/subtract
   def MADDPT : MulAccumCPA<0, "maddpt">;
   def MSUBPT : MulAccumCPA<1, "msubpt">;
+
+  def : Pat<(ptradd GPR64sp:$Rn, GPR64sp:$Rm),
+            (ADDPT_shift GPR64sp:$Rn, GPR64sp:$Rm, (i32 0))>;
+  def : Pat<(ptradd GPR64sp:$Rn, (shl GPR64sp:$Rm, (i64 imm0_7:$imm))),
+            (ADDPT_shift GPR64sp:$Rn, GPR64sp:$Rm,
+                         (i32 (trunc_imm imm0_7:$imm)))>;
----------------
davemgreen wrote:

Do you mind making the shift operand (lsl_imm3_shift_operand) an i64 as opposed to i32, to avoid the trunc_imm? Representing it as an i64 seems like a more natural type for something based on pointers, even if the exact type does not matter due to the range.

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


More information about the llvm-commits mailing list