sourcebuild.texi: Document dg-add-options mips16_attribute.
authorRichard Sandiford <rsandifo@nildram.co.uk>
Sat, 22 Sep 2007 20:10:52 +0000 (20:10 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 22 Sep 2007 20:10:52 +0000 (20:10 +0000)
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

44 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/20020620-1.c
gcc/testsuite/gcc.target/mips/asm-1.c
gcc/testsuite/gcc.target/mips/atomic-memory-1.c
gcc/testsuite/gcc.target/mips/atomic-memory-2.c
gcc/testsuite/gcc.target/mips/branch-1.c
gcc/testsuite/gcc.target/mips/call-saved-1.c
gcc/testsuite/gcc.target/mips/call-saved-2.c
gcc/testsuite/gcc.target/mips/call-saved-3.c
gcc/testsuite/gcc.target/mips/code-readable-1.c
gcc/testsuite/gcc.target/mips/code-readable-2.c
gcc/testsuite/gcc.target/mips/code-readable-3.c
gcc/testsuite/gcc.target/mips/dspr2-MULT.c
gcc/testsuite/gcc.target/mips/dspr2-MULTU.c
gcc/testsuite/gcc.target/mips/fpcmp-1.c
gcc/testsuite/gcc.target/mips/fpcmp-2.c
gcc/testsuite/gcc.target/mips/ins-1.c
gcc/testsuite/gcc.target/mips/madd-3.c
gcc/testsuite/gcc.target/mips/maddu-3.c
gcc/testsuite/gcc.target/mips/mips-sched-madd.c
gcc/testsuite/gcc.target/mips/mips.exp
gcc/testsuite/gcc.target/mips/mips16-attributes-2.c
gcc/testsuite/gcc.target/mips/mips16e-extends.c
gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
gcc/testsuite/gcc.target/mips/mips32-dspr2-type.c
gcc/testsuite/gcc.target/mips/msub-3.c
gcc/testsuite/gcc.target/mips/msubu-3.c
gcc/testsuite/gcc.target/mips/near-far-3.c
gcc/testsuite/gcc.target/mips/near-far-4.c
gcc/testsuite/gcc.target/mips/neg-abs-1.c
gcc/testsuite/gcc.target/mips/pr26765.c
gcc/testsuite/gcc.target/mips/save-restore-1.c
gcc/testsuite/gcc.target/mips/save-restore-2.c
gcc/testsuite/gcc.target/mips/save-restore-3.c
gcc/testsuite/gcc.target/mips/save-restore-4.c
gcc/testsuite/gcc.target/mips/save-restore-5.c
gcc/testsuite/gcc.target/mips/smartmips-lwxs.c
gcc/testsuite/gcc.target/mips/smartmips-ror-1.c
gcc/testsuite/gcc.target/mips/smartmips-ror-2.c
gcc/testsuite/gcc.target/mips/smartmips-ror-3.c
gcc/testsuite/gcc.target/mips/smartmips-ror-4.c
gcc/testsuite/lib/target-supports.exp

index a96789122a252e221aa584a9e1bd87ffd1a4e1f8..85934036f35792cb6dd7a97064ab66e1ae191e16 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-22  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       * doc/sourcebuild.texi: Document dg-add-options mips16_attribute.
+
 2007-09-22  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-inline.c (remap_type_1): Correctly chain variants.
index 4f78d735572fcb4d6480ae6dc3629786bddd9e8a..6f6dcd01e9024a5dde40004ee6a0813042003023 100644 (file)
@@ -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} @} @}
index bad8331471475688ed692ba27e5198a84d30ed32..0dd4f60088c21a6a9c9c7cc37f4f3ae5497fb2ed 100644 (file)
@@ -1,3 +1,67 @@
+2007-09-22  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       * 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  <pault@gcc.gnu.org>
 
        PR fortran/33337
