]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AArch64: Add cssc as arch attr
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Wed, 12 Nov 2025 19:46:19 +0000 (19:46 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 27 Nov 2025 16:53:42 +0000 (16:53 +0000)
Add 'cssc' as an arch attribute.  This allows the compact syntax to be used
in ctz<mode>2 which makes it cleaner.

gcc:
* config/aarch64/aarch64.md (ctz<mode>2): Use compact syntax.

gcc/config/aarch64/aarch64.md

index f62247f3e39c1d6cc4c5a02e81d5f172d6798af7..fde4fabb7ef49ae41e164d47835fb33a812f5e35 100644 (file)
 ;; Q registers and is equivalent to "simd".
 
 (define_enum "arches" [any rcpc8_4 fp fp_q base_simd nobase_simd
-                      simd nosimd sve fp16 sme])
+                      simd nosimd sve fp16 sme cssc])
 
 (define_enum_attr "arch" "arches" (const_string "any"))
 
        (and (eq_attr "arch" "fp16")
             (match_test "TARGET_FP_F16INST"))
 
+       (and (eq_attr "arch" "cssc")
+            (match_test "TARGET_CSSC"))
+
        (and (eq_attr "arch" "sve")
             (match_test "TARGET_SVE"))
 
 ;; If TARGET_CSSC is not available, emit rbit and clz.
 
 (define_insn "ctz<mode>2"
-  [(set (match_operand:GPI 0 "register_operand" "=r")
-       (ctz:GPI (match_operand:GPI 1 "register_operand" "r")))]
+  [(set (match_operand:GPI 0 "register_operand")
+       (ctz:GPI (match_operand:GPI 1 "register_operand")))]
   ""
-  {
-    if (TARGET_CSSC)
-      return "ctz\\t%<w>0, %<w>1";
-    return "rbit\\t%<w>0, %<w>1\;clz\\t%<w>0, %<w>0";
+  {@ [ cons: =0, 1; attrs: type, arch, length ]
+     [ r , r; clz, cssc, 4 ] ctz\\t%<w>0, %<w>1
+     [ r , r; clz, *   , 8 ] rbit\\t%<w>0, %<w>1\;clz\\t%<w>0, %<w>0
   }
-  [(set_attr "type" "clz")
-   (set (attr "length") (if_then_else (match_test "TARGET_CSSC")
-                                     (const_int 4) (const_int 8)))
-  ]
 )
 
 (define_insn "clrsb<mode>2"