diff mbox series

[1/2] testsuite: [arm/cde] Include arm_cde.h and arm_mve.h in arm_v8*m_main_cde*

Message ID 1587368859-5619-1-git-send-email-christophe.lyon@linaro.org
State New
Headers show
Series [1/2] testsuite: [arm/cde] Include arm_cde.h and arm_mve.h in arm_v8*m_main_cde* | expand

Commit Message

Christophe Lyon April 20, 2020, 7:47 a.m. UTC
Since arm_cde.h includes stdint.h, its use requires the presence of
the right gnu/stub-*.h, so make sure to include it when checking the
arm_v8*m_main_cde* effective targets, otherwise we can decide CDE is
supported while it's not really (all tests that use arm_v8m_main_cde*
also include arm_cde.h aynway).

Similarly for the effective targets that also require MVE.

This makes several tests unsupported rather than fail.
---
 gcc/testsuite/lib/target-supports.exp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Matthew Malcomson April 20, 2020, 11:24 a.m. UTC | #1
On 20/04/2020 08:47, Christophe Lyon via Gcc-patches wrote:
> Since arm_cde.h includes stdint.h, its use requires the presence of
> the right gnu/stub-*.h, so make sure to include it when checking the
> arm_v8*m_main_cde* effective targets, otherwise we can decide CDE is
> supported while it's not really (all tests that use arm_v8m_main_cde*
> also include arm_cde.h aynway).
> 
> Similarly for the effective targets that also require MVE.
> 
> This makes several tests unsupported rather than fail.

Hi Christophe,

This looks like a good idea to me -- though I'm not a maintainer so that 
means little ;-)

I just wanted to ask -- is this needed mainly if testing without a fully 
functional C99 environment?
I would imagine that a fully set up environment would have some sort of 
`stdint.h` available, even if not using the glibc gnu/stub-*.h files 
(e.g. using the newlib headers).

Cheers,
Matthew

> ---
>   gcc/testsuite/lib/target-supports.exp | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index d16498d..23a5abf 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -5140,21 +5140,25 @@ proc add_options_for_arm_v8_2a_bf16_neon { flags } {
>   #   /* { dg-add-options arm_v8m_main_cde } */
>   # The tests are valid for Arm.
>   
> -foreach { armfunc armflag armdef } {
> +foreach { armfunc armflag armdef arminc } {
>   	arm_v8m_main_cde
>   		"-march=armv8-m.main+cdecp0+cdecp6 -mthumb"
>   		"defined (__ARM_FEATURE_CDE)"
> +		""
>   	arm_v8m_main_cde_fp
>   		"-march=armv8-m.main+fp+cdecp0+cdecp6 -mthumb -mfpu=auto"
>   		"defined (__ARM_FEATURE_CDE) && defined (__ARM_FP)"
> +		""
>   	arm_v8_1m_main_cde_mve
>   		"-march=armv8.1-m.main+mve+cdecp0+cdecp6 -mthumb -mfpu=auto"
>   		"defined (__ARM_FEATURE_CDE) && defined (__ARM_FEATURE_MVE)"
> +		"#include <arm_mve.h>"
>   	arm_v8_1m_main_cde_mve_fp
>   		"-march=armv8.1-m.main+mve.fp+cdecp0+cdecp6 -mthumb -mfpu=auto"
>   		"defined (__ARM_FEATURE_CDE) || __ARM_FEATURE_MVE == 3"
> +		"#include <arm_mve.h>"
>   	} {
> -    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
> +    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef INC $arminc ] {
>   	proc check_effective_target_FUNC_ok_nocache { } {
>   	    global et_FUNC_flags
>   	    set et_FUNC_flags ""
> @@ -5167,6 +5171,8 @@ foreach { armfunc armflag armdef } {
>   		#if !(DEF)
>   		#error "DEF failed"
>   		#endif
> +		#include <arm_cde.h>
> +		INC
>   	    } "FLAG"] } {
>   		    set et_FUNC_flags "FLAG"
>   		    return 1
>
Christophe Lyon April 20, 2020, 11:50 a.m. UTC | #2
On Mon, 20 Apr 2020 at 13:25, Matthew Malcomson
<matthew.malcomson@arm.com> wrote:
>
> On 20/04/2020 08:47, Christophe Lyon via Gcc-patches wrote:
> > Since arm_cde.h includes stdint.h, its use requires the presence of
> > the right gnu/stub-*.h, so make sure to include it when checking the
> > arm_v8*m_main_cde* effective targets, otherwise we can decide CDE is
> > supported while it's not really (all tests that use arm_v8m_main_cde*
> > also include arm_cde.h aynway).
> >
> > Similarly for the effective targets that also require MVE.
> >
> > This makes several tests unsupported rather than fail.
>
> Hi Christophe,
>
> This looks like a good idea to me -- though I'm not a maintainer so that
> means little ;-)
>
> I just wanted to ask -- is this needed mainly if testing without a fully
> functional C99 environment?
> I would imagine that a fully set up environment would have some sort of
> `stdint.h` available, even if not using the glibc gnu/stub-*.h files
> (e.g. using the newlib headers).
>

That's the same problem as with my patches about the MVE tests: for
arm-linux-gnueabi[hf] toolchains,
glibc does not support multilibs, we can't have both soft[fp] and hard
versions in the same toolchain,
unlike arm-eabi. So stdint.h is present, but at some point it tries to
include the  version of gnu/stub-XXX.h
which is not part of the toolchain.


> Cheers,
> Matthew
>
> > ---
> >   gcc/testsuite/lib/target-supports.exp | 10 ++++++++--
> >   1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> > index d16498d..23a5abf 100644
> > --- a/gcc/testsuite/lib/target-supports.exp
> > +++ b/gcc/testsuite/lib/target-supports.exp
> > @@ -5140,21 +5140,25 @@ proc add_options_for_arm_v8_2a_bf16_neon { flags } {
> >   #   /* { dg-add-options arm_v8m_main_cde } */
> >   # The tests are valid for Arm.
> >
> > -foreach { armfunc armflag armdef } {
> > +foreach { armfunc armflag armdef arminc } {
> >       arm_v8m_main_cde
> >               "-march=armv8-m.main+cdecp0+cdecp6 -mthumb"
> >               "defined (__ARM_FEATURE_CDE)"
> > +             ""
> >       arm_v8m_main_cde_fp
> >               "-march=armv8-m.main+fp+cdecp0+cdecp6 -mthumb -mfpu=auto"
> >               "defined (__ARM_FEATURE_CDE) && defined (__ARM_FP)"
> > +             ""
> >       arm_v8_1m_main_cde_mve
> >               "-march=armv8.1-m.main+mve+cdecp0+cdecp6 -mthumb -mfpu=auto"
> >               "defined (__ARM_FEATURE_CDE) && defined (__ARM_FEATURE_MVE)"
> > +             "#include <arm_mve.h>"
> >       arm_v8_1m_main_cde_mve_fp
> >               "-march=armv8.1-m.main+mve.fp+cdecp0+cdecp6 -mthumb -mfpu=auto"
> >               "defined (__ARM_FEATURE_CDE) || __ARM_FEATURE_MVE == 3"
> > +             "#include <arm_mve.h>"
> >       } {
> > -    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
> > +    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef INC $arminc ] {
> >       proc check_effective_target_FUNC_ok_nocache { } {
> >           global et_FUNC_flags
> >           set et_FUNC_flags ""
> > @@ -5167,6 +5171,8 @@ foreach { armfunc armflag armdef } {
> >               #if !(DEF)
> >               #error "DEF failed"
> >               #endif
> > +             #include <arm_cde.h>
> > +             INC
> >           } "FLAG"] } {
> >                   set et_FUNC_flags "FLAG"
> >                   return 1
> >
>
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index d16498d..23a5abf 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5140,21 +5140,25 @@  proc add_options_for_arm_v8_2a_bf16_neon { flags } {
 #   /* { dg-add-options arm_v8m_main_cde } */
 # The tests are valid for Arm.
 
-foreach { armfunc armflag armdef } {
+foreach { armfunc armflag armdef arminc } {
 	arm_v8m_main_cde
 		"-march=armv8-m.main+cdecp0+cdecp6 -mthumb"
 		"defined (__ARM_FEATURE_CDE)"
+		""
 	arm_v8m_main_cde_fp
 		"-march=armv8-m.main+fp+cdecp0+cdecp6 -mthumb -mfpu=auto"
 		"defined (__ARM_FEATURE_CDE) && defined (__ARM_FP)"
+		""
 	arm_v8_1m_main_cde_mve
 		"-march=armv8.1-m.main+mve+cdecp0+cdecp6 -mthumb -mfpu=auto"
 		"defined (__ARM_FEATURE_CDE) && defined (__ARM_FEATURE_MVE)"
+		"#include <arm_mve.h>"
 	arm_v8_1m_main_cde_mve_fp
 		"-march=armv8.1-m.main+mve.fp+cdecp0+cdecp6 -mthumb -mfpu=auto"
 		"defined (__ARM_FEATURE_CDE) || __ARM_FEATURE_MVE == 3"
+		"#include <arm_mve.h>"
 	} {
-    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
+    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef INC $arminc ] {
 	proc check_effective_target_FUNC_ok_nocache { } {
 	    global et_FUNC_flags
 	    set et_FUNC_flags ""
@@ -5167,6 +5171,8 @@  foreach { armfunc armflag armdef } {
 		#if !(DEF)
 		#error "DEF failed"
 		#endif
+		#include <arm_cde.h>
+		INC
 	    } "FLAG"] } {
 		    set et_FUNC_flags "FLAG"
 		    return 1