From 7dded683fda8c47b2139b3bd7771dd53658a3b27 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 22 Sep 2007 20:10:52 +0000 Subject: [PATCH] sourcebuild.texi: Document dg-add-options mips16_attribute. gcc/ * doc/sourcebuild.texi: Document dg-add-options mips16_attribute. gcc/testsuite/ * lib/target-supports.exp (add_options_for_mips16_attribute) (check_effective_target_mips16_attribute): New functions. * gcc.target/mips/mips.exp: Define MIPS16 and NOMIPS16 on the command line. (dg-mips-options) Remove -mno-mips16 handling. Add options to extra_test_flags. * gcc.target/mips/asm-1.c (NOMIPS16): Delete. * gcc.target/mips/atomic-memory-1.c (NOMIPS16): Likewise. * gcc.target/mips/atomic-memory-2.c (NOMIPS16): Likewise. * gcc.target/mips/branch-1.c (NOMIPS16): Likewise. * gcc.target/mips/dspr2-MULT.c (NOMIPS16): Likewise. * gcc.target/mips/dspr2-MULTU.c (NOMIPS16): Likewise. * gcc.target/mips/fpcmp-1.c (NOMIPS16): Likewise. * gcc.target/mips/fpcmp-2.c (NOMIPS16): Likewise. * gcc.target/mips/ins-1.c (NOMIPS16): Likewise. * gcc.target/mips/madd-3.c (NOMIPS16): Likewise. * gcc.target/mips/maddu-3.c (NOMIPS16): Likewise. * gcc.target/mips/mips32-dsp-run.c (NOMIPS16): Likewise. * gcc.target/mips/mips32-dspr2-type.c (NOMIPS16): Likewise. * gcc.target/mips/msub-3.c (NOMIPS16): Likewise. * gcc.target/mips/msubu-3.c (NOMIPS16): Likewise. * gcc.target/mips/near-far-3.c (NOMIPS16): Likewise. * gcc.target/mips/near-far-4.c (NOMIPS16): Likewise. * gcc.target/mips/neg-abs-1.c (NOMIPS16): Likewise. * gcc.target/mips/smartmips-lwxs.c (NOMIPS16): Likewise. * gcc.target/mips/smartmips-ror-1.c (NOMIPS16): Likewise. * gcc.target/mips/smartmips-ror-2.c (NOMIPS16): Likewise. * gcc.target/mips/smartmips-ror-3.c (NOMIPS16): Likewise. * gcc.target/mips/smartmips-ror-4.c (NOMIPS16): Likewise. * gcc.target/mips/pr26765.c: Use dg-mips-options instead of dg-options. (NOMIPS16): Delete. * gcc.target/mips/20020620-1.c: Use dg-mips-options instead of dg-options. * gcc.target/mips/call-saved-1.c: Remove -mips16 and -mno-abicalls options. Require { target mips16_attribute } and use dg-add-options to add the associated options. (foo): Use MIPS16. * gcc.target/mips/call-saved-2.c: As for call-saved-1.c. * gcc.target/mips/call-saved-3.c: Likewise. * gcc.target/mips/code-readable-1.c: Require { target mips16_attribute } and use dg-add-options to add the associated options. Remove trailing whitespace. (NOMIPS16): Delete. * gcc.target/mips/code-readable-2.c: Likewise. * gcc.target/mips/code-readable-3.c: Likewise. * gcc.target/mips/mips16-attributes-2.c: Likewise. * gcc.target/mips/mips16e-extends.c: Remove -mips16 option. Require { target mips16_attribute } and use dg-add-options to add the associated options. (cksum16, cksum8): Use MIPS16. * gcc.target/mips/save-restore-1.c: Remove -mips16 option. Require { target mips16_attribute } and use dg-add-options to add the associated options. (foo): Use MIPS16. * gcc.target/mips/save-restore-2.c: Likewise. * gcc.target/mips/save-restore-3.c: Likewise. * gcc.target/mips/save-restore-4.c: Likewise. * gcc.target/mips/save-restore-5.c: Likewise. Also remove -mno-abicalls. * gcc.target/mips/mips-sched-madd.c: Remove -mno-mips16. (foo): Use NOMIPS16. From-SVN: r128674 --- gcc/ChangeLog | 4 ++ gcc/doc/sourcebuild.texi | 4 ++ gcc/testsuite/ChangeLog | 64 ++++++++++++++++++++++ gcc/testsuite/gcc.target/mips/20020620-1.c | 2 +- gcc/testsuite/gcc.target/mips/asm-1.c | 2 - gcc/testsuite/gcc.target/mips/atomic-memory-1.c | 2 - gcc/testsuite/gcc.target/mips/atomic-memory-2.c | 2 - gcc/testsuite/gcc.target/mips/branch-1.c | 2 - gcc/testsuite/gcc.target/mips/call-saved-1.c | 7 ++- gcc/testsuite/gcc.target/mips/call-saved-2.c | 6 +- gcc/testsuite/gcc.target/mips/call-saved-3.c | 7 ++- gcc/testsuite/gcc.target/mips/code-readable-1.c | 6 +- gcc/testsuite/gcc.target/mips/code-readable-2.c | 4 +- gcc/testsuite/gcc.target/mips/code-readable-3.c | 4 +- gcc/testsuite/gcc.target/mips/dspr2-MULT.c | 2 - gcc/testsuite/gcc.target/mips/dspr2-MULTU.c | 2 - gcc/testsuite/gcc.target/mips/fpcmp-1.c | 2 - gcc/testsuite/gcc.target/mips/fpcmp-2.c | 2 - gcc/testsuite/gcc.target/mips/ins-1.c | 2 - gcc/testsuite/gcc.target/mips/madd-3.c | 2 - gcc/testsuite/gcc.target/mips/maddu-3.c | 2 - gcc/testsuite/gcc.target/mips/mips-sched-madd.c | 4 +- gcc/testsuite/gcc.target/mips/mips.exp | 14 ++--- .../gcc.target/mips/mips16-attributes-2.c | 2 + gcc/testsuite/gcc.target/mips/mips16e-extends.c | 9 +-- gcc/testsuite/gcc.target/mips/mips32-dsp-run.c | 2 - gcc/testsuite/gcc.target/mips/mips32-dspr2-type.c | 2 - gcc/testsuite/gcc.target/mips/msub-3.c | 2 - gcc/testsuite/gcc.target/mips/msubu-3.c | 2 - gcc/testsuite/gcc.target/mips/near-far-3.c | 2 - gcc/testsuite/gcc.target/mips/near-far-4.c | 2 - gcc/testsuite/gcc.target/mips/neg-abs-1.c | 2 - gcc/testsuite/gcc.target/mips/pr26765.c | 4 +- gcc/testsuite/gcc.target/mips/save-restore-1.c | 7 ++- gcc/testsuite/gcc.target/mips/save-restore-2.c | 7 ++- gcc/testsuite/gcc.target/mips/save-restore-3.c | 7 ++- gcc/testsuite/gcc.target/mips/save-restore-4.c | 8 ++- gcc/testsuite/gcc.target/mips/save-restore-5.c | 7 ++- gcc/testsuite/gcc.target/mips/smartmips-lwxs.c | 2 - gcc/testsuite/gcc.target/mips/smartmips-ror-1.c | 2 - gcc/testsuite/gcc.target/mips/smartmips-ror-2.c | 2 - gcc/testsuite/gcc.target/mips/smartmips-ror-3.c | 2 - gcc/testsuite/gcc.target/mips/smartmips-ror-4.c | 2 - gcc/testsuite/lib/target-supports.exp | 17 ++++++ 44 files changed, 150 insertions(+), 90 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a96789122a2..85934036f35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2007-09-22 Richard Sandiford + + * doc/sourcebuild.texi: Document dg-add-options mips16_attribute. + 2007-09-22 Eric Botcazou * tree-inline.c (remap_type_1): Correctly chain variants. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 4f78d735572..6f6dcd01e90 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -983,6 +983,10 @@ The supported values of @var{feature} are: @table @code @item c99_runtime The target's C99 runtime (both headers and libraries). + +@item mips16_attribute +@code{mips16} function attributes. Only MIPS targets support this feature, +and only then in certain modes. @end table @item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bad83314714..0dd4f60088c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,67 @@ +2007-09-22 Richard Sandiford + + * lib/target-supports.exp (add_options_for_mips16_attribute) + (check_effective_target_mips16_attribute): New functions. + * gcc.target/mips/mips.exp: Define MIPS16 and NOMIPS16 on the + command line. + (dg-mips-options) Remove -mno-mips16 handling. Add options to + extra_test_flags. + * gcc.target/mips/asm-1.c (NOMIPS16): Delete. + * gcc.target/mips/atomic-memory-1.c (NOMIPS16): Likewise. + * gcc.target/mips/atomic-memory-2.c (NOMIPS16): Likewise. + * gcc.target/mips/branch-1.c (NOMIPS16): Likewise. + * gcc.target/mips/dspr2-MULT.c (NOMIPS16): Likewise. + * gcc.target/mips/dspr2-MULTU.c (NOMIPS16): Likewise. + * gcc.target/mips/fpcmp-1.c (NOMIPS16): Likewise. + * gcc.target/mips/fpcmp-2.c (NOMIPS16): Likewise. + * gcc.target/mips/ins-1.c (NOMIPS16): Likewise. + * gcc.target/mips/madd-3.c (NOMIPS16): Likewise. + * gcc.target/mips/maddu-3.c (NOMIPS16): Likewise. + * gcc.target/mips/mips32-dsp-run.c (NOMIPS16): Likewise. + * gcc.target/mips/mips32-dspr2-type.c (NOMIPS16): Likewise. + * gcc.target/mips/msub-3.c (NOMIPS16): Likewise. + * gcc.target/mips/msubu-3.c (NOMIPS16): Likewise. + * gcc.target/mips/near-far-3.c (NOMIPS16): Likewise. + * gcc.target/mips/near-far-4.c (NOMIPS16): Likewise. + * gcc.target/mips/neg-abs-1.c (NOMIPS16): Likewise. + * gcc.target/mips/smartmips-lwxs.c (NOMIPS16): Likewise. + * gcc.target/mips/smartmips-ror-1.c (NOMIPS16): Likewise. + * gcc.target/mips/smartmips-ror-2.c (NOMIPS16): Likewise. + * gcc.target/mips/smartmips-ror-3.c (NOMIPS16): Likewise. + * gcc.target/mips/smartmips-ror-4.c (NOMIPS16): Likewise. + * gcc.target/mips/pr26765.c: Use dg-mips-options instead of dg-options. + (NOMIPS16): Delete. + * gcc.target/mips/20020620-1.c: Use dg-mips-options instead + of dg-options. + * gcc.target/mips/call-saved-1.c: Remove -mips16 and -mno-abicalls + options. Require { target mips16_attribute } and use dg-add-options + to add the associated options. + (foo): Use MIPS16. + * gcc.target/mips/call-saved-2.c: As for call-saved-1.c. + * gcc.target/mips/call-saved-3.c: Likewise. + * gcc.target/mips/code-readable-1.c: Require { target + mips16_attribute } and use dg-add-options to add the associated + options. Remove trailing whitespace. + (NOMIPS16): Delete. + * gcc.target/mips/code-readable-2.c: Likewise. + * gcc.target/mips/code-readable-3.c: Likewise. + * gcc.target/mips/mips16-attributes-2.c: Likewise. + * gcc.target/mips/mips16e-extends.c: Remove -mips16 option. + Require { target mips16_attribute } and use dg-add-options to + add the associated options. + (cksum16, cksum8): Use MIPS16. + * gcc.target/mips/save-restore-1.c: Remove -mips16 option. + Require { target mips16_attribute } and use dg-add-options to + add the associated options. + (foo): Use MIPS16. + * gcc.target/mips/save-restore-2.c: Likewise. + * gcc.target/mips/save-restore-3.c: Likewise. + * gcc.target/mips/save-restore-4.c: Likewise. + * gcc.target/mips/save-restore-5.c: Likewise. Also remove + -mno-abicalls. + * gcc.target/mips/mips-sched-madd.c: Remove -mno-mips16. + (foo): Use NOMIPS16. + 2007-09-22 Paul Thomas PR fortran/33337 diff --git a/gcc/testsuite/gcc.target/mips/20020620-1.c b/gcc/testsuite/gcc.target/mips/20020620-1.c index ea6b9d5a74f..f4828f439e7 100644 --- a/gcc/testsuite/gcc.target/mips/20020620-1.c +++ b/gcc/testsuite/gcc.target/mips/20020620-1.c @@ -1,5 +1,5 @@ /* { dg-do compile { target mips64*-*-* mipsisa64*-*-* } } */ -/* { dg-options "-O2 -mlong64" } */ +/* { dg-mips-options "-O2 -mlong64" } */ int foo (int *x, int i) { return x[i] + i; diff --git a/gcc/testsuite/gcc.target/mips/asm-1.c b/gcc/testsuite/gcc.target/mips/asm-1.c index d202d6cbdd4..ab5d8f8c480 100644 --- a/gcc/testsuite/gcc.target/mips/asm-1.c +++ b/gcc/testsuite/gcc.target/mips/asm-1.c @@ -3,8 +3,6 @@ /* { dg-do assemble } */ /* { dg-mips-options "-O" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int foo (int n) { register int k asm ("$16") = n; diff --git a/gcc/testsuite/gcc.target/mips/atomic-memory-1.c b/gcc/testsuite/gcc.target/mips/atomic-memory-1.c index b44bd46cf7e..e9a95eaa4fc 100644 --- a/gcc/testsuite/gcc.target/mips/atomic-memory-1.c +++ b/gcc/testsuite/gcc.target/mips/atomic-memory-1.c @@ -2,8 +2,6 @@ extern void abort (void); extern void exit (int); -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int main () { #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 diff --git a/gcc/testsuite/gcc.target/mips/atomic-memory-2.c b/gcc/testsuite/gcc.target/mips/atomic-memory-2.c index 18ec64d004a..34214e4476a 100644 --- a/gcc/testsuite/gcc.target/mips/atomic-memory-2.c +++ b/gcc/testsuite/gcc.target/mips/atomic-memory-2.c @@ -3,8 +3,6 @@ /* { dg-final { scan-assembler "addiu" } } */ /* { dg-final { scan-assembler-not "subu" } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 unsigned long f(unsigned long *p) { diff --git a/gcc/testsuite/gcc.target/mips/branch-1.c b/gcc/testsuite/gcc.target/mips/branch-1.c index 7caf2986baf..8c991dd9ff1 100644 --- a/gcc/testsuite/gcc.target/mips/branch-1.c +++ b/gcc/testsuite/gcc.target/mips/branch-1.c @@ -2,8 +2,6 @@ followed by a branch on zero. */ /* { dg-mips-options "-O2" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - void bar (void); NOMIPS16 void f1 (int x) { if (x & 4) bar (); } NOMIPS16 void f2 (int x) { if ((x >> 2) & 1) bar (); } diff --git a/gcc/testsuite/gcc.target/mips/call-saved-1.c b/gcc/testsuite/gcc.target/mips/call-saved-1.c index 957b0c598bd..42d2dfbfada 100644 --- a/gcc/testsuite/gcc.target/mips/call-saved-1.c +++ b/gcc/testsuite/gcc.target/mips/call-saved-1.c @@ -1,9 +1,12 @@ /* Check that we save all call-saved GPRs in a MIPS16 __builtin_eh_return function. */ -/* { dg-mips-options "-mips2 -mips16 -mno-abicalls" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips2" } */ +/* { dg-add-options mips16_attribute } */ void bar (void); -void + +MIPS16 void foo (int x) { __builtin_unwind_init (); diff --git a/gcc/testsuite/gcc.target/mips/call-saved-2.c b/gcc/testsuite/gcc.target/mips/call-saved-2.c index 89288967283..80ca92cf1a1 100644 --- a/gcc/testsuite/gcc.target/mips/call-saved-2.c +++ b/gcc/testsuite/gcc.target/mips/call-saved-2.c @@ -1,7 +1,9 @@ /* Check that we save non-MIPS16 GPRs if they are explicitly clobbered. */ -/* { dg-mips-options "-mips2 -mips16 -mno-abicalls -O2" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips2 -O2" } */ +/* { dg-add-options mips16_attribute } */ -void +MIPS16 void foo (void) { asm volatile ("" ::: "$19", "$23", "$24", "$30"); diff --git a/gcc/testsuite/gcc.target/mips/call-saved-3.c b/gcc/testsuite/gcc.target/mips/call-saved-3.c index f1d93793b3c..5f71c85ec4a 100644 --- a/gcc/testsuite/gcc.target/mips/call-saved-3.c +++ b/gcc/testsuite/gcc.target/mips/call-saved-3.c @@ -1,10 +1,13 @@ /* Check that we save all call-saved GPRs in a MIPS16 __builtin_setjmp function. */ -/* { dg-mips-options "-mips2 -mips16 -mno-abicalls -O2" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips2 -O2" } */ +/* { dg-add-options mips16_attribute } */ void bar (void); extern int buf[]; -void + +MIPS16 void foo (int x) { if (__builtin_setjmp (buf) == 0) diff --git a/gcc/testsuite/gcc.target/mips/code-readable-1.c b/gcc/testsuite/gcc.target/mips/code-readable-1.c index 8add1c7aa83..7a58457d929 100644 --- a/gcc/testsuite/gcc.target/mips/code-readable-1.c +++ b/gcc/testsuite/gcc.target/mips/code-readable-1.c @@ -1,8 +1,8 @@ +/* { dg-do compile { target mips16_attribute } } */ /* { dg-mips-options "-mcode-readable=yes -mgp32" } */ +/* { dg-add-options mips16_attribute } */ -#define MIPS16 __attribute__ ((mips16)) - -MIPS16 int +MIPS16 int foo (int i) { switch (i) diff --git a/gcc/testsuite/gcc.target/mips/code-readable-2.c b/gcc/testsuite/gcc.target/mips/code-readable-2.c index c2325484276..18a1218eb38 100644 --- a/gcc/testsuite/gcc.target/mips/code-readable-2.c +++ b/gcc/testsuite/gcc.target/mips/code-readable-2.c @@ -1,6 +1,6 @@ +/* { dg-do compile { target mips16_attribute } } */ /* { dg-mips-options "-mcode-readable=pcrel -mgp32" } */ - -#define MIPS16 __attribute__ ((mips16)) +/* { dg-add-options mips16_attribute } */ MIPS16 int foo (int i) diff --git a/gcc/testsuite/gcc.target/mips/code-readable-3.c b/gcc/testsuite/gcc.target/mips/code-readable-3.c index bea568ccf0a..5afa136c1c5 100644 --- a/gcc/testsuite/gcc.target/mips/code-readable-3.c +++ b/gcc/testsuite/gcc.target/mips/code-readable-3.c @@ -1,6 +1,6 @@ +/* { dg-do compile { target mips16_attribute } } */ /* { dg-mips-options "-mcode-readable=no -mgp32" } */ - -#define MIPS16 __attribute__ ((mips16)) +/* { dg-add-options mips16_attribute } */ MIPS16 int foo (int i) diff --git a/gcc/testsuite/gcc.target/mips/dspr2-MULT.c b/gcc/testsuite/gcc.target/mips/dspr2-MULT.c index 056042e9e3a..bc6f3cc10de 100644 --- a/gcc/testsuite/gcc.target/mips/dspr2-MULT.c +++ b/gcc/testsuite/gcc.target/mips/dspr2-MULT.c @@ -7,8 +7,6 @@ /* { dg-final { scan-assembler "ac2" } } */ /* { dg-final { scan-assembler "ac3" } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - typedef long long a64; a64 a[4]; int b[4], c[4]; diff --git a/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c b/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c index 7532b329799..c6fef7eab78 100644 --- a/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c +++ b/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c @@ -7,8 +7,6 @@ /* { dg-final { scan-assembler "ac2" } } */ /* { dg-final { scan-assembler "ac3" } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - typedef long long a64; a64 a[4]; unsigned int b[4], c[4]; diff --git a/gcc/testsuite/gcc.target/mips/fpcmp-1.c b/gcc/testsuite/gcc.target/mips/fpcmp-1.c index e3206a589a5..19e66f96b78 100644 --- a/gcc/testsuite/gcc.target/mips/fpcmp-1.c +++ b/gcc/testsuite/gcc.target/mips/fpcmp-1.c @@ -1,7 +1,5 @@ /* We used to use c.lt.fmt instead of c.ule.fmt here. */ /* { dg-mips-options "-mhard-float -O2" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int f1 (float x, float y) { return __builtin_isless (x, y); } NOMIPS16 int f2 (double x, double y) { return __builtin_isless (x, y); } /* { dg-final { scan-assembler "c\\.ule\\.s" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fpcmp-2.c b/gcc/testsuite/gcc.target/mips/fpcmp-2.c index 9f89417668f..9c1090bb4ba 100644 --- a/gcc/testsuite/gcc.target/mips/fpcmp-2.c +++ b/gcc/testsuite/gcc.target/mips/fpcmp-2.c @@ -1,7 +1,5 @@ /* We used to use c.le.fmt instead of c.ult.fmt here. */ /* { dg-mips-options "-mhard-float -O2" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int f1 (float x, float y) { return __builtin_islessequal (x, y); } NOMIPS16 int f2 (double x, double y) { return __builtin_islessequal (x, y); } /* { dg-final { scan-assembler "c\\.ult\\.s" } } */ diff --git a/gcc/testsuite/gcc.target/mips/ins-1.c b/gcc/testsuite/gcc.target/mips/ins-1.c index 2eaf7c4433c..77047af60b9 100644 --- a/gcc/testsuite/gcc.target/mips/ins-1.c +++ b/gcc/testsuite/gcc.target/mips/ins-1.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-O -march=mips32r2" } */ /* { dg-final { scan-assembler "\tins\t" } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - struct { unsigned int i : 2; diff --git a/gcc/testsuite/gcc.target/mips/madd-3.c b/gcc/testsuite/gcc.target/mips/madd-3.c index 633dae34b61..8526a5e1806 100644 --- a/gcc/testsuite/gcc.target/mips/madd-3.c +++ b/gcc/testsuite/gcc.target/mips/madd-3.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 long long f1 (int x, int y, long long z) { diff --git a/gcc/testsuite/gcc.target/mips/maddu-3.c b/gcc/testsuite/gcc.target/mips/maddu-3.c index a332e9c592e..b3cc5105554 100644 --- a/gcc/testsuite/gcc.target/mips/maddu-3.c +++ b/gcc/testsuite/gcc.target/mips/maddu-3.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - typedef unsigned int ui; typedef unsigned long long ull; diff --git a/gcc/testsuite/gcc.target/mips/mips-sched-madd.c b/gcc/testsuite/gcc.target/mips/mips-sched-madd.c index 40e1fc28a61..92f14e1f3bc 100644 --- a/gcc/testsuite/gcc.target/mips/mips-sched-madd.c +++ b/gcc/testsuite/gcc.target/mips/mips-sched-madd.c @@ -1,9 +1,9 @@ /* Test for case where another independent multiply insn may interfere with a macc chain. */ /* { dg-do compile } */ -/* { dg-mips-options "-Os -march=24kf -mno-mips16" } */ +/* { dg-mips-options "-Os -march=24kf" } */ -int foo (int a, int b, int c, int d, int e, int f, int g) +NOMIPS16 int foo (int a, int b, int c, int d, int e, int f, int g) { int temp; int acc; diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp index 3e10eba12a3..0aaa2a7d951 100644 --- a/gcc/testsuite/gcc.target/mips/mips.exp +++ b/gcc/testsuite/gcc.target/mips/mips.exp @@ -122,9 +122,6 @@ proc is_gp32_flag {flag} { # if the other flags don't do so. Skip the test if the multilib # flags force a 32-bit ABI or a 32-bit architecture. # -# -mno-mips16 -# Skip the test for MIPS16 targets. -# # -march=* # -mips* # Select the target architecture. Skip the test for MIPS16 targets @@ -194,11 +191,7 @@ proc dg-mips-options {args} { } # Handle the other options. foreach flag $flags { - if {$flag == "-mno-mips16"} { - if {$mips_mips16} { - set matches 0 - } - } elseif {$flag == "-mfp64"} { + if {$flag == "-mfp64"} { if {$mips_isa < 33 || $mips_float != "hard"} { set matches 0 } @@ -230,7 +223,7 @@ proc dg-mips-options {args} { } } if {$matches} { - set extra_tool_flags $flags + append extra_tool_flags " " $flags } else { set do_what [list [lindex $do_what 0] "N" "P"] } @@ -239,5 +232,6 @@ proc dg-mips-options {args} { setup_mips_tests dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" "" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" \ + "-DMIPS16=__attribute__((mips16)) -DNOMIPS16=__attribute__((nomips16))" dg-finish diff --git a/gcc/testsuite/gcc.target/mips/mips16-attributes-2.c b/gcc/testsuite/gcc.target/mips/mips16-attributes-2.c index eeadf8129b8..edab378c218 100644 --- a/gcc/testsuite/gcc.target/mips/mips16-attributes-2.c +++ b/gcc/testsuite/gcc.target/mips/mips16-attributes-2.c @@ -1,4 +1,6 @@ +/* { dg-do compile { target mips16_attribute } } */ /* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */ +/* { dg-add-options mips16_attribute } */ void f1 (void); void __attribute__((mips16)) f1 (void) {} /* { dg-error "conflicting" } */ diff --git a/gcc/testsuite/gcc.target/mips/mips16e-extends.c b/gcc/testsuite/gcc.target/mips/mips16e-extends.c index 1107328b002..df43c415cd1 100644 --- a/gcc/testsuite/gcc.target/mips/mips16e-extends.c +++ b/gcc/testsuite/gcc.target/mips/mips16e-extends.c @@ -1,14 +1,15 @@ -/* { dg-do compile } */ -/* { dg-mips-options "-Os -march=mips32 -mips16" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-Os -march=mips32" } */ +/* { dg-add-options mips16_attribute } */ -short cksum16 (unsigned long n) +MIPS16 short cksum16 (unsigned long n) { unsigned long l; l = validate (n, (n >> 16) + (n & 0xffff)); return l; } -signed char cksum8 (unsigned long n) +MIPS16 signed char cksum8 (unsigned long n) { unsigned long l; l = validate (n, (n >> 8) + (n & 0xff)); diff --git a/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c b/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c index 89f043867cd..c82f68ee38f 100644 --- a/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c +++ b/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c @@ -2,8 +2,6 @@ /* { dg-do run { target mipsisa32r2*-*-* } } */ /* { dg-mips-options "-march=mips32r2 -mdsp -O2" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - #include #include diff --git a/gcc/testsuite/gcc.target/mips/mips32-dspr2-type.c b/gcc/testsuite/gcc.target/mips/mips32-dspr2-type.c index 710937cc411..5d231983b22 100644 --- a/gcc/testsuite/gcc.target/mips/mips32-dspr2-type.c +++ b/gcc/testsuite/gcc.target/mips/mips32-dspr2-type.c @@ -3,8 +3,6 @@ /* { dg-mips-options "-march=mips32r2 -mdspr2" } */ /* { dg-final { scan-assembler "\tmul.ph\t" } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - typedef short v2hi __attribute__ ((vector_size(4))); NOMIPS16 v2hi mul_v2hi (v2hi a, v2hi b) diff --git a/gcc/testsuite/gcc.target/mips/msub-3.c b/gcc/testsuite/gcc.target/mips/msub-3.c index e24075641dc..97dccf2fd97 100644 --- a/gcc/testsuite/gcc.target/mips/msub-3.c +++ b/gcc/testsuite/gcc.target/mips/msub-3.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 long long f1 (int x, int y, long long z) { diff --git a/gcc/testsuite/gcc.target/mips/msubu-3.c b/gcc/testsuite/gcc.target/mips/msubu-3.c index 1c01f5cd25c..ee5dd6a9cf9 100644 --- a/gcc/testsuite/gcc.target/mips/msubu-3.c +++ b/gcc/testsuite/gcc.target/mips/msubu-3.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - typedef unsigned int ui; typedef unsigned long long ull; diff --git a/gcc/testsuite/gcc.target/mips/near-far-3.c b/gcc/testsuite/gcc.target/mips/near-far-3.c index 1ce3f1967da..bde44e54366 100644 --- a/gcc/testsuite/gcc.target/mips/near-far-3.c +++ b/gcc/testsuite/gcc.target/mips/near-far-3.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-mlong-calls -O2" } */ /* { dg-require-effective-target nonpic } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 extern int long_call_func () __attribute__((long_call)); NOMIPS16 extern int far_func () __attribute__((far)); NOMIPS16 extern int near_func () __attribute__((near)); diff --git a/gcc/testsuite/gcc.target/mips/near-far-4.c b/gcc/testsuite/gcc.target/mips/near-far-4.c index e1725f21f16..f79216860ba 100644 --- a/gcc/testsuite/gcc.target/mips/near-far-4.c +++ b/gcc/testsuite/gcc.target/mips/near-far-4.c @@ -2,8 +2,6 @@ /* { dg-mips-options "-mno-long-calls -O2" } */ /* { dg-require-effective-target nonpic } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 extern int long_call_func () __attribute__((long_call)); NOMIPS16 extern int far_func () __attribute__((far)); NOMIPS16 extern int near_func () __attribute__((near)); diff --git a/gcc/testsuite/gcc.target/mips/neg-abs-1.c b/gcc/testsuite/gcc.target/mips/neg-abs-1.c index 6c1d1baae56..e5daa291af0 100644 --- a/gcc/testsuite/gcc.target/mips/neg-abs-1.c +++ b/gcc/testsuite/gcc.target/mips/neg-abs-1.c @@ -7,8 +7,6 @@ /* { dg-final { scan-assembler "abs.s" } } */ /* { dg-final { scan-assembler "abs.d" } } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 float f1 (float f) { return -f; } NOMIPS16 float f2 (float f) { return __builtin_fabsf (f); } NOMIPS16 double d1 (double d) { return -d; } diff --git a/gcc/testsuite/gcc.target/mips/pr26765.c b/gcc/testsuite/gcc.target/mips/pr26765.c index cd1d9fe8bad..bf90f279174 100644 --- a/gcc/testsuite/gcc.target/mips/pr26765.c +++ b/gcc/testsuite/gcc.target/mips/pr26765.c @@ -2,12 +2,10 @@ This testcase used to trigger an unrecognizable insn. */ /* { dg-do compile } */ -/* { dg-options "-O2 -w" } */ +/* { dg-mips-options "-O2 -w" } */ __thread int *a = 0; -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 void foo (void) { extern int *b; diff --git a/gcc/testsuite/gcc.target/mips/save-restore-1.c b/gcc/testsuite/gcc.target/mips/save-restore-1.c index 95689b5b618..721d6012271 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-1.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-1.c @@ -1,10 +1,13 @@ /* Check that we can use the save instruction to save varargs. */ -/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -O2" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ +/* { dg-add-options mips16_attribute } */ + #include int bar (int, va_list ap); -int +MIPS16 int foo (int n, ...) { va_list ap; diff --git a/gcc/testsuite/gcc.target/mips/save-restore-2.c b/gcc/testsuite/gcc.target/mips/save-restore-2.c index 9a73843fe2c..b7f8c07e3c2 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-2.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-2.c @@ -1,6 +1,9 @@ /* Check that we can use the save instruction to save spilled arguments. */ -/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -O2" } */ -void +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ +/* { dg-add-options mips16_attribute } */ + +MIPS16 void foo (int *a, int b, int c) { asm volatile ("" ::: "$2", "$3", "$4", "$5", "$6", "$7", "$8", diff --git a/gcc/testsuite/gcc.target/mips/save-restore-3.c b/gcc/testsuite/gcc.target/mips/save-restore-3.c index 42212365a80..18b871f830a 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-3.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-3.c @@ -1,9 +1,12 @@ /* Check that we can use the save instruction to save spilled arguments when the argument save area is out of range of a direct load or store. */ -/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -O2" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ +/* { dg-add-options mips16_attribute } */ + void bar (int *); -void +MIPS16 void foo (int *a, int b, int c) { int x[0x4000]; diff --git a/gcc/testsuite/gcc.target/mips/save-restore-4.c b/gcc/testsuite/gcc.target/mips/save-restore-4.c index 10bf141c47f..4a8f13634ed 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-4.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-4.c @@ -1,7 +1,11 @@ /* Check that we can use the save instruction to save $16, $17 and $31. */ -/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -O2" } */ +/* { dg-do compile { target mips16_attribute } } */ +/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ +/* { dg-add-options mips16_attribute } */ + void bar (void); -void + +MIPS16 void foo (void) { bar (); diff --git a/gcc/testsuite/gcc.target/mips/save-restore-5.c b/gcc/testsuite/gcc.target/mips/save-restore-5.c index 9114daf02aa..a7e82ba144f 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-5.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-5.c @@ -1,11 +1,12 @@ /* Check that we don't try to save the same register twice. */ -/* { dg-do assemble } */ -/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -mno-abicalls -O2" } */ +/* { dg-do assemble { target mips16_attribute } } */ +/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ +/* { dg-add-options mips16_attribute } */ int bar (int, int, int, int); void frob (void); -void +MIPS16 void foo (int a1, int a2, int a3, int a4) { asm volatile ("" ::: "$2", "$3", "$4", "$5", "$6", "$7", "$8", diff --git a/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c b/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c index f51fda1e360..17b2ddfefb3 100644 --- a/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c +++ b/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c @@ -1,8 +1,6 @@ /* { dg-do compile } */ /* { dg-mips-options "-O -msmartmips" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int scaled_indexed_word_load (int a[], int b) { return a[b]; diff --git a/gcc/testsuite/gcc.target/mips/smartmips-ror-1.c b/gcc/testsuite/gcc.target/mips/smartmips-ror-1.c index c6a0013b7df..c36964624f5 100644 --- a/gcc/testsuite/gcc.target/mips/smartmips-ror-1.c +++ b/gcc/testsuite/gcc.target/mips/smartmips-ror-1.c @@ -1,8 +1,6 @@ /* { dg-do compile } */ /* { dg-mips-options "-O -msmartmips" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int rotate_left (unsigned a, unsigned s) { return (a << s) | (a >> (32 - s)); diff --git a/gcc/testsuite/gcc.target/mips/smartmips-ror-2.c b/gcc/testsuite/gcc.target/mips/smartmips-ror-2.c index 2f3da55e8ac..73561c8b3c1 100644 --- a/gcc/testsuite/gcc.target/mips/smartmips-ror-2.c +++ b/gcc/testsuite/gcc.target/mips/smartmips-ror-2.c @@ -1,8 +1,6 @@ /* { dg-do compile } */ /* { dg-mips-options "-O -msmartmips" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - NOMIPS16 int rotate_right (unsigned a, unsigned s) { return (a >> s) | (a << (32 - s)); diff --git a/gcc/testsuite/gcc.target/mips/smartmips-ror-3.c b/gcc/testsuite/gcc.target/mips/smartmips-ror-3.c index 6dad55a6444..dada19efc71 100644 --- a/gcc/testsuite/gcc.target/mips/smartmips-ror-3.c +++ b/gcc/testsuite/gcc.target/mips/smartmips-ror-3.c @@ -1,8 +1,6 @@ /* { dg-do compile } */ /* { dg-mips-options "-O -msmartmips" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - #define S 13 NOMIPS16 int rotate_left_constant (unsigned a) diff --git a/gcc/testsuite/gcc.target/mips/smartmips-ror-4.c b/gcc/testsuite/gcc.target/mips/smartmips-ror-4.c index 722dedcdae7..ee063614d74 100644 --- a/gcc/testsuite/gcc.target/mips/smartmips-ror-4.c +++ b/gcc/testsuite/gcc.target/mips/smartmips-ror-4.c @@ -1,8 +1,6 @@ /* { dg-do compile } */ /* { dg-mips-options "-O -msmartmips" } */ -#define NOMIPS16 __attribute__ ((nomips16)) - #define S 13 NOMIPS16 int rotate_right_constant (unsigned a) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 7c6aef09b81..c7c0ceeab74 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -625,6 +625,23 @@ proc check_effective_target_mips64 { } { }] } +# Add the options needed for MIPS16 function attributes. At the moment, +# we don't support MIPS16 PIC. + +proc add_options_for_mips16_attribute { flags } { + return "$flags -mno-abicalls -fno-pic" +} + +# Return true if we can force a mode that allows MIPS16 code generation. + +proc check_effective_target_mips16_attribute { } { + return [check_no_compiler_messages mips16_attribute assembly { + #if __PIC__ + #error FOO + #endif + } [add_options_for_mips16_attribute ""]] +} + # Return 1 if the current multilib does not generate PIC by default. proc check_effective_target_nonpic { } { -- 2.11.4.GIT