On Tue, 23 Mar 2021 at 15:59, Kyrylo Tkachov <kyrylo.tkac...@arm.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Gcc-patches <gcc-patches-boun...@gcc.gnu.org> On Behalf Of
> > Christophe Lyon via Gcc-patches
> > Sent: 23 March 2021 14:33
> > To: gcc-patches@gcc.gnu.org
> > Subject: [PATCH 8/8] testsuite/arm: Add arm_dsp_ok effective target and
> > use it in arm/acle/dsp_arith.c
> >
> > gcc.target/arm/acle/dsp_arith.c uses DSP intrinsics, which arm_acle.h
> > defines only with __ARM_FEATURE_DSP, so make the test check for that
> > property rather than arm_qbit_ok.
> >
> > However, the existing arm_dsp effective target only checks if DSP
> > features are supported with the current multilib rather than trying
> > -march and -mfloat-abi options. Thus we introduce a similar effective
> > target, arm_dsp_ok and associated dg-add-options.
> >
> > This makes dsp_arith.c unsupported rather than failed when no option
> > combination is suitable, for instance when running the tests with
> > -mcpu=cortex-m3.
>
> Ok.
> Thanks for working on these,

Pushed, thanks for the quick review!

> Kyrill
>
> >
> > 2021-03-19  Christophe Lyon  <christophe.l...@linaro.org>
> >
> >       gcc/
> >       * doc/sourcebuild.texi (arm_dsp_ok, arm_dsp): Document.
> >
> >       gcc/testsuite/
> >       * lib/target-supports.exp
> >       (check_effective_target_arm_dsp_ok_nocache)
> >       (check_effective_target_arm_dsp_ok, add_options_for_arm_dsp):
> > New.
> >       * gcc.target/arm/acle/dsp_arith.c: Use arm_dsp_ok effective target
> >       and add arm_dsp options.
> > ---
> >  gcc/doc/sourcebuild.texi                      | 11 ++++++++
> >  gcc/testsuite/gcc.target/arm/acle/dsp_arith.c |  4 +--
> >  gcc/testsuite/lib/target-supports.exp         | 40
> > +++++++++++++++++++++++++++
> >  3 files changed, 53 insertions(+), 2 deletions(-)
> >
> > diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
> > index 1fa3656..2bc362b 100644
> > --- a/gcc/doc/sourcebuild.texi
> > +++ b/gcc/doc/sourcebuild.texi
> > @@ -2044,6 +2044,12 @@ ARM Target supports options suitable for
> > accessing the Q-bit manipulation
> >  intrinsics from @code{arm_acle.h}.
> >  Some multilibs may be incompatible with these options.
> >
> > +@item arm_dsp_ok
> > +@anchor{arm_dsp_ok}
> > +ARM Target supports options suitable for accessing the DSP intrinsics
> > +from @code{arm_acle.h}.
> > +Some multilibs may be incompatible with these options.
> > +
> >  @item arm_softfp_ok
> >  @anchor{arm_softfp_ok}
> >  ARM target supports the @code{-mfloat-abi=softfp} option.
> > @@ -2778,6 +2784,11 @@ Add options to enable generation of the
> > @code{VFMAL} and @code{VFMSL}
> >  instructions, if this is supported by the target; see the
> >  @ref{arm_fp16fml_neon_ok} effective target keyword.
> >
> > +@item arm_dsp
> > +Add options for ARM DSP intrinsics support, if this is supported by
> > +the target; see the @ref{arm_dsp_ok,,arm_dsp_ok effective target
> > +keyword}.
> > +
> >  @item bind_pic_locally
> >  Add the target-specific flags needed to enable functions to bind
> >  locally when using pic/PIC passes in the testsuite.
> > diff --git a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
> > b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
> > index 9ebd55a..7bf458e 100644
> > --- a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
> > +++ b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c
> > @@ -1,6 +1,6 @@
> >  /* { dg-do compile } */
> > -/* { dg-require-effective-target arm_qbit_ok } */
> > -/* { dg-add-options arm_qbit  } */
> > +/* { dg-require-effective-target arm_dsp_ok } */
> > +/* { dg-add-options arm_dsp } */
> >
> >  #include <arm_acle.h>
> >
> > diff --git a/gcc/testsuite/lib/target-supports.exp 
> > b/gcc/testsuite/lib/target-
> > supports.exp
> > index 1af7619..733b6c8 100644
> > --- a/gcc/testsuite/lib/target-supports.exp
> > +++ b/gcc/testsuite/lib/target-supports.exp
> > @@ -4200,6 +4200,46 @@ proc add_options_for_arm_qbit { flags } {
> >      return "$flags $et_arm_qbit_flags"
> >  }
> >
> > +# Return 1 if this is an ARM target supporting the DSP intrinsics from
> > +# arm_acle.h.  Some multilibs may be incompatible with these options.
> > +# Also set et_arm_dsp_flags to the best options to add.
> > +# arm_acle.h includes stdint.h which can cause trouble with incompatible
> > +# -mfloat-abi= options.
> > +# check_effective_target_arm_dsp also exists, which checks the current
> > +# multilib, without trying other options.
> > +
> > +proc check_effective_target_arm_dsp_ok_nocache { } {
> > +    global et_arm_dsp_flags
> > +    set et_arm_dsp_flags ""
> > +    foreach flags {"" "-march=armv5te" "-march=armv5te -mfloat-
> > abi=softfp" "-march=armv5te -mfloat-abi=hard"} {
> > +      if { [check_no_compiler_messages_nocache et_arm_dsp_ok object {
> > +     #include <arm_acle.h>
> > +     int dummy;
> > +     #ifndef __ARM_FEATURE_DSP
> > +     #error not DSP
> > +     #endif
> > +      } "$flags"] } {
> > +     set et_arm_dsp_flags $flags
> > +     return 1
> > +      }
> > +    }
> > +
> > +  return 0
> > +}
> > +
> > +proc check_effective_target_arm_dsp_ok { } {
> > +    return [check_cached_effective_target et_arm_dsp_flags \
> > +             check_effective_target_arm_dsp_ok_nocache]
> > +}
> > +
> > +proc add_options_for_arm_dsp { flags } {
> > +    if { ! [check_effective_target_arm_dsp_ok] } {
> > +     return "$flags"
> > +    }
> > +    global et_arm_dsp_flags
> > +    return "$flags $et_arm_dsp_flags"
> > +}
> > +
> >  # Return 1 if this is an ARM target supporting -mfpu=neon without any
> >  # -mfloat-abi= option.  Useful in tests where add_options is not
> >  # supported (such as lto tests).
> > --
> > 2.7.4
>

Reply via email to