On 08/11/2024 12:12, Torbjorn SVENSSON wrote:


On 2024-11-08 11:33, Richard Earnshaw (lists) wrote:
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

Don't know how useful the test is, but at least it no longer fails when the generated code is fine.

The difficulty with this test due to the fact is that it is detecting a symptom of some other piece of code operating correctly; it isn't really checking that lsls/addmi is emitted and tst is not. So to decide whether or not the change in output is a regression requires knowing what exactly was/wasn't happening before the change to the epilogue code expansion and why that changed in the first place.

It's a poor test because of this, especially given the lack of detail about the old code output.


Pushed as r15-5042-gec86e87439b and r14.2.0-376-g724446556e5.


Thanks.
R.
Kind regards,
Torbjörn


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.svens...@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" } } */




Reply via email to