diff mbox series

testsuite: arm: Use effective-target for unsigned-extend-1.c

Message ID 20241108184705.2663932-1-torbjorn.svensson@foss.st.com
State New
Headers show
Series testsuite: arm: Use effective-target for unsigned-extend-1.c | expand

Commit Message

Torbjorn SVENSSON Nov. 8, 2024, 6:47 p.m. UTC
Ok for trunk and releases/gcc-14?

--

A long time ago, this test forced -march=armv6.

With -marm, the generated assembler is:
foo:
        sub     r0, r0, #48
        cmp     r0, #9
        movhi   r0, #0
        movls   r0, #1
        bx      lr

With -mthumb, the generated assembler is:
foo:
        subs    r0, r0, #48
        movs    r2, #9
        uxtb    r3, r0
        movs    r0, #0
        cmp     r2, r3
        adcs    r0, r0, r0
        uxtb    r0, r0
        bx      lr

Require effective-target arm_arm_ok to skip the test for thumb-only
targets (Cortex-M).

gcc/testsuite/ChangeLog:

	* gcc.target/arm/unsigned-extend-1.c: Use effective-target
	arm_arm_ok.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gcc/testsuite/gcc.target/arm/unsigned-extend-1.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christophe Lyon Nov. 14, 2024, 3:32 p.m. UTC | #1
On Fri, 8 Nov 2024 at 19:49, Torbjörn SVENSSON
<torbjorn.svensson@foss.st.com> wrote:
>
> Ok for trunk and releases/gcc-14?
>
> --
>
> A long time ago, this test forced -march=armv6.
>
> With -marm, the generated assembler is:
> foo:
>         sub     r0, r0, #48
>         cmp     r0, #9
>         movhi   r0, #0
>         movls   r0, #1
>         bx      lr
>
> With -mthumb, the generated assembler is:
> foo:
>         subs    r0, r0, #48
>         movs    r2, #9
>         uxtb    r3, r0
>         movs    r0, #0
>         cmp     r2, r3
>         adcs    r0, r0, r0
>         uxtb    r0, r0
>         bx      lr
>
> Require effective-target arm_arm_ok to skip the test for thumb-only
> targets (Cortex-M).
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/arm/unsigned-extend-1.c: Use effective-target
>         arm_arm_ok.
>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
>  gcc/testsuite/gcc.target/arm/unsigned-extend-1.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c b/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
> index 3b4ab048fb0..73f2e1a556d 100644
> --- a/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
> +++ b/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target arm_arm_ok } */
>  /* { dg-options "-O2" } */
>

So I'm guessing arm_arm_ok fails when you are testing for M-profile targets?
What happens when you test for A-profile, providing -mthumb as part of
your runtest flags?
Since you don't add -marm, the test will be compiled in Thumb mode,
and still fail?

Thanks,

Christophe

>  unsigned char foo (unsigned char c)
> --
> 2.25.1
>
Torbjorn SVENSSON Nov. 14, 2024, 4:16 p.m. UTC | #2
On 2024-11-14 16:32, Christophe Lyon wrote:
> On Fri, 8 Nov 2024 at 19:49, Torbjörn SVENSSON
> <torbjorn.svensson@foss.st.com> wrote:
>>
>> Ok for trunk and releases/gcc-14?
>>
>> --
>>
>> A long time ago, this test forced -march=armv6.
>>
>> With -marm, the generated assembler is:
>> foo:
>>          sub     r0, r0, #48
>>          cmp     r0, #9
>>          movhi   r0, #0
>>          movls   r0, #1
>>          bx      lr
>>
>> With -mthumb, the generated assembler is:
>> foo:
>>          subs    r0, r0, #48
>>          movs    r2, #9
>>          uxtb    r3, r0
>>          movs    r0, #0
>>          cmp     r2, r3
>>          adcs    r0, r0, r0
>>          uxtb    r0, r0
>>          bx      lr
>>
>> Require effective-target arm_arm_ok to skip the test for thumb-only
>> targets (Cortex-M).
>>
>> gcc/testsuite/ChangeLog:
>>
>>          * gcc.target/arm/unsigned-extend-1.c: Use effective-target
>>          arm_arm_ok.
>>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>> ---
>>   gcc/testsuite/gcc.target/arm/unsigned-extend-1.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c b/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
>> index 3b4ab048fb0..73f2e1a556d 100644
>> --- a/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
>> +++ b/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
>> @@ -1,4 +1,5 @@
>>   /* { dg-do compile } */
>> +/* { dg-require-effective-target arm_arm_ok } */
>>   /* { dg-options "-O2" } */
>>
> 
> So I'm guessing arm_arm_ok fails when you are testing for M-profile targets?
> What happens when you test for A-profile, providing -mthumb as part of
> your runtest flags?



For Cortex-M0 (thumb/cpu=cortex-m0/float-abi=soft):