index ea6b9d5a74f210ad6d8e45dd549e35630f4cf208..f4828f439e7d43598438529cbecba7809f11e6bf 100644 (file)
@@ -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;
index d202d6cbdd45a0e512d6f934b7f8ee4e52fc7692..ab5d8f8c480402e9b3f0cc2749b3b262d2179a8b 100644 (file)
@@ -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;
index b44bd46cf7ee0a2d1b4094fe3bb75f6d2c03d598..e9a95eaa4fc4751c6bb8751f4fded35644bdc409 100644 (file)
@@ -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
index 18ec64d004ad72b01888de2910a240812b5cf46c..34214e4476a85c13ae38b4b4161dfdb33f14784d 100644 (file)
@@ -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)
 {
index 7caf2986baf20e62892dfc70b1f0e11bb412aae5..8c991dd9ff1e461fae2d5de523e1bf6ba196ddbb 100644 (file)
@@ -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 (); }
index 957b0c598bd60353e2411cc7e39f994e3ce58a02..42d2dfbfadad4d1405d2b5cf641a129c09d27995 100644 (file)
@@ -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 ();
index 892889672835fc53b1c8036fd7ec255d853239fd..80ca92cf1a10e2b1050f449865746329e4ccdd4e 100644 (file)
@@ -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");
index f1d93793b3c49a184482b17840af2fedb62d24ad..5f71c85ec4ab5dc1323ea775edf8de3b1bc33fc0 100644 (file)
@@ -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)
index 8add1c7aa8337a12f562c709cada6888f649708a..7a58457d9294fe6fa03c7d24a2ce993267afbe2e 100644 (file)
@@ -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)
index c23254842768a24c5a09b740fa1d3c0c21fba102..18a1218eb388beaa9529c8886a75174187086598 100644 (file)
@@ -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)
index bea568ccf0afc57cfd9b280ecb2574589bfe43e7..5afa136c1c5f86a29035d404d7b6e0c61d5a0a62 100644 (file)
@@ -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)
index 056042e9e3a3045acc0d52cb1acdc82c7833abc0..bc6f3cc10de37eddc42cd5fcbe883d7669d203e1 100644 (file)
@@ -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];
index 7532b329799113145a1430c498d6f2528b271063..c6fef7eab78d68662f9561004004458e2a8727c1 100644 (file)
@@ -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];
index e3206a589a512809d807cd93c4671185585e177d..19e66f96b7829e9764bdd9b3c19cec1a3e3f97a6 100644 (file)
@@ -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" } } */
index 9f89417668fb452c18b103df6fd726c9a8b82036..9c1090bb4bac89f93ee8b3600ec82919be9a295a 100644 (file)
@@ -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" } } */
index 2eaf7c4433c6d796d3a4dc4a5e6c63cb81f8556e..77047af60b953e1ecbca185282f5835b360c9845 100644 (file)
@@ -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;
index 633dae34b615f23a84c3c14a61b8854428a4475f..8526a5e18063326b563ea034e5e59634fe125c7f 100644 (file)
@@ -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)
 {
index a332e9c592e10934fb8ff116ef447971520a7085..b3cc5105554da85a8b01d78751f270d7cb0f8130 100644 (file)
@@ -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;
 
index 40e1fc28a6128dfc4181181ca1f9c308c65a6646..92f14e1f3bcff2c517c8613469c8df061d29f00e 100644 (file)
@@ -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;
index 3e10eba12a3cb5b3bfd3f85f02978b91765b026c..0aaa2a7d9510d2946ab45d520c06e2bdfe47e0e2 100644 (file)
@@ -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
index eeadf8129b8b5d03482a1b90f03ab95b978033bb..edab378c218138872080ddffa7816b6109783bd0 100644 (file)
@@ -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" } */
index 1107328b00267096954c27ef016cd48f204491fd..df43c415cd1b709939bd6f3db8a6bdcb55850fca 100644 (file)
@@ -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));
index 89f043867cd5069c9a06623ece7e9fc8cec7fa7b..c82f68ee38f8cd72f68e26a95814a02048ecf0bf 100644 (file)
@@ -2,8 +2,6 @@
 /* { dg-do run { target mipsisa32r2*-*-* } } */
 /* { dg-mips-options "-march=mips32r2 -mdsp -O2" } */
 
