x86: Update gcc.target/i386/apx-interrupt-1.c

Message ID 20250414230606.2574106-1-hjl.tools@gmail.com
State New
Headers
Series x86: Update gcc.target/i386/apx-interrupt-1.c |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap success Build passed
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed

Commit Message

H.J. Lu April 14, 2025, 11:06 p.m. UTC
  ix86_add_cfa_restore_note omits the REG_CFA_RESTORE REG note for registers
pushed in red-zone.  Since

commit 0a074b8c7e79f9d9359d044f1499b0a9ce9d2801
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Apr 13 12:20:42 2025 -0700

    APX: Don't use red-zone with 32 GPRs and no caller-saved registers

disabled red-zone, update gcc.target/i386/apx-interrupt-1.c to expect
31 .cfi_restore directives.

	PR target/119784
	* gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
	directives.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 gcc/testsuite/gcc.target/i386/apx-interrupt-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Uros Bizjak April 15, 2025, 7:45 a.m. UTC | #1
On Tue, Apr 15, 2025 at 1:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> ix86_add_cfa_restore_note omits the REG_CFA_RESTORE REG note for registers
> pushed in red-zone.  Since
>
> commit 0a074b8c7e79f9d9359d044f1499b0a9ce9d2801
> Author: H.J. Lu <hjl.tools@gmail.com>
> Date:   Sun Apr 13 12:20:42 2025 -0700
>
>     APX: Don't use red-zone with 32 GPRs and no caller-saved registers
>
> disabled red-zone, update gcc.target/i386/apx-interrupt-1.c to expect
> 31 .cfi_restore directives.

Hm, did you also account for RED_ZONE_RESERVE? The last 8-byte slot is
reserved for internal use by the compiler.

Uros.

>
>         PR target/119784
>         * gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
>         directives.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  gcc/testsuite/gcc.target/i386/apx-interrupt-1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> index fefe2e6d6fc..fa1acc7a142 100644
> --- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> +++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> @@ -66,7 +66,7 @@ void foo (void *frame)
>  /* { dg-final { scan-assembler-times {\t\.cfi_offset 132, -120} 1 } } */
>  /* { dg-final { scan-assembler-times {\t\.cfi_offset 131, -128} 1 } } */
>  /* { dg-final { scan-assembler-times {\t\.cfi_offset 130, -136} 1 } } */
> -/* { dg-final { scan-assembler-times ".cfi_restore" 15} } */
> +/* { dg-final { scan-assembler-times ".cfi_restore" 31 } } */
>  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
>  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */
>  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */
> --
> 2.49.0
>
  
H.J. Lu April 15, 2025, 12:22 p.m. UTC | #2
On Tue, Apr 15, 2025 at 12:45 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Tue, Apr 15, 2025 at 1:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > ix86_add_cfa_restore_note omits the REG_CFA_RESTORE REG note for registers
> > pushed in red-zone.  Since
> >
> > commit 0a074b8c7e79f9d9359d044f1499b0a9ce9d2801
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date:   Sun Apr 13 12:20:42 2025 -0700
> >
> >     APX: Don't use red-zone with 32 GPRs and no caller-saved registers
> >
> > disabled red-zone, update gcc.target/i386/apx-interrupt-1.c to expect
> > 31 .cfi_restore directives.
>
> Hm, did you also account for RED_ZONE_RESERVE? The last 8-byte slot is
> reserved for internal use by the compiler.

There is no red-zone in this case.

> Uros.
>
> >
> >         PR target/119784
> >         * gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
> >         directives.
> >
> > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> > ---
> >  gcc/testsuite/gcc.target/i386/apx-interrupt-1.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > index fefe2e6d6fc..fa1acc7a142 100644
> > --- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > +++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > @@ -66,7 +66,7 @@ void foo (void *frame)
> >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 132, -120} 1 } } */
> >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 131, -128} 1 } } */
> >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 130, -136} 1 } } */
> > -/* { dg-final { scan-assembler-times ".cfi_restore" 15} } */
> > +/* { dg-final { scan-assembler-times ".cfi_restore" 31 } } */
> >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
> >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */
> >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */
> > --
> > 2.49.0
> >
  
