Message ID | 20241108085416.1963320-1-torbjorn.svensson@foss.st.com |
---|---|
State | New |
Headers | show |
Series | [v2] testsuite: arm: Use check-function-bodies in epilog-1.c test | expand |
On 08/11/2024 08:54, Torbjörn SVENSSON wrote: > Changes since v1: > > - Added generated assembler in commit message. > - Added comments in test case when each block is relevant. > > Ok for trunk and releases/gcc-14? > This is OK. I'm not sure how useful this test really is (the mailing list history suggests that something about using lsls occurred as a result of switching to generate the prologue/epilogue in RTL. But it's not clear what. The tst/csinc alternative is certainly not wrong though R. > -- > > Update test case for armv8.1-m.main that supports conditional > arithmetic. > > 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} > > 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 | 24 +++++++++++++++++++++--- > 1 file changed, 21 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..a1516456460 100644 > --- a/gcc/testsuite/gcc.target/arm/epilog-1.c > +++ b/gcc/testsuite/gcc.target/arm/epilog-1.c > @@ -2,16 +2,34 @@ > /* { 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: > +** ... > +** ( > + > +Below block is for non-armv8.1-m.main > +** lsls r[0-9]+, r[0-9]+, #29 > +** it mi > +** addmi r2, r2, #1 > + > +** | > + > +Below block is for armv8.1-m.main > +** 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" } } */
diff --git a/gcc/testsuite/gcc.target/arm/epilog-1.c b/gcc/testsuite/gcc.target/arm/epilog-1.c index f97f1ebeaaf..a1516456460 100644 --- a/gcc/testsuite/gcc.target/arm/epilog-1.c +++ b/gcc/testsuite/gcc.target/arm/epilog-1.c @@ -2,16 +2,34 @@ /* { 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: +** ... +** ( + +Below block is for non-armv8.1-m.main +** lsls r[0-9]+, r[0-9]+, #29 +** it mi +** addmi r2, r2, #1 + +** | + +Below block is for armv8.1-m.main +** 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" } } */
Changes since v1: - Added generated assembler in commit message. - Added comments in test case when each block is relevant. Ok for trunk and releases/gcc-14? -- Update test case for armv8.1-m.main that supports conditional arithmetic. 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} 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 | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)