-#define NOMIPS16 __attribute__ ((nomips16)) 
-
 #include <stdlib.h>
 #include <stdio.h>
 
index 710937cc411312e1030e157e661408a633b8a57c..5d231983b22b6eaa04191575b626260fa620aee0 100644 (file)
@@ -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)
index e24075641dc07ea79a916e552ba2538f14666c9c..97dccf2fd9724cb125d0292e69db54b0e3ea6fbf 100644 (file)
@@ -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)
 {
index 1c01f5cd25c18c72128500db5eab1f87fa8805e4..ee5dd6a9cf902cdf460b51327921074908d3377e 100644 (file)
@@ -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;
 
index 1ce3f1967daef8b939a69dcd00f0e8bdfe2d71e2..bde44e54366aff65d72af67a35a3c64ea7ee1624 100644 (file)
@@ -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));
index e1725f21f162f02b1d45baf3334e7df14b9586bc..f79216860bacf1f56d51e6fe5ef3a18ddaeb506f 100644 (file)
@@ -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));
index 6c1d1baae5670d089bd7fe11b98b51a621e23383..e5daa291af05ea0fb0fca00bd361d33f9e85f254 100644 (file)
@@ -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; }
index cd1d9fe8badd7be0a5ef17eb213c350e30dfca04..bf90f2791749147d3d17c842a738d488f17fb57a 100644 (file)
@@ -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;
index 95689b5b618ab7dfa76ea331d9e67e7367103253..721d60122718fc849a5680c61ecf457c55d0a3ec 100644 (file)
@@ -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 <stdarg.h>
 
 int bar (int, va_list ap);
 
-int
+MIPS16 int
 foo (int n, ...)
 {
   va_list ap;
index 9a73843fe2c4f798065d085dba75cd589fcf9644..b7f8c07e3c2bb8fb87cdc11b26b617d77efa4e56 100644 (file)
@@ -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",
index 42212365a807680fc64243e7415037f3f915e30b..18b871f830ab8be122eb3c185cb171e45733327a 100644 (file)
@@ -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];
index 10bf141c47f148dd866886223e8267af5fafcc9d..4a8f13634ed7636ddf16eff9f8fe58d8a2026e1e 100644 (file)
@@ -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 ();
index 9114daf02aa56dac0f832646a96f1c36bf72d394..a7e82ba144fd4159b6c8caae4c30a97a53db4cf3 100644 (file)
@@ -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",
index f51fda1e360a89ff105d0ed08728c32ec7af48a2..17b2ddfefb36f85d0d585f53cd6970579bfddb52 100644 (file)
@@ -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];
index c6a0013b7df5e64d62daa2a9bde7dc1ae474b368..c36964624f52c2358b612643fb8a2579d359fddb 100644 (file)
@@ -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));
index 2f3da55e8ac833a263407598f68361705bfb2d15..73561c8b3c172a7c936a7ef190e3dc98fd7e93f7 100644 (file)
@@ -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));
index 6dad55a64446b1c8cc14cc5ed3d88a4492d586df..dada19efc719068b825d8a97c41efcdfdc70ff29 100644 (file)
@@ -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)
index 722dedcdae76e5b17aa276ef470f6da7b8152388..ee063614d7406c63f0593b770a7299aaa459993d 100644 (file)
@@ -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)
index 7c6aef09b8186eef3c5ef05a03b0fa5a45b352f7..c7c0ceeab74f26dd3f0b079cd8bb6476c696d98f 100644 (file)
@@ -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 { } {