[llvm] [AArch64][SVE] Select non-temporal instructions for unpredicated loads/stores with the nontemporal flag (PR #171261)

Yuta Mukai via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 21:26:48 PST 2025


================
@@ -3061,29 +3061,22 @@ let Predicates = [HasSVE_or_SME] in {
 
   multiclass unpred_store<PatFrag Store, ValueType Ty, Instruction RegRegInst,
                           Instruction RegImmInst, Instruction PTrue,
-                          ComplexPattern AddrCP> {
-    let AddedComplexity = 1 in {
+                          ComplexPattern AddrCP, int AddedComplexity = 0>  {
+    let AddedComplexity = !add(1, AddedComplexity) in {
       def _reg : Pat<(Store Ty:$val, (AddrCP GPR64sp:$base, GPR64:$offset)),
                      (RegRegInst ZPR:$val, (PTrue 31), GPR64sp:$base, GPR64:$offset)>;
     }
-    let AddedComplexity = 2 in {
+    let AddedComplexity = !add(2, AddedComplexity) in {
       def _imm : Pat<(Store Ty:$val, (am_sve_indexed_s4 GPR64sp:$base, simm4s1:$offset)),
                      (RegImmInst ZPR:$val, (PTrue 31), GPR64sp:$base, simm4s1:$offset)>;
     }
----------------
ytmukai wrote:

Thanks, I understand your suggestion now. (I wrongly thought the inner `let` had priority.)
I verified that moving `_imm` up resulted in no changes to `AArch64GenDAGISel.inc`. Then, by adding the non-temporal pattern wrapped in a `let AddedComplexity = 3` block, I was able to achieve the desired behavior.

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


More information about the llvm-commits mailing list