Hi Suwa-san,

v2 fixes the regressions caused by ICEs, but not the runtime failures.

On Mon, Oct 17, 2022 at 8:14 PM Max Filippov <jcmvb...@gmail.com> wrote:
> On Mon, Oct 17, 2022 at 7:57 PM Takayuki 'January June' Suwa
> <jjsuwa_sys3...@yahoo.co.jp> wrote:
> > On 2022/10/16 14:03, Max Filippov wrote:
> > > There's also the following runtime failures, but only on call0 
> > > configuration:
> > >
> > > +FAIL: gcc.c-torture/execute/20010122-1.c   -O1  execution test
> > > +FAIL: gcc.c-torture/execute/20010122-1.c   -O2  execution test
> > > +FAIL: gcc.c-torture/execute/20010122-1.c   -O3 -g  execution test
> > > +FAIL: gcc.c-torture/execute/20010122-1.c   -Os  execution test
> > > +FAIL: gcc.c-torture/execute/20010122-1.c   -O2 -flto 
> > > -fno-use-linker-plugin -flto-partition=none  execution test
> >
> > both assembler outputs with and without this patch are identical on my side
>
> Interesting. In -O1 test I see the following difference that is going to 
> affect
> the return value of the corresponding functions:
>
> --- gcc-13-3308-gb4a4c6382b14-call0-le/20010122-1.s      2022-10-17
> 20:07:32.390363204 -0700
> +++ gcc-13-3309-g851636ecd015-call0-le/20010122-1.s      2022-10-17
> 20:06:36.613785546 -0700
> @@ -143,13 +143,10 @@
> test2:
>        addi    sp, sp, -16
>        s32i.n  a0, sp, 12
> -       s32i.n  a12, sp, 8
> -       mov.n   a12, a0
>        l32r    a2, .LC6
>        callx0  a2
> -       mov.n   a2, a12
> +       mov.n   a2, a0
>        l32i.n  a0, sp, 12
> -       l32i.n  a12, sp, 8
>        addi    sp, sp, 16
>        ret.n
>        .size   test2, .-test2
> @@ -161,13 +158,10 @@
> test3:
>        addi    sp, sp, -16
>        s32i.n  a0, sp, 12
> -       s32i.n  a12, sp, 8
> -       mov.n   a12, a0
>        l32r    a2, .LC7
>        callx0  a2
> -       mov.n   a2, a12
> +       mov.n   a2, a0
>        l32i.n  a0, sp, 12
> -       l32i.n  a12, sp, 8
>        addi    sp, sp, 16
>        ret.n
>        .size   test3, .-test3
> @@ -258,14 +252,11 @@
> test8:
>        addi    sp, sp, -16
>        s32i.n  a0, sp, 12
> -       s32i.n  a12, sp, 8
> -       mov.n   a12, a0
>        l32r    a2, .LC12
>        callx0  a2
>        l32r    a2, .LC13
> -       s32i.n  a12, a2, 0
> +       s32i.n  a0, a2, 0
>        l32i.n  a0, sp, 12
> -       l32i.n  a12, sp, 8
>        addi    sp, sp, 16
>        ret.n
>        .size   test8, .-test8

I've noticed that this is related to the following hunk:

-#define CALL_USED_REGISTERS                                            \
+#define CALL_REALLY_USED_REGISTERS                                     \
 {                                                                      \
-  1, 1, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, 2, 2,                      \
-  1, 1, 1,                                                             \
+  0, 0, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, 2, 2,                      \
+  0, 0, 1,                                                             \
   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,                      \
   1,                                                                   \
 }

And the following change on top of v2 fixes this regression for me:

diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 6b60e5960625..897f87f735da 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -244,7 +244,7 @@ along with GCC; see the file COPYING3.  If not see

#define CALL_REALLY_USED_REGISTERS                                     \
{                                                                      \
-  0, 0, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, 2, 2,                      \
+  1, 0, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, 2, 2,                      \
  0, 0, 1,                                                             \
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,                      \
  1,                                                                   \


-- 
Thanks.
-- Max

Reply via email to