aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-01-24 17:15:02 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-01-24 17:15:02 +0000
commitb20ba138efe0958dac85df2ec52ca0fc83dbb539 (patch)
tree36161113fbbc018edc4aa5c31911d0e696b40495 /gcc
parentc2e843276310bfa2eb0fa40c6b54f530ac207a4f (diff)
downloadgcc-b20ba138efe0958dac85df2ec52ca0fc83dbb539.zip
gcc-b20ba138efe0958dac85df2ec52ca0fc83dbb539.tar.gz
gcc-b20ba138efe0958dac85df2ec52ca0fc83dbb539.tar.bz2
re PR target/77439 (wrong code for sibcall with longcall, APCS frame and VFP)
PR target/77439 * config/arm/arm.c (arm_function_ok_for_sibcall): Add back restriction for long calls with APCS frame and VFP. From-SVN: r244879
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/arm/arm.c8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/arm/vfp-longcall-apcs.c32
4 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 22eeef5..c2962bb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2017-01-24 David Malcolm <dmalcolm@redhat.com>
* cfg.c (original_copy_tables_initialized_p): New function.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 934f5d1..944445f 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -7105,6 +7105,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/ChangeLog b/gcc/testsuite/ChangeLog
index 0211890..e70200b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.target/arm/vfp-longcall-apcs.c: New test.
+
2017-01-24 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/rtl/aarch64/asr_div1.c: New test case.
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 0000000..fa22b4d
--- /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;
+}