aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2013-05-25 15:52:38 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2013-05-25 15:52:38 +0000
commitc979d5f525e854fb26e8ff7a7ef34812abef8550 (patch)
tree5bc015eddc94bdfa09139723d37338fc9d038aca /gcc
parentf4b688f22f9de03e0dbaa4c7c0212e6e95aecc9d (diff)
downloadgcc-c979d5f525e854fb26e8ff7a7ef34812abef8550.zip
gcc-c979d5f525e854fb26e8ff7a7ef34812abef8550.tar.gz
gcc-c979d5f525e854fb26e8ff7a7ef34812abef8550.tar.bz2
re PR target/55777 (Inlining nomips16 function into mips16 function can result in undefined builtins)
gcc/ PR target/55777 * config/mips/mips.c (mips_can_inline_p): New function. (TARGET_CAN_INLINE_P): Define. gcc/testsuite/ PR target/55777 * gcc.target/mips/mips16-attributes-5.c, * gcc.target/mips/mips16-attributes-6.c: New tests. From-SVN: r199328
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.c12
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/mips/mips16-attributes-5.c22
-rw-r--r--gcc/testsuite/gcc.target/mips/mips16-attributes-6.c13
5 files changed, 59 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6f5899..89936af 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-25 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR target/55777
+ * config/mips/mips.c (mips_can_inline_p): New function.
+ (TARGET_CAN_INLINE_P): Define.
+
2013-05-25 Steven Bosscher <steven@gcc.gnu.org>
* sched-int.h (ds_t, dw_t): Make unsigned int.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 1f27746..c9383ea 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -1426,6 +1426,16 @@ mips_merge_decl_attributes (tree olddecl, tree newdecl)
return merge_attributes (DECL_ATTRIBUTES (olddecl),
DECL_ATTRIBUTES (newdecl));
}
+
+/* Implement TARGET_CAN_INLINE_P. */
+
+static bool
+mips_can_inline_p (tree caller, tree callee)
+{
+ if (mips_get_compress_mode (callee) != mips_get_compress_mode (caller))
+ return false;
+ return default_target_can_inline_p (caller, callee);
+}
/* If X is a PLUS of a CONST_INT, return the two terms in *BASE_PTR
and *OFFSET_PTR. Return X in *BASE_PTR and 0 in *OFFSET_PTR otherwise. */
@@ -18600,6 +18610,8 @@ mips_expand_vec_minmax (rtx target, rtx op0, rtx op1,
#define TARGET_INSERT_ATTRIBUTES mips_insert_attributes
#undef TARGET_MERGE_DECL_ATTRIBUTES
#define TARGET_MERGE_DECL_ATTRIBUTES mips_merge_decl_attributes
+#undef TARGET_CAN_INLINE_P
+#define TARGET_CAN_INLINE_P mips_can_inline_p
#undef TARGET_SET_CURRENT_FUNCTION
#define TARGET_SET_CURRENT_FUNCTION mips_set_current_function
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3b67a43..fbc8716 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-25 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR target/55777
+ * gcc.target/mips/mips16-attributes-5.c,
+ * gcc.target/mips/mips16-attributes-6.c: New tests.
+
2013-05-25 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/builtin-bswap-6.c: Use same options as optimize-bswapsi-1.c.
diff --git a/gcc/testsuite/gcc.target/mips/mips16-attributes-5.c b/gcc/testsuite/gcc.target/mips/mips16-attributes-5.c
new file mode 100644
index 0000000..b84fa88
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips16-attributes-5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "(-mips16) addressing=absolute" } */
+/* { dg-skip-if "requires inlining" { *-*-* } { "-O0" } { "" } } */
+
+static inline MIPS16 int i1 (void) { return 1; }
+static inline NOMIPS16 int i2 (void) { return 2; }
+static inline MIPS16 int i3 (void) { return 3; }
+static inline NOMIPS16 int i4 (void) { return 4; }
+
+int NOMIPS16 f1 (void) { return i1 (); }
+int MIPS16 f2 (void) { return i2 (); }
+int MIPS16 f3 (void) { return i3 (); }
+int NOMIPS16 f4 (void) { return i4 (); }
+
+/* { dg-final { scan-assembler "i1:" } } */
+/* { dg-final { scan-assembler "i2:" } } */
+/* { dg-final { scan-assembler-not "i3:" } } */
+/* { dg-final { scan-assembler-not "i4:" } } */
+/* { dg-final { scan-assembler "\tjal\ti1" } } */
+/* { dg-final { scan-assembler "\tjal\ti2" } } */
+/* { dg-final { scan-assembler-not "\tjal\ti3" } } */
+/* { dg-final { scan-assembler-not "\tjal\ti4" } } */
diff --git a/gcc/testsuite/gcc.target/mips/mips16-attributes-6.c b/gcc/testsuite/gcc.target/mips/mips16-attributes-6.c
new file mode 100644
index 0000000..99bdf8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips16-attributes-6.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-mips16 addressing=absolute -mips3d" } */
+
+static inline NOMIPS16 float
+i1 (float f)
+{
+ return __builtin_mips_recip1_s (f);
+}
+
+float f1 (float f) { return i1 (f); }
+
+/* { dg-final { scan-assembler "\trecip1.s\t" } } */
+/* { dg-final { scan-assembler "\tjal\ti1" } } */