> >> +param value will be used. > >> + > >> @opindex march > >> @item -march=@var{name} > >> Specify the name of the target architecture and, optionally, one or > > > > --params are supposed to be internal developer flags that could go away > > at any time. So now that we have the user-facing flag, I think we should > > move the detailed documentation of @var{name} from the --param > documentation > > to the -m option, and instead make the --param documentation reference the > > -m option. > > … in addition I’d like us to continue with our design that “-mcpu=<CPU>” > should be > the recommended flag to get the best performance out of the CPU for the end > user. > With promoting this flag to -m* status I’d like to avoid it proliferating in > users > makefiles who may mistakenly think they need it for production. > So can we add a note to the documentation saying that this is intended for > performance exploration or something like that? > > Thanks, > Kyrill > > > > > > So something like: > > > > -------------------------------------------------------------------------- > > @item -mautovec-preference=@var{name} > > Force an ISA selection strategy for auto-vectorization. The possible > > values of @var{name} are: > > @table @samp > > @item default > > Use the default heuristics. > > @item asimd-only > > Use only Advanced SIMD for auto-vectorization. > > @item sve-only > > Use only SVE for auto-vectorization. > > @item prefer-asimd > > Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are > > deemed equal. > > @item prefer-sve > > Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal. > > @end table > > > > ... > > > > @item aarch64-autovec-preference > > An old alias for @option{-mautovec-preference}. If both > > @option{-mautovec-preference} and @option{--param=aarch64_autovec- > preference} > > are passed, the @option{--param} value will be used. > > -------------------------------------------------------------------------- > > > > (with the -m option deliberately not mentioning the --param) > > > > Same idea for the .opt documentation. > > > > Richard
Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_override_options_internal): Set value of parameter based on option. * config/aarch64/aarch64.opt (autovec-preference): New. * doc/invoke.texi (autovec-preference): Document it. gcc/testsuite/ChangeLog: * gcc.target/aarch64/autovec_param_asimd-only_2.c: New test. * gcc.target/aarch64/autovec_param_default_2.c: New test. * gcc.target/aarch64/autovec_param_prefer-asimd_2.c: New test. * gcc.target/aarch64/autovec_param_prefer-sve_2.c: New test. * gcc.target/aarch64/autovec_param_sve-only_2.c: New test. -- inline copy of patch -- diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index f11f0da28915f49829360cd7a6269e2a3f67a860..44eabb4f40262db9891e3bf501ec1cd049b3b294 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -18979,6 +18979,14 @@ aarch64_override_options_internal (struct gcc_options *opts) SET_OPTION_IF_UNSET (opts, &global_options_set, param_vect_scalar_cost_multiplier, 10000); + /* Synchronize the -mautovec-preference and aarch64_autovec_preference using + whichever one is not default. If both are set then prefer the param flag + over the parameters. */ + if (opts->x_autovec_preference != AARCH64_AUTOVEC_DEFAULT) + SET_OPTION_IF_UNSET (opts, &global_options_set, + aarch64_autovec_preference, + opts->x_autovec_preference); + aarch64_override_options_after_change_1 (opts); } diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt index 17e1c700dd2b85e28012f3994d63f701656c5efb..6b1087bb94d3ef10d95decaa1de8e2b1054989b0 100644 --- a/gcc/config/aarch64/aarch64.opt +++ b/gcc/config/aarch64/aarch64.opt @@ -290,6 +290,13 @@ msve-vector-bits= Target RejectNegative Joined Enum(sve_vector_bits) Var(aarch64_sve_vector_bits) Init(SVE_SCALABLE) -msve-vector-bits=<number> Set the number of bits in an SVE vector register. +mautovec-preference= +Target RejectNegative Joined Var(autovec_preference) Enum(aarch64_autovec_preference) Init(AARCH64_AUTOVEC_DEFAULT) +-mautovec-preference=[default|asimd-only|sve-only|prefer-asimd|prefer-sve] +Force an ISA selection strategy for auto-vectorization. For best performance it +is highly recommended to use -mcpu or -mtune instead. This parameter should +only be used for code exploration. + mmax-vectorization Target Var(flag_aarch64_max_vectorization) Save Override the scalar cost model such that vectorization is always profitable. @@ -360,8 +367,8 @@ The number of Newton iterations for calculating the reciprocal for double type. -param=aarch64-autovec-preference= Target Joined Var(aarch64_autovec_preference) Enum(aarch64_autovec_preference) Init(AARCH64_AUTOVEC_DEFAULT) Param ---param=aarch64-autovec-preference=[default|asimd-only|sve-only|prefer-asimd|prefer-sve] -Force an ISA selection strategy for auto-vectorization. +An old alias for -mautovec-preference. If both -mautovec-preference and +--param=aarch64_autovec-preference are passed, the --param value will be used. Enum Name(aarch64_autovec_preference) Type(enum aarch64_autovec_preference_enum) UnknownError(unknown autovec preference %qs) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2233c7fdcccc75855e60d8b71c4e1d3506a45a53..05527e64d9d96962d0c485e455884a92f9bd4556 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -17517,20 +17517,9 @@ The precision of division is proportional to this param when division approximation is enabled. The default value is 2. @item aarch64-autovec-preference -Force an ISA selection strategy for auto-vectorization. -@table @samp -@item default -Use the default heuristics. -@item asimd-only -Use only Advanced SIMD for auto-vectorization. -@item sve-only -Use only SVE for auto-vectorization. -@item prefer-asimd -Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are -deemed equal. -@item prefer-sve -Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal. -@end table +An old alias for @option{-mautovec-preference}. If both +@option{-mautovec-preference} and @option{--param=aarch64_autovec-preference} +are passed, the @option{--param} value will be used. @item aarch64-ldp-policy Fine-grained policy for load pairs. @@ -21993,6 +21982,27 @@ used for auto-vectorization. Unlike @option{-fno-vect-cost-model} or @option{-fvect-cost-model=unlimited} this option does not turn off cost comparison between different vector modes. +@item -mautovec-preference=@var{name} +Force an ISA selection strategy for auto-vectorization. The possible +values of @var{name} are: +@table @samp +@item default +Use the default heuristics. +@item asimd-only +Use only Advanced SIMD for auto-vectorization. +@item sve-only +Use only SVE for auto-vectorization. +@item prefer-asimd +Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are +deemed equal. +@item prefer-sve +Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal. +@end table + +For best performance it is highly recommended to use @option{-mcpu} or +@option{-mtune} instead. This parameter should only be used for code +exploration. + @opindex march @item -march=@var{name} Specify the name of the target architecture and, optionally, one or diff --git a/gcc/testsuite/gcc.target/aarch64/autovec_param_asimd-only_2.c b/gcc/testsuite/gcc.target/aarch64/autovec_param_asimd-only_2.c new file mode 100644 index 0000000000000000000000000000000000000000..6aeac0b76f4bbdbb6dbaccfdfd061f004f031a21 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/autovec_param_asimd-only_2.c @@ -0,0 +1,4 @@ +/* { dg-options "-mautovec-preference=asimd-only" } */ + +void +foo (void) {} diff --git a/gcc/testsuite/gcc.target/aarch64/autovec_param_default_2.c b/gcc/testsuite/gcc.target/aarch64/autovec_param_default_2.c new file mode 100644 index 0000000000000000000000000000000000000000..589cc502fdadc98e10a81382de1fe2dd42b67321 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/autovec_param_default_2.c @@ -0,0 +1,4 @@ +/* { dg-options "-mautovec-preference=default" } */ + +void +foo (void) {} diff --git a/gcc/testsuite/gcc.target/aarch64/autovec_param_prefer-asimd_2.c b/gcc/testsuite/gcc.target/aarch64/autovec_param_prefer-asimd_2.c new file mode 100644 index 0000000000000000000000000000000000000000..ad89786499264a3c85edfd052b07a76af4a4e7fc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/autovec_param_prefer-asimd_2.c @@ -0,0 +1,4 @@ +/* { dg-options "-mautovec-preference=prefer-asimd" } */ + +void +foo (void) {} diff --git a/gcc/testsuite/gcc.target/aarch64/autovec_param_prefer-sve_2.c b/gcc/testsuite/gcc.target/aarch64/autovec_param_prefer-sve_2.c new file mode 100644 index 0000000000000000000000000000000000000000..2acea69e056d3cbb4be5649efeb3905e9117788d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/autovec_param_prefer-sve_2.c @@ -0,0 +1,4 @@ +/* { dg-options "-mautovec-preference=prefer-sve" } */ + +void +foo (void) {} diff --git a/gcc/testsuite/gcc.target/aarch64/autovec_param_sve-only_2.c b/gcc/testsuite/gcc.target/aarch64/autovec_param_sve-only_2.c new file mode 100644 index 0000000000000000000000000000000000000000..a7df0ebda8076f21152a405dc7fffc9022643659 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/autovec_param_sve-only_2.c @@ -0,0 +1,4 @@ +/* { dg-options "-mautovec-preference=sve-only" } */ + +void +foo (void) {}
rb19498.patch
Description: rb19498.patch