Commit 9a6dfb47 by Richard Sandiford Committed by Richard Sandiford

mips.h (SYMBOL_FLAG_MIPS16_FUNC): Delete.

gcc/
2007-09-13  Richard Sandiford  <richard@codesourcery.com>
	    Sandra Loosemore <sandra@codesourcery.com>

	* config/mips/mips.h (SYMBOL_FLAG_MIPS16_FUNC): Delete.
	(SYMBOL_REF_MIPS16_FUNC_P): Delete.
	* config/mips/mips.c (mips_attribute_table): Turn mips16 and
	nomips16 into decl attributes.
	(TARGET_INSERT_ATTRIBUTES): Override.
	(TARGET_MERGE_DECL_ATTRIBUTES): Likewise.
	(TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P): Always return true.
	(mips_mips16_type_p, mips_nomips16_type_p): Delete in favor of...
	(mips_mips16_decl_p, mips_nomips16_decl_p): ...these new functions.
	(mips_comp_type_attributes): Remove mips16 and nomips16 handling.
	(mips_use_mips16_mode_p): Reimplement as a function that takes
	a decl and considers only decl attributes.  If the decl is nested
	function, use its parent attributes.
	(mips_function_ok_for_sibcall): Use mips_use_mips16_mode_p
	instead of SYMBOL_REF_MIPS16_FUNC_P.
	(mips_set_mips16_mode): Move call to sorry here from old
	mips_use_mips16_mode_p.
	(mflip_mips16_entry): New structure.
	(mflip_mips16_htab): New variable.
	(mflip_mips16_htab_hash, mflip_mips16_htab_eq): New functions.
	(mflip_mips16_use_mips16_p, mips_insert_attributes): Likewise.
	(mips_merge_decl_attributes): New function.
	(mips_set_current_function): Reinstate call to mips_set_mips16_mode.
	Use mips_use_mips16_mode_p.
	(mips_output_mi_thunk): Use mips_use_mips16_mode_p instead of
	SYMBOL_REF_MIPS16_FUNC_P.
	(mips_encode_section_info): Don't set SYMBOL_FLAG_MIPS16_FUNC.

gcc/testsuite/
	* gcc.dg/gcc-have-sync-compare-and-swap.c: Skip for -mflip-mips16.
	* gcc.target/mips/mips16-attributes-2.c: New test.
	* gcc.target/mips/mips16-attributes-3.c: Likewise.
	* gcc.target/mips/args-3.c: Skip for -mflip-mips16.  Do not use the
	hard-float asm when __mips16 is defined.
	* gcc.target/mips/atomic-memory-1.c (main): Add a nomips16 attribute.
	* gcc.target/mips/atomic-memory-2.c (main): Likewise.
	* gcc.target/mips/fpcmp-1.c (f1, f2): Likewise.
	* gcc.target/mips/fpcmp-2.c (f1, f2): Likewise.
	* gcc.target/mips/neg-abs-1.c (f1, f2, d1, f2): Likewise.
	* gcc.target/mips/pr26765.c (foo): Likewise.
	* gcc.target/mips/gcc-have-sync-compare-and-swap-1.c: Run for all
	targets, use dg-mips-options instead of dg-options, and use -mgp32
	to force 32-bit mode.
	* gcc.target/mips/gcc-have-sync-compare-and-swap-2.c: Likewise -mgp64
	and 64-bit mode.
	* gcc.target/mips/mips.exp (is_gp32_flag): Return true for -mips32*.

Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com>

