diff mbox series

testsuite: arm: Use check-function-bodies in epilog-1.c test

Message ID 20241107192033.1906714-1-torbjorn.svensson@foss.st.com
State New
Headers show
Series testsuite: arm: Use check-function-bodies in epilog-1.c test | expand

Commit Message

Torbjörn SVENSSON Nov. 7, 2024, 7:20 p.m. UTC
The generated assembler is:

armv7-m:
        push    {r4, lr}
        ldr     r4, .L6
        ldr     r4, [r4]
        lsls    r4, r4, #29
        it      mi
        addmi   r2, r2, #1
        bl      bar
        movs    r0, #0
        pop     {r4, pc}


armv8.1-m.main:
        push    {r3, r4, r5, lr}
        ldr     r4, .L5
        ldr     r5, [r4]
        tst     r5, #4
        csinc   r2, r2, r2, eq
        bl      bar
        movs    r0, #0
        pop     {r3, r4, r5, pc}


Ok for trunk and releases/gcc-14?

--

Update test case for armv8.1-m.main that supports conditional
arithmetic.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/epilog-1.c: Use check-function-bodies.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gcc/testsuite/gcc.target/arm/epilog-1.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

Comments

Christophe Lyon Nov. 7, 2024, 9:55 p.m. UTC | #1
On Thu, 7 Nov 2024 at 20:35, Torbjörn SVENSSON
<torbjorn.svensson@foss.st.com> wrote:
>
> The generated assembler is:
>
> armv7-m:
>         push    {r4, lr}
>         ldr     r4, .L6
>         ldr     r4, [r4]
>         lsls    r4, r4, #29
>         it      mi
>         addmi   r2, r2, #1
>         bl      bar
>         movs    r0, #0
>         pop     {r4, pc}
>
>
> armv8.1-m.main:
>         push    {r3, r4, r5, lr}
>         ldr     r4, .L5
>         ldr     r5, [r4]
>         tst     r5, #4
>         csinc   r2, r2, r2, eq
>         bl      bar
>         movs    r0, #0
>         pop     {r3, r4, r5, pc}
>
>
> Ok for trunk and releases/gcc-14?

LGTM, but wait for Richard's approval.
Maybe include the above info in the commit message, it might be
helpful later when doing archaeologiy :-)
(I notice that the testcase hasn't changed since it was introduced in 2012...)

Thanks,

Christophe

>
> --
>
> Update test case for armv8.1-m.main that supports conditional
> arithmetic.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/arm/epilog-1.c: Use check-function-bodies.
>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
>  gcc/testsuite/gcc.target/arm/epilog-1.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/arm/epilog-1.c b/gcc/testsuite/gcc.target/arm/epilog-1.c
> index f97f1ebeaaf..903251a70e6 100644
> --- a/gcc/testsuite/gcc.target/arm/epilog-1.c
> +++ b/gcc/testsuite/gcc.target/arm/epilog-1.c
> @@ -2,16 +2,28 @@
>  /* { dg-do compile } */
>  /* { dg-options "-mthumb -Os" } */
>  /* { dg-require-effective-target arm_thumb2_ok } */
> +/* { dg-final { check-function-bodies "**" "" } } */
>
>  volatile int g_k;
>  extern void bar(int, int, int, int);
>
> +/*
> +** foo:
> +** ...
> +** (
> +**     lsls    r[0-9]+, r[0-9]+, #29
> +**     it      mi
> +**     addmi   r2, r2, #1
> +** |
> +**     tst     r[0-9]+, #4
> +**     csinc   r2, r2, r2, eq
> +** )
> +**     bl      bar
> +** ...
> +*/
>  int foo(int a, int b, int c, int d)
>  {
>    if (g_k & 4) c++;
>    bar (a, b, c, d);
>    return 0;
>  }
> -
> -/* { dg-final { scan-assembler-times "lsls.*#29" 1 } } */
> -/* { dg-final { scan-assembler-not "tst" } } */
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/arm/epilog-1.c b/gcc/testsuite/gcc.target/arm/epilog-1.c
index f97f1ebeaaf..903251a70e6 100644
--- a/gcc/testsuite/gcc.target/arm/epilog-1.c
+++ b/gcc/testsuite/gcc.target/arm/epilog-1.c
@@ -2,16 +2,28 @@ 
 /* { dg-do compile } */
 /* { dg-options "-mthumb -Os" } */
 /* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-final { check-function-bodies "**" "" } } */
 
 volatile int g_k;
 extern void bar(int, int, int, int);
 
+/*
+** foo:
+** ...
+** (
+**	lsls	r[0-9]+, r[0-9]+, #29
+**	it	mi
+**	addmi	r2, r2, #1
+** |
+**	tst	r[0-9]+, #4
+**	csinc	r2, r2, r2, eq
+** )
+**	bl	bar
+** ...
+*/
 int foo(int a, int b, int c, int d)
 {
   if (g_k & 4) c++;
   bar (a, b, c, d);
   return 0;
 }
-
-/* { dg-final { scan-assembler-times "lsls.*#29" 1 } } */
-/* { dg-final { scan-assembler-not "tst" } } */