Pushed: [PATCH] LoongArch: testsuite: Add -O for jump-table-annotate.c

Message ID 20241101173641.20676-1-xry111@xry111.site
State Committed
Commit caf6b6fdfdaa1d0d78b8d740aa0e0646ca182a2a
Headers
Series Pushed: [PATCH] LoongArch: testsuite: Add -O for jump-table-annotate.c |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply

Commit Message

Xi Ruoyao Nov. 1, 2024, 5:36 p.m. UTC
  Without optimization, GCC does not emit a jump table for the test case.

I'm not sure if the test case has been wrong in the first place or
something has changed in these months...

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/jump-table-annotate.c
	(dg-additional-options): Add -O.
---

Pushed as obvious.

 gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Lulu Cheng Nov. 2, 2024, 1:52 a.m. UTC | #1
在 2024/11/2 上午1:36, Xi Ruoyao 写道:
> Without optimization, GCC does not emit a jump table for the test case.
>
> I'm not sure if the test case has been wrong in the first place or
> something has changed in these months...

It was in the r15-4756 that turned -fjump-tables off at O0 optimization.

I was also looking at this issue yesterday. Isn't it better to add 
'-fjump-tables'?:-(

>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.target/loongarch/jump-table-annotate.c
> 	(dg-additional-options): Add -O.
> ---
>
> Pushed as obvious.
>
>   gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c b/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c
> index 9d58e60e39a..1895f6f03b8 100644
> --- a/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c
> +++ b/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c
> @@ -1,5 +1,5 @@
>   /* { dg-do compile } */
> -/* { dg-additional-options "-mannotate-tablejump" } */
> +/* { dg-additional-options "-O -mannotate-tablejump" } */
>   
>   extern void asdf(int);
>   void foo(int x) {
  
Xi Ruoyao Nov. 2, 2024, 9:56 a.m. UTC | #2
On Sat, 2024-11-02 at 09:52 +0800, Lulu Cheng wrote:
> 
> 在 2024/11/2 上午1:36, Xi Ruoyao 写道:
> > Without optimization, GCC does not emit a jump table for the test case.
> > 
> > I'm not sure if the test case has been wrong in the first place or
> > something has changed in these months...
> 
> It was in the r15-4756 that turned -fjump-tables off at O0 optimization.
> 
> I was also looking at this issue yesterday. Isn't it better to add 
> '-fjump-tables'?:-(

Maybe, but I've heard some -f options does not work at all at -O0
(however I've just tried and -fjump-tables works even at -O0).


If you like -fjump-tables more than -O please push the change.
  

Patch

diff --git a/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c b/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c
index 9d58e60e39a..1895f6f03b8 100644
--- a/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c
+++ b/gcc/testsuite/gcc.target/loongarch/jump-table-annotate.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-additional-options "-mannotate-tablejump" } */
+/* { dg-additional-options "-O -mannotate-tablejump" } */
 
 extern void asdf(int);
 void foo(int x) {