From-SVN: r128460
parent 0ad7e054
2007-09-13 Richard Sandiford <richard@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
* config/mips/mips.h (SYMBOL_FLAG_MIPS16_FUNC): Delete.
(SYMBOL_REF_MIPS16_FUNC_P): Delete.
* config/mips/mips.c (mips_attribute_table): Turn mips16 and
nomips16 into decl attributes.
(TARGET_INSERT_ATTRIBUTES): Override.
(TARGET_MERGE_DECL_ATTRIBUTES): Likewise.
(TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P): Always return true.
(mips_mips16_type_p, mips_nomips16_type_p): Delete in favor of...
(mips_mips16_decl_p, mips_nomips16_decl_p): ...these new functions.
(mips_comp_type_attributes): Remove mips16 and nomips16 handling.
(mips_use_mips16_mode_p): Reimplement as a function that takes
a decl and considers only decl attributes. If the decl is nested
function, use its parent attributes.
(mips_function_ok_for_sibcall): Use mips_use_mips16_mode_p
instead of SYMBOL_REF_MIPS16_FUNC_P.
(mips_set_mips16_mode): Move call to sorry here from old
mips_use_mips16_mode_p.
(mflip_mips16_entry): New structure.
(mflip_mips16_htab): New variable.
(mflip_mips16_htab_hash, mflip_mips16_htab_eq): New functions.
(mflip_mips16_use_mips16_p, mips_insert_attributes): Likewise.
(mips_merge_decl_attributes): New function.
(mips_set_current_function): Reinstate call to mips_set_mips16_mode.
Use mips_use_mips16_mode_p.
(mips_output_mi_thunk): Use mips_use_mips16_mode_p instead of
SYMBOL_REF_MIPS16_FUNC_P.
(mips_encode_section_info): Don't set SYMBOL_FLAG_MIPS16_FUNC.
2007-09-13 Richard Sandiford <richard@codesourcery.com>
* c-parser.c (c_parser_struct_declaration): Check for a null return.
......@@ -2338,11 +2338,6 @@ typedef struct mips_args {
#define SYMBOL_REF_LONG_CALL_P(X) \
((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_LONG_CALL) != 0)
/* Flag to mark a function decl symbol a "mips16" function. */
#define SYMBOL_FLAG_MIPS16_FUNC (SYMBOL_FLAG_MACH_DEP << 1)
#define SYMBOL_REF_MIPS16_FUNC_P(RTX) \
((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_MIPS16_FUNC) != 0)
/* True if we're generating a form of MIPS16 code in which jump tables
are stored in the text section and encoded as 16-bit PC-relative
offsets. This is only possible when general text loads are allowed,
......
2007-09-13 Richard Sandiford <richard@codesourcery.com>
* gcc.dg/gcc-have-sync-compare-and-swap.c: Skip for -mflip-mips16.
* gcc.target/mips/mips16-attributes-2.c: New test.
* gcc.target/mips/mips16-attributes-3.c: Likewise.
* gcc.target/mips/args-3.c: Skip for -mflip-mips16. Do not use the
hard-float asm when __mips16 is defined.
* gcc.target/mips/atomic-memory-1.c (main): Add a nomips16 attribute.
* gcc.target/mips/atomic-memory-2.c (main): Likewise.
* gcc.target/mips/fpcmp-1.c (f1, f2): Likewise.
* gcc.target/mips/fpcmp-2.c (f1, f2): Likewise.
* gcc.target/mips/neg-abs-1.c (f1, f2, d1, f2): Likewise.
* gcc.target/mips/pr26765.c (foo): Likewise.
* gcc.target/mips/gcc-have-sync-compare-and-swap-1.c: Run for all
targets, use dg-mips-options instead of dg-options, and use -mgp32
to force 32-bit mode.
* gcc.target/mips/gcc-have-sync-compare-and-swap-2.c: Likewise -mgp64
and 64-bit mode.
* gcc.target/mips/mips.exp (is_gp32_flag): Return true for -mips32*.
2007-09-12 Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
Michael Meissner <michael.meissner@amd.com>
/* { dg-do link } */
/* MIPS only supports these built-in functions for non-MIPS16 mode, and
-mflip-mips16 will change the mode of some functions to be different
from the command-line setting. */
/* { dg-skip-if "" { mips*-*-* } { "-mflip-mips16" } { "" } } */
void f1()
{
......
/* __mips, and related defines, guarantee that certain assembly
instructions can be used. Check a few examples. */
/* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */
extern void abort (void);
extern void exit (int);
......@@ -11,7 +12,7 @@ int foo (float inf, int64 in64, int32 in32)
int64 res64;
int32 res32;
#if __mips != 1 && defined (__mips_hard_float)
#if __mips != 1 && defined (__mips_hard_float) && !defined (__mips16)
__asm__ ("trunc.w.s %0, %1" : "=f" (res32) : "f" (inf));
if (res32 != 11)
abort ();
......
......@@ -2,7 +2,9 @@
extern void abort (void);
extern void exit (int);
int main ()
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 int main ()
{
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
unsigned v = 0;
......
......@@ -3,7 +3,9 @@
/* { dg-final { scan-assembler "addiu" } } */
/* { dg-final { scan-assembler-not "subu" } } */
unsigned long
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 unsigned long
f(unsigned long *p)
{
return __sync_fetch_and_sub (p, 5);
......
/* We used to use c.lt.fmt instead of c.ule.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */
int f1 (float x, float y) { return __builtin_isless (x, y); }
int f2 (double x, double y) { return __builtin_isless (x, y); }
#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" } } */
/* { dg-final { scan-assembler "c\\.ule\\.d" } } */
/* We used to use c.le.fmt instead of c.ult.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */
int f1 (float x, float y) { return __builtin_islessequal (x, y); }
int f2 (double x, double y) { return __builtin_islessequal (x, y); }
#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" } } */
/* { dg-final { scan-assembler "c\\.ult\\.d" } } */
/* { dg-do preprocess } */
/* { dg-options "-mips32 -mabi=32" } */
/* { dg-mips-options "-mips2" } */
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#error nonono
......
/* { dg-do preprocess { target { mips64*-*-* } } } */
/* { dg-options "-mips64 -mabi=64" } */
/* { dg-do preprocess } */
/* { dg-mips-options "-mgp64" } */
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#error nonono
......
......@@ -103,6 +103,7 @@ proc is_gp32_flag {flag} {
switch -glob -- $flag {
-msmartmips -
-mips[12] -
-mips32* -
-march=mips32* -
-mgp32 { return 1 }
default { return 0 }
......
/* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */
void f1 (void);
void __attribute__((mips16)) f1 (void) {} /* { dg-error "conflicting" } */
void __attribute__((mips16)) f2 (void);
void f2 (void) {} /* { dg-error "conflicting" } */
void f3 (void);
void __attribute__((nomips16)) f3 (void) {} /* { dg-error "conflicting" } */
void __attribute__((nomips16)) f4 (void);
void f4 (void) {} /* { dg-error "conflicting" } */
void __attribute__((mips16, nomips16)) f5 (void) {} /* { dg-error "cannot have both" } */
/* We should be able to assign mips16 and nomips16 functions to a pointer. */
void __attribute__((mips16)) f1 (void);
void (*ptr1) (void) = f1;
void __attribute__((nomips16)) f2 (void);
void (*ptr2) (void) = f2;
......@@ -7,7 +7,9 @@
/* { dg-final { scan-assembler "abs.s" } } */
/* { dg-final { scan-assembler "abs.d" } } */
float f1 (float f) { return -f; }
float f2 (float f) { return __builtin_fabsf (f); }
double d1 (double d) { return -d; }
double d2 (double d) { return __builtin_fabs (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; }
NOMIPS16 double d2 (double d) { return __builtin_fabs (d); }
......@@ -6,7 +6,9 @@
__thread int *a = 0;
void foo (void)
#define NOMIPS16 __attribute__ ((nomips16))
NOMIPS16 void foo (void)
{
extern int *b;
b = (int *) ((*a));
......
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