summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips/near-far-4.c
diff options
context:
space:
mode:
authorsandra <sandra@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-26 02:02:37 +0000
committersandra <sandra@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-26 02:02:37 +0000
commit7808555b55f49514d9d3d0fcec7571c883f346c3 (patch)
tree93fc294792273907df1fb67c31af6acf379bd425 /gcc/testsuite/gcc.target/mips/near-far-4.c
parent01b6898727bd7b3793f10741ae8d94b8b5c817fd (diff)
downloadgcc-7808555b55f49514d9d3d0fcec7571c883f346c3.tar.gz
2007-05-25 Sandra Loosemore <sandra@codesourcery.com>
Nigel Stephens <nigel@mips.com> gcc/ * config/mips/mips.c (mips_attribute_table): Add "near" and "far" function attributes, "far" being an alias for "long_call". (TARGET_COMP_TYPE_ATTRIBUTES): Define as mips_comp_type_attributes. (mips_near_type_p, mips_far_type_p): New. (mips_comp_type_attributes): New function to check that attributes attached to a function type are compatible. (mips_output_mi_thunk): Test SYMBOL_REF_LONG_CALL_P() rather than TARGET_LONG_CALLS when deciding whether we can do a direct sibcall to the target function of the thunk. (mips_encode_section_info): Check for "near" and "far" function attributes, and always set the SYMBOL_FLAG_LONG_CALL bit explicitly. * config/mips/predicates.md (const_call_insn_operand): Test only SYMBOL_REF_LONG_CALL_P() and not TARGET_LONG_CALLS. * doc/extend.texi (Function Attributes): Document MIPS "near" and "far" attributes. * testsuite/gcc.target/mips/near-far-1.c: New test case. * testsuite/gcc.target/mips/near-far-2.c: New test case. * testsuite/gcc.target/mips/near-far-3.c: New test case. * testsuite/gcc.target/mips/near-far-4.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/mips/near-far-4.c')
-rw-r--r--gcc/testsuite/gcc.target/mips/near-far-4.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/mips/near-far-4.c b/gcc/testsuite/gcc.target/mips/near-far-4.c
new file mode 100644
index 00000000000..7d156fabdc5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/near-far-4.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-mips-options "-mno-long-calls -O2 -mno-mips16" } */
+/* { dg-require-effective-target nonpic } */
+
+extern int long_call_func () __attribute__((long_call));
+extern int far_func () __attribute__((far));
+extern int near_func () __attribute__((near));
+extern int normal_func ();
+
+int test1 () { return long_call_func (); }
+int test2 () { return far_func (); }
+int test3 () { return near_func (); }
+int test4 () { return normal_func (); }
+
+/* { dg-final { scan-assembler-not "\tj\tlong_call_func\n" } } */
+/* { dg-final { scan-assembler-not "\tj\tfar_func\n" } } */
+/* { dg-final { scan-assembler "\tj\tnear_func\n" } } */
+/* { dg-final { scan-assembler "\tj\tnormal_func\n" } } */