]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: testsuite: Modify the tests to make the test pass.
authorLulu Cheng <chenglulu@loongson.cn>
Wed, 10 Sep 2025 07:30:45 +0000 (15:30 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 11 Sep 2025 01:08:57 +0000 (09:08 +0800)
Committing r16-3673 cause the test cases in the list to fail.
Make the test pass by modifying the test case or adding compilation
options.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/cmodel-extreme-1.c: Add -fPIC.
* gcc.target/loongarch/cmodel-extreme-2.c: Likewise.
* gcc.target/loongarch/tls-gd-noplt.c: Likewise.
* gcc.target/loongarch/tls-extreme-macro.c: Likewise.
* gcc.target/loongarch/func-call-medium-2.c: Modify.
* gcc.target/loongarch/func-call-medium-3.c: Modify.
* gcc.target/loongarch/func-call-medium-4.c: Removed.

gcc/testsuite/gcc.target/loongarch/cmodel-extreme-1.c
gcc/testsuite/gcc.target/loongarch/cmodel-extreme-2.c
gcc/testsuite/gcc.target/loongarch/func-call-medium-2.c
gcc/testsuite/gcc.target/loongarch/func-call-medium-3.c
gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c [deleted file]
gcc/testsuite/gcc.target/loongarch/tls-extreme-macro.c
gcc/testsuite/gcc.target/loongarch/tls-gd-noplt.c

index 6269607e7df35044b10eef46e62d33343cf3e07a..4fad516f0570dff4a8ef08dfa4d8737f47d8c54d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -mtls-dialect=trad -fno-plt -mexplicit-relocs=always -fdump-rtl-final" } */
+/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -mtls-dialect=trad -fno-plt -mexplicit-relocs=always -fdump-rtl-final -fPIC" } */
 
 int a;
 extern int b;
index 35f6ee0bb3012ac620ea44766970ca1cae044f90..49bc658391452c5b3eb33dfa5eb5d443cd7102a5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -mtls-dialect=trad -fno-plt -mexplicit-relocs=auto -fdump-rtl-final" } */
+/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -mtls-dialect=trad -fno-plt -mexplicit-relocs=auto -fdump-rtl-final -fPIC" } */
 
 #include "cmodel-extreme-1.c"
 
index d73df2dd8c25d33a51080248d581d44e4775c580..e97044a6013c661b630b729ed073b82adef7120f 100644 (file)
@@ -1,41 +1,45 @@
 /* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mno-explicit-relocs -mtls-dialect=trad -mcmodel=medium" } */
-/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
-/* { dg-final { scan-assembler "test1:.*la\.local\t.*f\n\tjirl" } } */
-/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
-/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
+/* { dg-options "-mabi=lp64d -O2 -fno-pic -fplt -mno-explicit-relocs -mtls-dialect=trad -mcmodel=medium" } */
+/* { dg-final { check-function-bodies "**" "" } } */
 
 extern void g (void);
-void
+void __attribute__ ((noipa,noinline))
 f (void)
 {}
 
-static void
+static void __attribute__ ((noipa,noinline))
 l (void)
 {}
 
+/*
+** test:
+**     la.global       (\$r[0-9]+),g
+**     jr      (\$r[0-9]+)
+*/
 void
 test (void)
 {
   g ();
 }
 
+/*
+** test1:
+**     la.local        (\$r[0-9]+),f
+**     jr      (\$r[0-9]+)
+*/
 void
 test1 (void)
 {
   f ();
 }
 
+/*
+** test2:
+**     la.local        (\$r[0-9]+),l
+**     jr      (\$r[0-9]+)
+*/
 void
 test2 (void)
 {
   l ();
 }
-
-__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
-
-void
-test3 (void)
-{
-  a = 10;
-}
index 88a66745070ef9081a75c5463efed73d2457c297..8754fc6ef309711d47b853eaef61b18e0a21fd48 100644 (file)
@@ -1,31 +1,43 @@
 /* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mno-explicit-relocs -mtls-dialect=trad -mcmodel=medium" } */
-/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
-/* { dg-final { scan-assembler "test1:.*la\.global\t.*f\n\tjirl" } } */
-/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
-/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
+/* { dg-options "-mabi=lp64d -O2 -fpic -fno-plt -mno-explicit-relocs -mtls-dialect=trad -mcmodel=medium" } */
+/* { dg-final { check-function-bodies "**" "" } } */
 
 extern void g (void);
-void
+void __attribute__ ((noinline))
 f (void)
 {}
 
-static void
+static void __attribute__ ((noipa,noinline))
 l (void)
 {}
 
+/*
+** test:
+**     la.global       (\$r[0-9]+),g
+**     jr      (\$r[0-9]+)
+*/
 void
 test (void)
 {
   g ();
 }
 
+/*
+** test1:
+**     la.global       (\$r[0-9]+),f
+**     jr      (\$r[0-9]+)
+*/
 void
 test1 (void)
 {
   f ();
 }
 
+/*
+** test2:
+**     la.local        (\$r[0-9]+),l
+**     jr      (\$r[0-9]+)
+*/
 void
 test2 (void)
 {
@@ -39,3 +51,4 @@ test3 (void)
 {
   a = 10;
 }
+/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c
deleted file mode 100644 (file)
index f9dc12f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mno-explicit-relocs -mtls-dialect=trad -mcmodel=medium" } */
-/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
-/* { dg-final { scan-assembler "test1:.*la\.local\t.*f\n\tjirl" } } */
-/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
-/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
-
-extern void g (void);
-void
-f (void)
-{}
-
-static void
-l (void)
-{}
-
-void
-test (void)
-{
-  g ();
-}
-
-void
-test1 (void)
-{
-  f ();
-}
-
-void
-test2 (void)
-{
-  l ();
-}
-
-__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
-
-void
-test3 (void)
-{
-  a = 10;
-}
index 4adda4202fdda67587b6c540f8fbd10e4db7588b..7f6160e1f662e962fbd57f17ce5d7e3ccdc874df 100644 (file)
@@ -1,9 +1,9 @@
 /* { dg-do compile } */
-/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -mtls-dialect=trad -fno-plt -mexplicit-relocs=none" } */
-/* { dg-final { scan-assembler "test_le:.*la.tls.le\t\\\$r\[0-9\]+,\\\.L" { target tls_native } } } */
-/* { dg-final { scan-assembler "test_ie:.*la.tls.ie\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,\\\.L" { target tls_native } } } */
-/* { dg-final { scan-assembler "test_ld:.*la.tls.ld\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,\\\.L.*la.global\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,__tls_get_addr" { target tls_native } } } */
-/* { dg-final { scan-assembler "test_le:.*la.tls.gd\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,\\\.L.*la.global\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,__tls_get_addr" { target tls_native } } } */
+/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -mtls-dialect=trad -fno-plt -mexplicit-relocs=none -fPIC" } */
+/* { dg-final { scan-assembler "test_le:.*la.tls.le\t\\\$r\[0-9\]+,c" { target tls_native } } } */
+/* { dg-final { scan-assembler "test_ie:.*la.tls.ie\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,d" { target tls_native } } } */
+/* { dg-final { scan-assembler "test_ld:.*la.tls.ld\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,e.*la.global\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,__tls_get_addr" { target tls_native } } } */
+/* { dg-final { scan-assembler "test_le:.*la.tls.gd\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,f.*la.global\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,__tls_get_addr" { target tls_native } } } */
 
 __thread int c __attribute__ ((tls_model ("local-exec")));
 __thread int d __attribute__ ((tls_model ("initial-exec")));
index dfa1bf53c92ee268732d352850e2ad2e5cf9954d..610262a7783ff0ac6674b21afb61983baacc8368 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O0 -fno-plt -mcmodel=normal -mtls-dialect=trad -mexplicit-relocs" } */
+/* { dg-options "-O0 -fno-plt -mcmodel=normal -mtls-dialect=trad -mexplicit-relocs -fPIC" } */
 /* { dg-final { scan-assembler "pcalau12i\t.*%got_pc_hi20\\(__tls_get_addr\\)\n\tld\.d.*%got_pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
 
 __attribute__ ((tls_model ("global-dynamic"))) __thread int a;