]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AArch64: add new tuning param and attribute for enabling conditional early clobber
authorTamar Christina <tamar.christina@arm.com>
Wed, 5 Jun 2024 18:31:11 +0000 (19:31 +0100)
committerTamar Christina <tamar.christina@arm.com>
Wed, 5 Jun 2024 18:31:11 +0000 (19:31 +0100)
This adds a new tuning parameter AARCH64_EXTRA_TUNE_AVOID_PRED_RMW for AArch64 to
allow us to conditionally enable the early clobber alternatives based on the
tuning models.

gcc/ChangeLog:

* config/aarch64/aarch64-tuning-flags.def
(AVOID_PRED_RMW): New.
* config/aarch64/aarch64.h (TARGET_SVE_PRED_CLOBBER): New.
* config/aarch64/aarch64.md (pred_clobber): New.
(arch_enabled): Use it.

gcc/config/aarch64/aarch64-tuning-flags.def
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/aarch64.md

index d5bcaebce770f0b217aac783063d39135f754c77..a9f48f5d3d4ea32fbf53086ba21eab4bc65b6dcb 100644 (file)
@@ -48,4 +48,8 @@ AARCH64_EXTRA_TUNING_OPTION ("avoid_cross_loop_fma", AVOID_CROSS_LOOP_FMA)
 
 AARCH64_EXTRA_TUNING_OPTION ("fully_pipelined_fma", FULLY_PIPELINED_FMA)
 
+/* Enable is the target prefers to use a fresh register for predicate outputs
+   rather than re-use an input predicate register.  */
+AARCH64_EXTRA_TUNING_OPTION ("avoid_pred_rmw", AVOID_PRED_RMW)
+
 #undef AARCH64_EXTRA_TUNING_OPTION
index bbf11faaf4b4340956094a983f8b0dc2649b2d27..0997b82dbc0f28a7a2ac178989c00d724a4af32b 100644 (file)
@@ -495,6 +495,11 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF;
     enabled through +gcs.  */
 #define TARGET_GCS (AARCH64_ISA_GCS)
 
+/* Prefer different predicate registers for the output of a predicated
+   operation over re-using an existing input predicate.  */
+#define TARGET_SVE_PRED_CLOBBER (TARGET_SVE \
+                                && (aarch64_tune_params.extra_tuning_flags \
+                                    & AARCH64_EXTRA_TUNE_AVOID_PRED_RMW))
 
 /* Standard register usage.  */
 
index 9dff2d7a2b00051279c8b95a7f2578860aefac63..389a1906e2366e42504567c13fa309362f256a99 100644 (file)
 ;; target-independent code.
 (define_attr "is_call" "no,yes" (const_string "no"))
 
+;; Indicates whether we want to enable the pattern with an optional early
+;; clobber for SVE predicates.
+(define_attr "pred_clobber" "any,no,yes" (const_string "any"))
+
 ;; [For compatibility with Arm in pipeline models]
 ;; Attribute that specifies whether or not the instruction touches fp
 ;; registers.
 
 (define_attr "arch_enabled" "no,yes"
   (if_then_else
-    (ior
+    (and
+      (ior
+       (and
+         (eq_attr "pred_clobber" "no")
+         (match_test "!TARGET_SVE_PRED_CLOBBER"))
+       (and
+         (eq_attr "pred_clobber" "yes")
+         (match_test "TARGET_SVE_PRED_CLOBBER"))
+       (eq_attr "pred_clobber" "any"))
+
+      (ior
        (eq_attr "arch" "any")
 
        (and (eq_attr "arch" "rcpc8_4")
             (match_test "TARGET_SVE"))
 
        (and (eq_attr "arch" "sme")
-            (match_test "TARGET_SME")))
+            (match_test "TARGET_SME"))))
     (const_string "yes")
     (const_string "no")))