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

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 07:11:52 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)>;
     }
----------------
rj-jesus wrote:

Are these adjustments to `AddedComplexity` necessary? From what I can tell, selecting reg+imm addressing over reg+reg should work out-of-the-box, without overriding `AddedComplexity` at all, so long as the `_imm` patterns are moved above the `_reg` patterns. 

Once that's done, I believe wrapping the new nontemporal patterns with `let AddedComplexity = 3` or similar should suffice?

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


More information about the llvm-commits mailing list