Commit 7dded683 by Richard Sandiford Committed by Richard Sandiford

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
parent d8eff1b8
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> 2007-09-22 Eric Botcazou <ebotcazou@adacore.com>
* tree-inline.c (remap_type_1): Correctly chain variants. * tree-inline.c (remap_type_1): Correctly chain variants.
...@@ -983,6 +983,10 @@ The supported values of @var{feature} are: ...@@ -983,6 +983,10 @@ The supported values of @var{feature} are:
@table @code @table @code
@item c99_runtime @item c99_runtime
The target's C99 runtime (both headers and libraries). 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 @end table
@item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} @item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @}
......
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> 2007-09-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/33337 PR fortran/33337
/* { dg-do compile { target mips64*-*-* mipsisa64*-*-* } } */ /* { dg-do compile { target mips64*-*-* mipsisa64*-*-* } } */
/* { dg-options "-O2 -mlong64" } */ /* { dg-mips-options "-O2 -mlong64" } */
int foo (int *x, int i) int foo (int *x, int i)
{ {
return x[i] + i; return x[i] + i;
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
/* { dg-do assemble } */ /* { dg-do assemble } */
/* { dg-mips-options "-O" } */ /* { dg-mips-options "-O" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int foo (int n) NOMIPS16 int foo (int n)
{ {
register int k asm ("$16") = n; register int k asm ("$16") = n;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
extern void abort (void); extern void abort (void);
extern void exit (int); extern void exit (int);
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int main () NOMIPS16 int main ()
{ {
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
/* { dg-final { scan-assembler "addiu" } } */ /* { dg-final { scan-assembler "addiu" } } */
/* { dg-final { scan-assembler-not "subu" } } */ /* { dg-final { scan-assembler-not "subu" } } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 unsigned long NOMIPS16 unsigned long
f(unsigned long *p) f(unsigned long *p)
{ {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
followed by a branch on zero. */ followed by a branch on zero. */
/* { dg-mips-options "-O2" } */ /* { dg-mips-options "-O2" } */
#define NOMIPS16 __attribute__ ((nomips16))
void bar (void); void bar (void);
NOMIPS16 void f1 (int x) { if (x & 4) bar (); } NOMIPS16 void f1 (int x) { if (x & 4) bar (); }
NOMIPS16 void f2 (int x) { if ((x >> 2) & 1) bar (); } NOMIPS16 void f2 (int x) { if ((x >> 2) & 1) bar (); }
......
/* Check that we save all call-saved GPRs in a MIPS16 __builtin_eh_return /* Check that we save all call-saved GPRs in a MIPS16 __builtin_eh_return
function. */ 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 bar (void);
void
MIPS16 void
foo (int x) foo (int x)
{ {
__builtin_unwind_init (); __builtin_unwind_init ();
......
/* Check that we save non-MIPS16 GPRs if they are explicitly clobbered. */ /* 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) foo (void)
{ {
asm volatile ("" ::: "$19", "$23", "$24", "$30"); asm volatile ("" ::: "$19", "$23", "$24", "$30");
......
/* Check that we save all call-saved GPRs in a MIPS16 __builtin_setjmp /* Check that we save all call-saved GPRs in a MIPS16 __builtin_setjmp
function. */ 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); void bar (void);
extern int buf[]; extern int buf[];
void
MIPS16 void
foo (int x) foo (int x)
{ {
if (__builtin_setjmp (buf) == 0) if (__builtin_setjmp (buf) == 0)
......
/* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mcode-readable=yes -mgp32" } */ /* { dg-mips-options "-mcode-readable=yes -mgp32" } */
/* { dg-add-options mips16_attribute } */
#define MIPS16 __attribute__ ((mips16)) MIPS16 int
MIPS16 int
foo (int i) foo (int i)
{ {
switch (i) switch (i)
......
/* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mcode-readable=pcrel -mgp32" } */ /* { dg-mips-options "-mcode-readable=pcrel -mgp32" } */
/* { dg-add-options mips16_attribute } */
#define MIPS16 __attribute__ ((mips16))
MIPS16 int MIPS16 int
foo (int i) foo (int i)
......
/* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mcode-readable=no -mgp32" } */ /* { dg-mips-options "-mcode-readable=no -mgp32" } */
/* { dg-add-options mips16_attribute } */
#define MIPS16 __attribute__ ((mips16))
MIPS16 int MIPS16 int
foo (int i) foo (int i)
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
/* { dg-final { scan-assembler "ac2" } } */ /* { dg-final { scan-assembler "ac2" } } */
/* { dg-final { scan-assembler "ac3" } } */ /* { dg-final { scan-assembler "ac3" } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef long long a64; typedef long long a64;
a64 a[4]; a64 a[4];
int b[4], c[4]; int b[4], c[4];
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
/* { dg-final { scan-assembler "ac2" } } */ /* { dg-final { scan-assembler "ac2" } } */
/* { dg-final { scan-assembler "ac3" } } */ /* { dg-final { scan-assembler "ac3" } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef long long a64; typedef long long a64;
a64 a[4]; a64 a[4];
unsigned int b[4], c[4]; unsigned int b[4], c[4];
......
/* We used to use c.lt.fmt instead of c.ule.fmt here. */ /* We used to use c.lt.fmt instead of c.ule.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */ /* { dg-mips-options "-mhard-float -O2" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int f1 (float x, float y) { return __builtin_isless (x, y); } NOMIPS16 int f1 (float x, float y) { return __builtin_isless (x, y); }
NOMIPS16 int f2 (double x, double 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" } } */ /* { dg-final { scan-assembler "c\\.ule\\.s" } } */
......
/* We used to use c.le.fmt instead of c.ult.fmt here. */ /* We used to use c.le.fmt instead of c.ult.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */ /* { dg-mips-options "-mhard-float -O2" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int f1 (float x, float y) { return __builtin_islessequal (x, y); } NOMIPS16 int f1 (float x, float y) { return __builtin_islessequal (x, y); }
NOMIPS16 int f2 (double x, double 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" } } */ /* { dg-final { scan-assembler "c\\.ult\\.s" } } */
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-O -march=mips32r2" } */ /* { dg-mips-options "-O -march=mips32r2" } */
/* { dg-final { scan-assembler "\tins\t" } } */ /* { dg-final { scan-assembler "\tins\t" } } */
#define NOMIPS16 __attribute__ ((nomips16))
struct struct
{ {
unsigned int i : 2; unsigned int i : 2;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 long long NOMIPS16 long long
f1 (int x, int y, long long z) f1 (int x, int y, long long z)
{ {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef unsigned int ui; typedef unsigned int ui;
typedef unsigned long long ull; typedef unsigned long long ull;
......
/* Test for case where another independent multiply insn may interfere /* Test for case where another independent multiply insn may interfere
with a macc chain. */ with a macc chain. */
/* { dg-do compile } */ /* { 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 temp;
int acc; int acc;
......
...@@ -122,9 +122,6 @@ proc is_gp32_flag {flag} { ...@@ -122,9 +122,6 @@ proc is_gp32_flag {flag} {
# if the other flags don't do so. Skip the test if the multilib # 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. # flags force a 32-bit ABI or a 32-bit architecture.
# #
# -mno-mips16
# Skip the test for MIPS16 targets.
#
# -march=* # -march=*
# -mips* # -mips*
# Select the target architecture. Skip the test for MIPS16 targets # Select the target architecture. Skip the test for MIPS16 targets
...@@ -194,11 +191,7 @@ proc dg-mips-options {args} { ...@@ -194,11 +191,7 @@ proc dg-mips-options {args} {
} }
# Handle the other options. # Handle the other options.
foreach flag $flags { foreach flag $flags {
if {$flag == "-mno-mips16"} { if {$flag == "-mfp64"} {
if {$mips_mips16} {
set matches 0
}
} elseif {$flag == "-mfp64"} {
if {$mips_isa < 33 || $mips_float != "hard"} { if {$mips_isa < 33 || $mips_float != "hard"} {
set matches 0 set matches 0
} }
...@@ -230,7 +223,7 @@ proc dg-mips-options {args} { ...@@ -230,7 +223,7 @@ proc dg-mips-options {args} {
} }
} }
if {$matches} { if {$matches} {
set extra_tool_flags $flags append extra_tool_flags " " $flags
} else { } else {
set do_what [list [lindex $do_what 0] "N" "P"] set do_what [list [lindex $do_what 0] "N" "P"]
} }
...@@ -239,5 +232,6 @@ proc dg-mips-options {args} { ...@@ -239,5 +232,6 @@ proc dg-mips-options {args} {
setup_mips_tests setup_mips_tests
dg-init 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 dg-finish
/* { dg-do compile { target mips16_attribute } } */
/* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */ /* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */
/* { dg-add-options mips16_attribute } */
void f1 (void); void f1 (void);
void __attribute__((mips16)) f1 (void) {} /* { dg-error "conflicting" } */ void __attribute__((mips16)) f1 (void) {} /* { dg-error "conflicting" } */
......
/* { dg-do compile } */ /* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-Os -march=mips32 -mips16" } */ /* { 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; unsigned long l;
l = validate (n, (n >> 16) + (n & 0xffff)); l = validate (n, (n >> 16) + (n & 0xffff));
return l; return l;
} }
signed char cksum8 (unsigned long n) MIPS16 signed char cksum8 (unsigned long n)
{ {
unsigned long l; unsigned long l;
l = validate (n, (n >> 8) + (n & 0xff)); l = validate (n, (n >> 8) + (n & 0xff));
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-do run { target mipsisa32r2*-*-* } } */ /* { dg-do run { target mipsisa32r2*-*-* } } */
/* { dg-mips-options "-march=mips32r2 -mdsp -O2" } */ /* { dg-mips-options "-march=mips32r2 -mdsp -O2" } */
#define NOMIPS16 __attribute__ ((nomips16))
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
/* { dg-mips-options "-march=mips32r2 -mdspr2" } */ /* { dg-mips-options "-march=mips32r2 -mdspr2" } */
/* { dg-final { scan-assembler "\tmul.ph\t" } } */ /* { dg-final { scan-assembler "\tmul.ph\t" } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef short v2hi __attribute__ ((vector_size(4))); typedef short v2hi __attribute__ ((vector_size(4)));
NOMIPS16 v2hi mul_v2hi (v2hi a, v2hi b) NOMIPS16 v2hi mul_v2hi (v2hi a, v2hi b)
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */ /* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 long long NOMIPS16 long long
f1 (int x, int y, long long z) f1 (int x, int y, long long z)
{ {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-mips-options "-O2 -mips32 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */ /* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */
#define NOMIPS16 __attribute__ ((nomips16))
typedef unsigned int ui; typedef unsigned int ui;
typedef unsigned long long ull; typedef unsigned long long ull;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-mlong-calls -O2" } */ /* { dg-mips-options "-mlong-calls -O2" } */
/* { dg-require-effective-target nonpic } */ /* { dg-require-effective-target nonpic } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 extern int long_call_func () __attribute__((long_call)); NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far)); NOMIPS16 extern int far_func () __attribute__((far));
NOMIPS16 extern int near_func () __attribute__((near)); NOMIPS16 extern int near_func () __attribute__((near));
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* { dg-mips-options "-mno-long-calls -O2" } */ /* { dg-mips-options "-mno-long-calls -O2" } */
/* { dg-require-effective-target nonpic } */ /* { dg-require-effective-target nonpic } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 extern int long_call_func () __attribute__((long_call)); NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far)); NOMIPS16 extern int far_func () __attribute__((far));
NOMIPS16 extern int near_func () __attribute__((near)); NOMIPS16 extern int near_func () __attribute__((near));
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
/* { dg-final { scan-assembler "abs.s" } } */ /* { dg-final { scan-assembler "abs.s" } } */
/* { dg-final { scan-assembler "abs.d" } } */ /* { dg-final { scan-assembler "abs.d" } } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 float f1 (float f) { return -f; } NOMIPS16 float f1 (float f) { return -f; }
NOMIPS16 float f2 (float f) { return __builtin_fabsf (f); } NOMIPS16 float f2 (float f) { return __builtin_fabsf (f); }
NOMIPS16 double d1 (double d) { return -d; } NOMIPS16 double d1 (double d) { return -d; }
......
...@@ -2,12 +2,10 @@ ...@@ -2,12 +2,10 @@
This testcase used to trigger an unrecognizable insn. */ This testcase used to trigger an unrecognizable insn. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -w" } */ /* { dg-mips-options "-O2 -w" } */
__thread int *a = 0; __thread int *a = 0;
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 void foo (void) NOMIPS16 void foo (void)
{ {
extern int *b; extern int *b;
......
/* Check that we can use the save instruction to save varargs. */ /* 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> #include <stdarg.h>
int bar (int, va_list ap); int bar (int, va_list ap);
int MIPS16 int
foo (int n, ...) foo (int n, ...)
{ {
va_list ap; va_list ap;
......
/* Check that we can use the save instruction to save spilled arguments. */ /* Check that we can use the save instruction to save spilled arguments. */
/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -O2" } */ /* { dg-do compile { target mips16_attribute } } */
void /* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
/* { dg-add-options mips16_attribute } */
MIPS16 void
foo (int *a, int b, int c) foo (int *a, int b, int c)
{ {
asm volatile ("" ::: "$2", "$3", "$4", "$5", "$6", "$7", "$8", asm volatile ("" ::: "$2", "$3", "$4", "$5", "$6", "$7", "$8",
......
/* Check that we can use the save instruction to save spilled arguments /* 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. */ 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 bar (int *);
void MIPS16 void
foo (int *a, int b, int c) foo (int *a, int b, int c)
{ {
int x[0x4000]; int x[0x4000];
......
/* Check that we can use the save instruction to save $16, $17 and $31. */ /* 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 bar (void);
void
MIPS16 void
foo (void) foo (void)
{ {
bar (); bar ();
......
/* Check that we don't try to save the same register twice. */ /* Check that we don't try to save the same register twice. */
/* { dg-do assemble } */ /* { dg-do assemble { target mips16_attribute } } */
/* { dg-mips-options "-mips32r2 -mgp32 -mips16 -mno-abicalls -O2" } */ /* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
/* { dg-add-options mips16_attribute } */
int bar (int, int, int, int); int bar (int, int, int, int);
void frob (void); void frob (void);
void MIPS16 void
foo (int a1, int a2, int a3, int a4) foo (int a1, int a2, int a3, int a4)
{ {
asm volatile ("" ::: "$2", "$3", "$4", "$5", "$6", "$7", "$8", asm volatile ("" ::: "$2", "$3", "$4", "$5", "$6", "$7", "$8",
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int scaled_indexed_word_load (int a[], int b) NOMIPS16 int scaled_indexed_word_load (int a[], int b)
{ {
return a[b]; return a[b];
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int rotate_left (unsigned a, unsigned s) NOMIPS16 int rotate_left (unsigned a, unsigned s)
{ {
return (a << s) | (a >> (32 - s)); return (a << s) | (a >> (32 - s));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int rotate_right (unsigned a, unsigned s) NOMIPS16 int rotate_right (unsigned a, unsigned s)
{ {
return (a >> s) | (a << (32 - s)); return (a >> s) | (a << (32 - s));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
#define S 13 #define S 13
NOMIPS16 int rotate_left_constant (unsigned a) NOMIPS16 int rotate_left_constant (unsigned a)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-mips-options "-O -msmartmips" } */
#define NOMIPS16 __attribute__ ((nomips16))
#define S 13 #define S 13
NOMIPS16 int rotate_right_constant (unsigned a) NOMIPS16 int rotate_right_constant (unsigned a)
......
...@@ -625,6 +625,23 @@ proc check_effective_target_mips64 { } { ...@@ -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. # Return 1 if the current multilib does not generate PIC by default.
proc check_effective_target_nonpic { } { proc check_effective_target_nonpic { } {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment