aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-01-30 10:20:34 +0000
committerYvan Roux <yvan.roux@linaro.org>2017-01-31 09:11:15 +0000
commit3a3a5fdedabe435e7023e512af570ca1ed82a131 (patch)
tree1bbf840f58a6489d401989a823c8895408206864 /gcc
parent2b185a9d862869294261d2f46d64ed740f8d8435 (diff)
gcc/
Backport from trunk r244879. 2017-01-24 Eric Botcazou <ebotcazou@adacore.com> PR target/77439 * config/arm/arm.c (arm_function_ok_for_sibcall): Add back restriction for long calls with APCS frame and VFP. gcc/testsuite/ Backport from trunk r244879. 2017-01-24 Eric Botcazou <ebotcazou@adacore.com> * gcc.target/arm/vfp-longcall-apcs.c: New test. Change-Id: I1663e7b52decbb7c5d9cb13c42136e10e44940b7
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/arm/arm.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/vfp-longcall-apcs.c32
2 files changed, 40 insertions, 0 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index ab512b52e77..ddca3b00cd7 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -6965,6 +6965,14 @@ arm_function_ok_for_sibcall (tree decl, tree exp)
if (TARGET_VXWORKS_RTP && flag_pic && decl && !targetm.binds_local_p (decl))
return false;
+ /* ??? Cannot tail-call to long calls with APCS frame and VFP, because IP
+ may be used both as target of the call and base register for restoring
+ the VFP registers */
+ if (TARGET_APCS_FRAME && TARGET_ARM
+ && TARGET_HARD_FLOAT
+ && decl && arm_is_long_call_p (decl))
+ return false;
+
/* If we are interworking and the function is not declared static
then we can't tail-call it unless we know that it exists in this
compilation unit (since it might be a Thumb routine). */
diff --git a/gcc/testsuite/gcc.target/arm/vfp-longcall-apcs.c b/gcc/testsuite/gcc.target/arm/vfp-longcall-apcs.c
new file mode 100644
index 00000000000..fa22b4da534
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/vfp-longcall-apcs.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-mapcs-frame -O -foptimize-sibling-calls -ffunction-sections" } */
+
+extern void abort (void);
+
+static __attribute__((noclone, noinline, long_call))
+int foo (int a, int b, int c, int d, double i)
+{
+ return a;
+}
+
+static __attribute__((noclone, noinline))
+double baz (double i)
+{
+ return i;
+}
+
+static __attribute__((noclone, noinline))
+int bar (int a, int b, int c, int d, double i, double j)
+{
+ double l = baz (i) * j;
+ return foo (a, b, c, d, l);
+}
+
+int
+main (void)
+{
+ if (bar (0, 0, 0, 0, 0.0, 0.0) != 0)
+ abort ();
+
+ return 0;
+}