> -----Original Message-----
> From: Alfie Richards <[email protected]>
> Sent: 05 October 2026 13:55
> To: [email protected]
> Cc: Tamar Christina <[email protected]>; [email protected]; Alfie
> Richards <[email protected]>
> Subject: [PATCH v2] aarch64: Add --param=aarch64-autovec-mode
> 
> Allows forcing the autovec mode for testing and debugging purposes.
> 
> gcc/ChangeLog:
> 
>       * config/aarch64/aarch64.cc (aarch64_autovectorize_vector_modes):
>       All logic to only use aarch64-autovec-mode when specified.
>       * config/aarch64/aarch64.opt: Add --param=aarch64-autovec-mode.
>       * doc/params.texi: Document  --param=aarch64-autovec-mode.
> ---
>  gcc/config/aarch64/aarch64.cc  |  6 ++++++
>  gcc/config/aarch64/aarch64.opt | 34
> ++++++++++++++++++++++++++++++++++
>  gcc/doc/params.texi            |  4 ++++
>  3 files changed, 44 insertions(+)
> 
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 107271b0404..6693cec98bd 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -24187,6 +24187,12 @@ aarch64_autovectorize_vector_modes
> (vector_modes *modes, bool)
>      V2SImode
>    };
> 
> +  if (aarch64_force_autovec_mode != VOIDmode)
> +    {
> +      modes->safe_push (aarch64_force_autovec_mode);
> +      return 0;
> +    }
> +
>    /* Try using N-byte SVE modes only after trying N-byte Advanced SIMD
> mode.
>       This is because:
> 
> diff --git a/gcc/config/aarch64/aarch64.opt
> b/gcc/config/aarch64/aarch64.opt
> index deccc6c8887..6f22e0e7326 100644
> --- a/gcc/config/aarch64/aarch64.opt
> +++ b/gcc/config/aarch64/aarch64.opt
> @@ -406,6 +406,40 @@ Enum(aarch64_autovec_preference) String(prefer-
> asimd) Value(AARCH64_AUTOVEC_PREF
>  EnumValue
>  Enum(aarch64_autovec_preference) String(prefer-sve)
> Value(AARCH64_AUTOVEC_PREFER_SVE)
> 
> +-param=aarch64-autovec-mode=
> +Target Joined Var(aarch64_force_autovec_mode)
> Enum(aarch64_autovec_mode) Init(VOIDmode) Param
> +Force a specific mode to be the only one considered for auto vectorization.
> +
> +If this is specified in addition to --param=aarch64-autovec-preference or
> +-mautovec-preference then this takes priority.
> +
> +Enum
> +Name(aarch64_autovec_mode) Type(machine_mode)
> UnknownError(unknown machine mode %qs)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(VNx16QI) Value(VNx16QImode)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(VNx8QI) Value(VNx8QImode)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(VNx4QI) Value(VNx4QImode)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(VNx2QI) Value(VNx2QImode)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(V16QI) Value(V16QImode)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(V8QI) Value(V8QImode)
> +
> +EnumValue
> +Enum(aarch64_autovec_mode) String(V4QI) Value(V4QImode)
> +

This should be V4HI

> +EnumValue
> +Enum(aarch64_autovec_mode) String(V2QI) Value(V2QImode)
> +

And this V2SI.

To match the existing Adv. SIMD modes that are returned from
the hook and since we don't really support arithmetic on the
sub 64-bit modes you have.

Patch is OK with those changes.

Thanks,
Tamar

>  -param=aarch64-loop-vect-issue-rate-niters=
>  Target Joined UInteger Var(aarch64_loop_vect_issue_rate_niters) Init(6)
> IntegerRange(0, 65536) Param
> 
> diff --git a/gcc/doc/params.texi b/gcc/doc/params.texi
> index e69be2d2923..8d8e5926cb1 100644
> --- a/gcc/doc/params.texi
> +++ b/gcc/doc/params.texi
> @@ -2027,6 +2027,10 @@ An old alias for @option{-mautovec-preference}.
> If both
>  @option{-mautovec-preference} and @option{--param=aarch64-autovec-
> preference}
>  are passed, the @option{--param} value is used.
> 
> +@paindex aarch64-autovec-mode
> +@item aarch64-autovec-preference
> +Force a specific mode to be the only one considered for auto vectorization.
> +
>  @paindex aarch64-ldp-policy
>  @item aarch64-ldp-policy
>  Fine-grained policy for load pair (@code{stp}) instructions.
> --
> 2.55.0

Reply via email to