[PATCH] aarch64: Treat all SVE as basic NEON instructions in DFA

Kyrylo Tkachov ktkachov@nvidia.com
Mon Oct 12 10:04:25 GMT 2026



> On 12 Oct 2026, at 11:10, xiezhiheng <xiezhiheng@huawei.com> wrote:
> 
> As mentioned in https://gcc.gnu.org/pipermail/gcc-patches/2026-October/733982.html,
> SVE instructions in the AArch64 backend do not have reservations set.
> So treat all SVE instructions as basic NEON instructions to avoid a
> large number of "nothing" entries in the DFA.
> 
> For the args_1.c test case, I believe this is a separate issue that
> can be fixed in a separate patch. For now, I have restored the matching
> assembly to its previous form (see PR116604). For the other test cases,
> adjust the new instruction order.
> 
> Bootstrapped and tested on aarch64-linux-gnu, no regressions.
> And I built and tested on arm-none-eabi on a simulator, see no regressions
> 
> gcc/ChangeLog:
> 
> * config/aarch64/aarch64.md (sve_type): Move to ...
> * config/arm/cortex-a53.md: Treat SVE as NEON
> * config/arm/cortex-a57.md: Likewise
> * config/arm/types.md (sve_type): ... here

Missing full stops in ChangeLog entires and the move to… line doesn’t match up with the next line.
But more importantly...
These SVE types are an aarch64-only construct so they shouldn’t be moved to config/arm/ . They should stay where they are. I think we should move the cortex-a53.md and cortex-a57.md descriptions into config/aarch64/.
As long as it doesn’t break the arm build it should all work fine.
Thanks,
Kyrill

> 
> gcc/testsuite/ChangeLog:
> 
> * gcc.target/aarch64/popcnt11.c: Adjust instruction order
> * gcc.target/aarch64/pr117557.c: Likewise
> * gcc.target/aarch64/sve/noeffect2.c: Likewise
> * gcc.target/aarch64/sve/pcs/args_1.c: Match the new assembly
> * gcc.target/aarch64/sve/pred_clobber_4.c: Adjust instruction order
> * gcc.target/aarch64/sve/widen_sum_1.c: Likewise
> ---
> gcc/config/aarch64/aarch64.md                 | 20 -------------------
> gcc/config/arm/cortex-a53.md                  |  6 +++++-
> gcc/config/arm/cortex-a57.md                  |  4 ++++
> gcc/config/arm/types.md                       | 20 +++++++++++++++++++
> gcc/testsuite/gcc.target/aarch64/popcnt11.c   | 12 +++++------
> gcc/testsuite/gcc.target/aarch64/pr117557.c   |  7 ++++---
> .../gcc.target/aarch64/sve/noeffect2.c        |  2 +-
> .../gcc.target/aarch64/sve/pcs/args_1.c       | 19 ++++++++----------
> .../gcc.target/aarch64/sve/pred_clobber_4.c   |  1 +
> .../gcc.target/aarch64/sve/widen_sum_1.c      |  4 ++++
> 10 files changed, 53 insertions(+), 42 deletions(-)
> 
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 988b00e55df..111baf4fadc 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -684,26 +684,6 @@ (define_attr "stride_type"
> ;; patterns.
> (define_attr "ldpstp" "ldp,stp,none" (const_string "none"))
> 
> -;; Attribute that classifies SVE instructions by their functional type.
> -;; This attribute is currently only used for dispatch scheduling.
> -(define_attr "sve_type"
> -  "none,\
> -   sve_pred_logical,sve_pred_cnt_ctrl,sve_pred_cnt_scalar,sve_pred_misc,\
> -   sve_pred_vec,\
> -   sve_fp_arith,sve_fp_mul,sve_fp_assoc_add,sve_fp_cmp,sve_fp_cvt,sve_fp_log,\
> -   sve_fp_exp,sve_fp_div,sve_fp_sqrt,sve_fp_reduc,sve_fp_misc,\
> -   sve_int_general,sve_int_shift,sve_int_mul,sve_int_dot,sve_int_cmp_set,\
> -   sve_int_extend,sve_int_extract,sve_int_cvt,sve_int_div,sve_int_index,\
> -   sve_int_match,sve_int_recip_est,sve_int_reduc,sve_int_accum,\
> -   sve_int_pmul,sve_int_bit_perm,\
> -   sve_load_pred,sve_load_1reg,sve_load_2reg,sve_load_3reg,sve_load_4reg,\
> -   sve_gatherload_32,sve_gatherload_64,\
> -   sve_store_pred,sve_store_1reg,sve_store_2reg,sve_store_3reg,sve_store_4reg,\
> -   sve_scatterstore_32,sve_scatterstore_64,\
> -   sve_ffr,\
> -   sve_crypto_sha3"
> -  (const_string "none"))
> -
> ;; -------------------------------------------------------------------
> ;; Pipeline descriptions and scheduling
> ;; -------------------------------------------------------------------
> diff --git a/gcc/config/arm/cortex-a53.md b/gcc/config/arm/cortex-a53.md
> index 87ad1656441..d5b59522ac1 100644
> --- a/gcc/config/arm/cortex-a53.md
> +++ b/gcc/config/arm/cortex-a53.md
> @@ -446,7 +446,11 @@ (define_attr "cortex_a53_advsimd_type"
>     neon_store4_4reg, neon_store4_4reg_q,\
>     neon_store4_one_lane, neon_store4_one_lane_q,\
>     neon_stp, neon_stp_q")
> -      (const_string "advsimd_store_lots")]
> +      (const_string "advsimd_store_lots")
> +;; Treat all SVE instructions as basic NEON instructions to avoid
> +;; lots of "nothing" in the DFA.
> +    (not (eq_attr "sve_type" "none"))
> +      (const_string "advsimd_alu")]
>       (const_string "unknown")))
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> diff --git a/gcc/config/arm/cortex-a57.md b/gcc/config/arm/cortex-a57.md
> index 07003422e01..7a06d121c55 100644
> --- a/gcc/config/arm/cortex-a57.md
> +++ b/gcc/config/arm/cortex-a57.md
> @@ -241,6 +241,10 @@ (define_attr "cortex_a57_neon_type"
> ;; still a NEON type, treat it as a basic NEON type.  This is better than
> ;; dropping it on the floor and making no assumptions about it whatsoever.
>  (eq_attr "is_neon_type" "yes")
> +    (const_string "neon_arith_basic")
> +;; Treat all SVE instructions as basic NEON instructions to avoid
> +;; lots of "nothing" in the DFA.
> +  (not (eq_attr "sve_type" "none"))
>    (const_string "neon_arith_basic")]
>  (const_string "unknown")))
> 
> diff --git a/gcc/config/arm/types.md b/gcc/config/arm/types.md
> index 7f8d83be410..58fa6501e61 100644
> --- a/gcc/config/arm/types.md
> +++ b/gcc/config/arm/types.md
> @@ -1175,6 +1175,26 @@ (define_attr "is_mve_type" "yes,no"
>         (const_string "yes")
>         (const_string "no")))
> 
> +;; Attribute that classifies SVE instructions by their functional type.
> +;; This attribute is currently only used for dispatch scheduling.
> +(define_attr "sve_type"
> +  "none,\
> +   sve_pred_logical,sve_pred_cnt_ctrl,sve_pred_cnt_scalar,sve_pred_misc,\
> +   sve_pred_vec,\
> +   sve_fp_arith,sve_fp_mul,sve_fp_assoc_add,sve_fp_cmp,sve_fp_cvt,sve_fp_log,\
> +   sve_fp_exp,sve_fp_div,sve_fp_sqrt,sve_fp_reduc,sve_fp_misc,\
> +   sve_int_general,sve_int_shift,sve_int_mul,sve_int_dot,sve_int_cmp_set,\
> +   sve_int_extend,sve_int_extract,sve_int_cvt,sve_int_div,sve_int_index,\
> +   sve_int_match,sve_int_recip_est,sve_int_reduc,sve_int_accum,\
> +   sve_int_pmul,sve_int_bit_perm,\
> +   sve_load_pred,sve_load_1reg,sve_load_2reg,sve_load_3reg,sve_load_4reg,\
> +   sve_gatherload_32,sve_gatherload_64,\
> +   sve_store_pred,sve_store_1reg,sve_store_2reg,sve_store_3reg,sve_store_4reg,\
> +   sve_scatterstore_32,sve_scatterstore_64,\
> +   sve_ffr,\
> +   sve_crypto_sha3"
> +  (const_string "none"))
> +
> (define_insn_reservation "no_reservation" 0
>   (eq_attr "type" "no_insn")
>   "nothing")
> diff --git a/gcc/testsuite/gcc.target/aarch64/popcnt11.c b/gcc/testsuite/gcc.target/aarch64/popcnt11.c
> index e7e67de3572..8a0e5532a27 100644
> --- a/gcc/testsuite/gcc.target/aarch64/popcnt11.c
> +++ b/gcc/testsuite/gcc.target/aarch64/popcnt11.c
> @@ -17,10 +17,10 @@ f_qi (unsigned char *a)
> 
> /*
> ** f_hi:
> -** ldr h([0-9]+), \[x0\]
> ** ptrue (p[0-7]).b, vl8
> -** cnt z\1.h, \2/m, z\1.h
> -** smov w0, v\1.h\[0\]
> +** ldr h([0-9]+), \[x0\]
> +** cnt z\2.h, \1/m, z\2.h
> +** smov w0, v\2.h\[0\]
> ** ret
> */
> unsigned
> @@ -31,10 +31,10 @@ f_hi (unsigned short *a)
> 
> /*
> ** f_si:
> -** ldr s([0-9]+), \[x0\]
> ** ptrue (p[0-7]).b, vl8
> -** cnt z\1.s, \2/m, z\1.s
> -** umov x0, v\1.d\[0\]
> +** ldr s([0-9]+), \[x0\]
> +** cnt z\2.s, \1/m, z\2.s
> +** umov x0, v\2.d\[0\]
> ** ret
> */
> unsigned
> diff --git a/gcc/testsuite/gcc.target/aarch64/pr117557.c b/gcc/testsuite/gcc.target/aarch64/pr117557.c
> index 80b3fde4110..858738e2cf5 100644
> --- a/gcc/testsuite/gcc.target/aarch64/pr117557.c
> +++ b/gcc/testsuite/gcc.target/aarch64/pr117557.c
> @@ -11,11 +11,12 @@
> /*
> **f:
> ** ...
> +** addvl x([0-9]+), x([0-9]+), #2
> +** ...
> ** ld1w z[0-9]+.s, p([0-9]+)/z, \[x[0-9]+, z[0-9]+.s, sxtw\]
> ** ld1w z[0-9]+.s, p([0-9]+)/z, \[x[0-9]+, z[0-9]+.s, sxtw\]
> -** st1w z[0-9]+.s, p\1, \[x[0-9]+, z[0-9]+.s, sxtw\]
> -** incb x([0-9]+), all, mul #2
> -** st1w z[0-9]+.s, p\2, \[x\3, z[0-9]+.s, sxtw\]
> +** st1w z[0-9]+.s, p\3, \[x\2, z[0-9]+.s, sxtw\]
> +** st1w z[0-9]+.s, p\4, \[x\1, z[0-9]+.s, sxtw\]
> ** ret
> ** ...
> */
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/noeffect2.c b/gcc/testsuite/gcc.target/aarch64/sve/noeffect2.c
> index 04b7eb993e3..c619647fee0 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sve/noeffect2.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/noeffect2.c
> @@ -13,10 +13,10 @@ int b[N] = {0};
> ** ...
> ** ld1w z[0-9]+\.s, p[0-9]+/z, \[x[0-9]+, x[0-9]+, lsl 2\]
> ** ld1w z[0-9]+\.s, p[0-9]+/z, \[x[0-9]+, x[0-9]+, lsl 2\]
> +** incw x[0-9]+
> ** cmpgt p[0-9]+\.s, p[0-9]+/z, z[0-9]+\.s, z[0-9]+\.s
> ** b\.any \.L[0-9]+
> ** ...
> -** incw x[0-9]+
> ** whilelo p[0-9]+\.s, w[0-9]+, w[0-9]+
> ** b\.any \.L[0-9]+
> ** mov w0, 0
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/args_1.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/args_1.c
> index b020a043523..ae481650d49 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/args_1.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/args_1.c
> @@ -6,18 +6,15 @@
> 
> /*
> ** callee_pred:
> -** brkpa (p[0-3])\.b, p0/z, p1\.b, p2\.b
> -** (
> -** ldr (p[0-3]), \[x0\]
> -** ldr (p[0-3]), \[x1\]
> -** brkpb (p[0-3])\.b, \1/z, \2\.b, \3\.b
> +** addvl sp, sp, #-1
> +** str p[0-9]+, \[sp\]
> +** ldr (p[0-9]+), \[x0\]
> +** brkpa (p[0-7])\.b, p0/z, p1\.b, p2\.b
> +** ldr (p[0-9]+), \[x1\]
> +** brkpb (p[0-7])\.b, \2/z, \1\.b, \3\.b
> ** brka p0\.b, \4/z, p3\.b
> -** |
> -** ldr (p[0-3]), \[x1\]
> -** ldr (p[0-3]), \[x0\]
> -** brkpb (p[0-3])\.b, \1/z, \6\.b, \5\.b
> -** brka p0\.b, \7/z, p3\.b
> -** )
> +** ldr p[0-9]+, \[sp\]
> +** addvl sp, sp, #1
> ** ret
> */
> __SVBool_t __attribute__((noipa, optimize("schedule-insns")))
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_4.c b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_4.c
> index c0120afe5d5..73af2a8a3ae 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_4.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_4.c
> @@ -12,6 +12,7 @@ extern void use(svbool_t);
> ** foo:
> ** ...
> ** ptrue p0.b, all
> +** mov z[0-9]+.h, w0
> ** cmplo p0.h, p0/z, z0.h, z[0-9]+.h
> ** ...
> */
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/widen_sum_1.c b/gcc/testsuite/gcc.target/aarch64/sve/widen_sum_1.c
> index 3ae9d14dafd..7aa6ee9f5af 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sve/widen_sum_1.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/widen_sum_1.c
> @@ -19,6 +19,7 @@
> ** cnth x[0-9]+
> ** ...
> ** ptrue (p[0-7])\.b, all
> +** ...
> ** mov (z[0-9]+\.h), #1
> ** ...
> ** ld1b (z[0-9]+\.h), \1/z, \[[^]]*\]
> @@ -36,6 +37,7 @@ DEF (sum_u8_long, unsigned char, long)
> ** cnth x[0-9]+
> ** ...
> ** ptrue (p[0-7])\.b, all
> +** ...
> ** mov (z[0-9]+\.h), #1
> ** ...
> ** ld1sb (z[0-9]+\.h), \1/z, \[[^]]*\]
> @@ -53,6 +55,7 @@ DEF (sum_s8_long, signed char, long)
> ** cntb x[0-9]+
> ** ...
> ** ptrue (p[0-7])\.b, all
> +** ...
> ** mov (z[0-9]+\.b), #1
> ** ...
> ** ld1b (z[0-9]+\.b), \1/z, \[[^]]*\]
> @@ -70,6 +73,7 @@ DEF (sum_u8_int, unsigned char, int)
> ** cntb x[0-9]+
> ** ...
> ** ptrue (p[0-7])\.b, all
> +** ...
> ** mov (z[0-9]+\.b), #1
> ** ...
> ** ld1b (z[0-9]+\.b), \1/z, \[[^]]*\]
> -- 
> 2.43.0
> 
> <0001-aarch64-Treat-all-SVE-as-basic-NEON-instructions-in-.patch>



More information about the Gcc-patches mailing list