Uros Bizjak April 15, 2025, 7:19 p.m. UTC | #3
On Tue, Apr 15, 2025 at 2:23 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Apr 15, 2025 at 12:45 AM Uros Bizjak <ubizjak@gmail.com> wrote:
> >
> > On Tue, Apr 15, 2025 at 1:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > ix86_add_cfa_restore_note omits the REG_CFA_RESTORE REG note for registers
> > > pushed in red-zone.  Since
> > >
> > > commit 0a074b8c7e79f9d9359d044f1499b0a9ce9d2801
> > > Author: H.J. Lu <hjl.tools@gmail.com>
> > > Date:   Sun Apr 13 12:20:42 2025 -0700
> > >
> > >     APX: Don't use red-zone with 32 GPRs and no caller-saved registers
> > >
> > > disabled red-zone, update gcc.target/i386/apx-interrupt-1.c to expect
> > > 31 .cfi_restore directives.
> >
> > Hm, did you also account for RED_ZONE_RESERVE? The last 8-byte slot is
> > reserved for internal use by the compiler.
>
> There is no red-zone in this case.
>
> > Uros.
> >
> > >
> > >         PR target/119784
> > >         * gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
> > >         directives.

OK.

Thanks,
Uros.

> > >
> > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> > > ---
> > >  gcc/testsuite/gcc.target/i386/apx-interrupt-1.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > > index fefe2e6d6fc..fa1acc7a142 100644
> > > --- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > > +++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > > @@ -66,7 +66,7 @@ void foo (void *frame)
> > >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 132, -120} 1 } } */
> > >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 131, -128} 1 } } */
> > >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 130, -136} 1 } } */
> > > -/* { dg-final { scan-assembler-times ".cfi_restore" 15} } */
> > > +/* { dg-final { scan-assembler-times ".cfi_restore" 31 } } */
> > >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
> > >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */
> > >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */
> > > --
> > > 2.49.0
> > >
>
>
>
> --
> H.J.
  
H.J. Lu April 16, 2025, 7:23 p.m. UTC | #4
On Tue, Apr 15, 2025 at 12:19 PM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Tue, Apr 15, 2025 at 2:23 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Tue, Apr 15, 2025 at 12:45 AM Uros Bizjak <ubizjak@gmail.com> wrote:
> > >
> > > On Tue, Apr 15, 2025 at 1:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > ix86_add_cfa_restore_note omits the REG_CFA_RESTORE REG note for registers
> > > > pushed in red-zone.  Since
> > > >
> > > > commit 0a074b8c7e79f9d9359d044f1499b0a9ce9d2801
> > > > Author: H.J. Lu <hjl.tools@gmail.com>
> > > > Date:   Sun Apr 13 12:20:42 2025 -0700
> > > >
> > > >     APX: Don't use red-zone with 32 GPRs and no caller-saved registers
> > > >
> > > > disabled red-zone, update gcc.target/i386/apx-interrupt-1.c to expect
> > > > 31 .cfi_restore directives.
> > >
> > > Hm, did you also account for RED_ZONE_RESERVE? The last 8-byte slot is
> > > reserved for internal use by the compiler.
> >
> > There is no red-zone in this case.
> >
> > > Uros.
> > >
> > > >
> > > >         PR target/119784
> > > >         * gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
> > > >         directives.
>
> OK.

I am backporting this to GCC 14 together with the other PR target/119784 fix.

> Thanks,
> Uros.
>
> > > >
> > > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> > > > ---
> > > >  gcc/testsuite/gcc.target/i386/apx-interrupt-1.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > > > index fefe2e6d6fc..fa1acc7a142 100644
> > > > --- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > > > +++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
> > > > @@ -66,7 +66,7 @@ void foo (void *frame)
> > > >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 132, -120} 1 } } */
> > > >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 131, -128} 1 } } */
> > > >  /* { dg-final { scan-assembler-times {\t\.cfi_offset 130, -136} 1 } } */
> > > > -/* { dg-final { scan-assembler-times ".cfi_restore" 15} } */
> > > > +/* { dg-final { scan-assembler-times ".cfi_restore" 31 } } */
> > > >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
> > > >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */
> > > >  /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */
> > > > --
> > > > 2.49.0
> > > >
> >
> >
> >
> > --
> > H.J.
  

Patch

diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
index fefe2e6d6fc..fa1acc7a142 100644
--- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
+++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c
@@ -66,7 +66,7 @@  void foo (void *frame)
 /* { dg-final { scan-assembler-times {\t\.cfi_offset 132, -120} 1 } } */
 /* { dg-final { scan-assembler-times {\t\.cfi_offset 131, -128} 1 } } */
 /* { dg-final { scan-assembler-times {\t\.cfi_offset 130, -136} 1 } } */
-/* { dg-final { scan-assembler-times ".cfi_restore" 15} } */
+/* { dg-final { scan-assembler-times ".cfi_restore" 31 } } */
 /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
 /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */
 /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */