[PATCH 07/17] testsuite: arm: Use effective-target for {gcc, g++}.target/arm/ tests

Torbjorn SVENSSON torbjorn.svensson@foss.st.com
Thu Nov 21 07:01:32 GMT 2024



On 2024-11-19 17:24, Richard Earnshaw (lists) wrote:
> On 19/11/2024 10:23, Torbjörn SVENSSON wrote:
>> Update test cases to use -mcpu=unset/-march=unset feature introduced in
>> r15-3606-g7d6c6a0d15c.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 	* g++.target/arm/pr103676.C: Use effective-target
>> 	arm_cpu_cortex_m7.
>> 	* gcc.target/arm/no-volatile-in-it.c: Likewise.
>> 	* gcc.target/arm/fma-sp.c: Use effective-target
>> 	arm_cpu_cortex_m4.
>> 	* gcc.target/arm/pr53859.c: Likewise.
>> 	* gcc.target/arm/mve/intrinsics/pr97327.c: Use effective-target
>> 	arm_cpu_cortex_m55.
>> 	* gcc.target/arm/pr65067.c: Use effective-target
>> 	arm_cpu_cortex_m3.
>> 	* lib/target-supports.exp: Define effective-target
>> 	arm_cpu_cortex_m3, arm_cpu_cortex_m4, arm_cpu_cortex_m7 and
>> 	arm_cpu_cortex_m55.
>>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>> ---
>>   gcc/testsuite/g++.target/arm/pr103676.C               | 5 ++++-
>>   gcc/testsuite/gcc.target/arm/fma-sp.c                 | 8 +++-----
>>   gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c | 7 ++++---
>>   gcc/testsuite/gcc.target/arm/no-volatile-in-it.c      | 5 +++--
>>   gcc/testsuite/gcc.target/arm/pr53859.c                | 4 +++-
>>   gcc/testsuite/gcc.target/arm/pr65067.c                | 4 +++-
>>   gcc/testsuite/lib/target-supports.exp                 | 4 ++++
>>   7 files changed, 24 insertions(+), 13 deletions(-)
>>
>> diff --git a/gcc/testsuite/g++.target/arm/pr103676.C b/gcc/testsuite/g++.target/arm/pr103676.C
>> index 1607564ff5d..1e5711626f8 100644
>> --- a/gcc/testsuite/g++.target/arm/pr103676.C
>> +++ b/gcc/testsuite/g++.target/arm/pr103676.C
>> @@ -1,6 +1,9 @@
>>   /* { dg-do compile } */
>> +/* { dg-require-effective-target arm_cpu_cortex_m7_ok } */
>>   /* { dg-require-effective-target arm_thumb1_ok } */
> 
> This shouldn't be needed.
> 
>> -/* { dg-additional-options "-mcpu=cortex-m7 -mthumb -O2" }  */
>> +/* { dg-additional-options "-O2" }  */
>> +/* { dg-add-options arm_cpu_cortex_m7 } */
>> +
>>   
>>   typedef unsigned long long uint64_t;
>>   struct timer {
>> diff --git a/gcc/testsuite/gcc.target/arm/fma-sp.c b/gcc/testsuite/gcc.target/arm/fma-sp.c
>> index e1884545f0d..539628d5d26 100644
>> --- a/gcc/testsuite/gcc.target/arm/fma-sp.c
>> +++ b/gcc/testsuite/gcc.target/arm/fma-sp.c
>> @@ -1,9 +1,7 @@
>>   /* { dg-do compile } */
>> -/* { dg-skip-if "avoid conflicts with multilib options" { ! arm_thumb2_ok } { "-march=*" } { "" } } */
>> -/* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mcpu=*" } { "-mcpu=cortex-m4" } } */
>> -/* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mfpu=*" } { "-mfpu=fpv4-sp-d16" } } */
>> -/* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" } } */
>> -/* { dg-options "-O2 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mthumb -mfloat-abi=hard" } */
>> +/* { dg-require-effective-target arm_cpu_cortex_m4_ok } */
>> +/* { dg-options "-O2 -mfpu=fpv4-sp-d16 -mfloat-abi=hard" } */
>> +/* { dg-add-options arm_cpu_cortex_m4 } */
> 
> I'd add an arm_cpu_cortex_m4_hard entry for this (see below as well); then you only need "-O2" in dg-options.
> 
>>   
>>   #include "fma.h"
>>   
>> diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c
>> index d19bde59266..34b7af6022b 100644
>> --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c
>> +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c
>> @@ -1,6 +1,7 @@
>> -/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
>> -/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=hard" } { "" } } */
>> -/* { dg-additional-options "-mcpu=cortex-m55 -mthumb -mfloat-abi=soft -mfpu=auto -Werror" } */
>> +/* { dg-do compile } */
>> +/* { dg-require-effective-target arm_cpu_cortex_m55_ok } */
>> +/* { dg-additional-options "-mfloat-abi=soft -mfpu=auto -Werror" } */
>> +/* { dg-add-options arm_cpu_cortex_m55 } */
> 
> This test is a bit tricky.  The original bug report talks of a false warning when cortex-m55, armv8.1-m.main+mve and soft ABI were used together, though I think -mcpu=cortex-m55 -mfloat-abi=soft was enough.  I think it should be enough if arm_cpu_cortex_m55 uses -mfpu=auto so you don't need it in dg-additional-options, but you do need an explicit "-mfloat-abi=soft -Werror": I'd put these *after* the dg-add-options, though, just to be on the safe side.
> 
> 
>>   
>>   int main ()
>>   {
>> diff --git a/gcc/testsuite/gcc.target/arm/no-volatile-in-it.c b/gcc/testsuite/gcc.target/arm/no-volatile-in-it.c
>> index 6f3664d3b3d..119e9ecf321 100644
>> --- a/gcc/testsuite/gcc.target/arm/no-volatile-in-it.c
>> +++ b/gcc/testsuite/gcc.target/arm/no-volatile-in-it.c
>> @@ -1,7 +1,8 @@
>>   /* { dg-do compile } */
>> +/* { dg-require-effective-target arm_cpu_cortex_m7_ok } */
>>   /* { dg-require-effective-target arm_thumb2_ok } */
>> -/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-march=*" "-mcpu=*" } { "-mcpu=cortex-m7" } } */
>> -/* { dg-options "-Os -mthumb -mcpu=cortex-m7" } */
>> +/* { dg-options "-Os" } */
>> +/* { dg-add-options arm_cpu_cortex_m7 } */
>>   
> 
> OK.
> 
>>   int
>>   foo (int a, int b, volatile int *c, volatile int *d)
>> diff --git a/gcc/testsuite/gcc.target/arm/pr53859.c b/gcc/testsuite/gcc.target/arm/pr53859.c
>> index 003489e0bb7..46ae40b67fa 100644
>> --- a/gcc/testsuite/gcc.target/arm/pr53859.c
>> +++ b/gcc/testsuite/gcc.target/arm/pr53859.c
>> @@ -1,7 +1,9 @@
>>   /* PR target/53859 */
>>   /* { dg-do compile } */
>> +/* { dg-require-effective-target arm_cpu_cortex_m4_ok } */
>>   /* { dg-require-effective-target arm_thumb2_ok } */
> This shouldn't be needed.
> 
>> -/* { dg-options "-mcpu=cortex-m4 -mthumb -O2" } */
>> +/* { dg-options "-O2" } */
>> +/* { dg-add-options arm_cpu_cortex_m4 } */
>>   
>>   void bar (int,int,char* ,int);
>>   
>> diff --git a/gcc/testsuite/gcc.target/arm/pr65067.c b/gcc/testsuite/gcc.target/arm/pr65067.c
>> index 05da29483f6..a2ec7450c0b 100644
>> --- a/gcc/testsuite/gcc.target/arm/pr65067.c
>> +++ b/gcc/testsuite/gcc.target/arm/pr65067.c
>> @@ -1,6 +1,8 @@
>>   /* { dg-do compile } */
>> +/* { dg-require-effective-target arm_cpu_cortex_m3_ok } */
>>   /* { dg-require-effective-target arm_thumb2_ok } */
> 
> Or here
> 
>> -/* { dg-options "-mthumb -mcpu=cortex-m3 -O2" } */
>> +/* { dg-options "-O2" } */
>> +/* { dg-add-options arm_cpu_cortex_m3 } */
>>   
>>   struct tmp {
>>    unsigned int dummy;
>> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
>> index d973b1863bd..30e453a578a 100644
>> --- a/gcc/testsuite/lib/target-supports.exp
>> +++ b/gcc/testsuite/lib/target-supports.exp
>> @@ -5849,7 +5849,11 @@ foreach { armfunc armflag armdefs } {
>>   	    xscale_arm "-mcpu=xscale -mfloat-abi=soft -marm" "__XSCALE__ && !__thumb__"
>>   	    cortex_a57 "-mcpu=cortex-a57" __ARM_ARCH_8A__
>>   	    cortex_m0 "-mcpu=cortex-m0 -mfloat-abi=soft -mthumb" "__ARM_ARCH_6M__ && __thumb__"
>> +	    cortex_m3 "-mcpu=cortex-m3 -mfloat-abi=soft -mthumb" "__ARM_ARCH_7M__"
>> +	    cortex_m4 "-mcpu=cortex-m4 -mthumb" "__ARM_ARCH_7EM__"
>> +	    cortex_m7 "-mcpu=cortex-m7 -mthumb" "__ARM_ARCH_7EM__"
>>   	    cortex_m23 "-mcpu=cortex-m23 -mfloat-abi=soft -mthumb" "__ARM_ARCH_8M_BASE__  && __thumb__"
>> +	    cortex_m55 "-mcpu=cortex-m55 -mthumb" "__ARM_ARCH_8M_MAIN__  && __thumb__"
> 
> All of these, except cortex-m3 should add -mfpu=auto so that we pick up the FPU from the CPU configuration.
> 
>>   	} {
>>       eval [string map [list FUNC $armfunc FLAG $armflag DEFS $armdefs ] {
>>   	proc check_effective_target_arm_cpu_FUNC_ok { } {
> 
> OK with the above changes.

Pushed as r15-5543-g3192c1df360.

Kind regards,
Torbjörn

> 
> R.
> 



More information about the Gcc-patches mailing list