Testing arm/unsigned-extend-1.c
check_compile tool: gcc for arm_arm_ok
doing compile
Executing on host: .../bin/arm-none-eabi-gcc  arm_arm_ok21114.c  -mthumb 
-mcpu=cortex-m0 -mfloat-abi=soft   -fdiagnostics-plain-output  -marm 
-Wno-complain-wrong-lang -S     -o arm_arm_ok21114.s    (timeout = 800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc arm_arm_ok21114.c -mthumb 
-mcpu=cortex-m0 -mfloat-abi=soft -fdiagnostics-plain-output -marm 
-Wno-complain-wrong-lang -S -o arm_arm_ok21114.s
pid is 21254 -21254
cc1: error: target CPU does not support ARM mode
pid is -1
close result is 21254 exp6 0 1
output is cc1: error: target CPU does not support ARM mode
  status 1
compiler exited with status 1
UNSUPPORTED: gcc.target/arm/unsigned-extend-1.c


For Cortex-A7 (thumb/cpu=cortex-a7/float-abi=soft):

Testing arm/unsigned-extend-1.c
check_compile tool: gcc for arm_arm_ok
doing compile
Executing on host: .../bin/arm-none-eabi-gcc  arm_arm_ok21296.c  -mthumb 
-mcpu=cortex-a7 -mfloat-abi=soft   -fdiagnostics-plain-output  -marm 
-Wno-complain-wrong-lang -S     -o arm_arm_ok21296.s    (timeout = 800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc arm_arm_ok21296.c -mthumb 
-mcpu=cortex-a7 -mfloat-abi=soft -fdiagnostics-plain-output -marm 
-Wno-complain-wrong-lang -S -o arm_arm_ok21296.s
pid is 21434 -21434
pid is -1
output is  status 0
doing compile
Executing on host: .../bin/arm-none-eabi-gcc 
.../gcc/testsuite/gcc.target/arm/unsigned-extend-1.c  -mthumb 
-mcpu=cortex-a7 -mfloat-abi=soft   -fdiagnostics-plain-output  -O2 
-ffat-lto-objects -fno-ident -S     -o unsigned-extend-1.s    (timeout = 
800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc 
.../gcc/testsuite/gcc.target/arm/unsigned-extend-1.c -mthumb 
-mcpu=cortex-a7 -mfloat-abi=soft -fdiagnostics-plain-output -O2 
-ffat-lto-objects -fno-ident -S -o unsigned-extend-1.s
pid is 21438 -21438
pid is -1
output is  status 0
check_compile tool: gcc for exceptions_enabled
doing compile
Executing on host: .../bin/arm-none-eabi-gcc  exceptions_enabled21296.cc 
  -mthumb -mcpu=cortex-a7 -mfloat-abi=soft   -fdiagnostics-plain-output 
-Wno-complain-wrong-lang -S     -o exceptions_enabled21296.s    (timeout 
= 800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc 
exceptions_enabled21296.cc -mthumb -mcpu=cortex-a7 -mfloat-abi=soft 
-fdiagnostics-plain-output -Wno-complain-wrong-lang -S -o 
exceptions_enabled21296.s
pid is 21442 -21442
pid is -1
output is  status 0
PASS: gcc.target/arm/unsigned-extend-1.c (test for excess errors)
PASS: gcc.target/arm/unsigned-extend-1.c scan-assembler-not uxtb

For Cortex-A7 (cpu=cortex-a7/float-abi=soft):



Testing arm/unsigned-extend-1.c
check_compile tool: gcc for arm_arm_ok
doing compile
Executing on host: .../bin/arm-none-eabi-gcc  arm_arm_ok21484.c 
-mcpu=cortex-a7 -mfloat-abi=soft   -fdiagnostics-plain-output  -marm 
-Wno-complain-wrong-lang -S     -o arm_arm_ok21484.s    (timeout = 800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc arm_arm_ok21484.c 
-mcpu=cortex-a7 -mfloat-abi=soft -fdiagnostics-plain-output -marm 
-Wno-complain-wrong-lang -S -o arm_arm_ok21484.s
pid is 21622 -21622
pid is -1
output is  status 0
doing compile
Executing on host: .../bin/arm-none-eabi-gcc 
.../gcc/testsuite/gcc.target/arm/unsigned-extend-1.c  -mcpu=cortex-a7 
-mfloat-abi=soft   -fdiagnostics-plain-output  -O2 -ffat-lto-objects 
-fno-ident -S     -o unsigned-extend-1.s    (timeout = 800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc 
.../gcc/testsuite/gcc.target/arm/unsigned-extend-1.c -mcpu=cortex-a7 
-mfloat-abi=soft -fdiagnostics-plain-output -O2 -ffat-lto-objects 
-fno-ident -S -o unsigned-extend-1.s
pid is 21626 -21626
pid is -1
output is  status 0
check_compile tool: gcc for exceptions_enabled
doing compile
Executing on host: .../bin/arm-none-eabi-gcc  exceptions_enabled21484.cc 
  -mcpu=cortex-a7 -mfloat-abi=soft   -fdiagnostics-plain-output 
-Wno-complain-wrong-lang -S     -o exceptions_enabled21484.s    (timeout 
= 800)
spawn -ignore SIGHUP .../bin/arm-none-eabi-gcc 
exceptions_enabled21484.cc -mcpu=cortex-a7 -mfloat-abi=soft 
-fdiagnostics-plain-output -Wno-complain-wrong-lang -S -o 
exceptions_enabled21484.s
pid is 21630 -21630
pid is -1
output is  status 0
PASS: gcc.target/arm/unsigned-extend-1.c (test for excess errors)
PASS: gcc.target/arm/unsigned-extend-1.c scan-assembler-not uxtb
testcase .../gcc/testsuite/gcc.target/arm/arm.exp completed in 1 seconds

> Since you don't add -marm, the test will be compiled in Thumb mode,
> and still fail?

Since my tests succeeded without it, it didn't think much of it. I can 
add -marm to the do-options just be safe. Should I send a V2 with it or 
can it be approved with that addition?

Kind regards,
Torbjörn

> 
> Thanks,
> 
> Christophe
> 
>>   unsigned char foo (unsigned char c)
>> --
>> 2.25.1
>>
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c b/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
index 3b4ab048fb0..73f2e1a556d 100644
--- a/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
+++ b/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c
@@ -1,4 +1,5 @@ 
 /* { dg-do compile } */
+/* { dg-require-effective-target arm_arm_ok } */
 /* { dg-options "-O2" } */
 
 unsigned char foo (unsigned char c)