gcc/
authoryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Jun 2014 12:31:13 +0000 (12:31 +0000)
committeryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Jun 2014 12:31:13 +0000 (12:31 +0000)
2014-05-25  Yvan Roux  <yvan.roux@linaro.org>

       Backport from trunk r209808.
       2014-04-25  Jiong Wang  <jiong.wang@arm.com>

       * config/arm/predicates.md (call_insn_operand): Add long_call check.
       * config/arm/arm.md (sibcall, sibcall_value): Force the address to
       reg for long_call.
       * config/arm/arm.c (arm_function_ok_for_sibcall): Remove long_call
       restriction.

gcc/testsuite/
2014-05-25  Yvan Roux  <yvan.roux@linaro.org>

       Backport from trunk r209808.
       2014-04-25  Jiong Wang  <jiong.wang@arm.com>

       * gcc.target/arm/tail-long-call.c: New test.

git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@211577 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.linaro
gcc/config/arm/arm.c
gcc/config/arm/arm.md
gcc/config/arm/predicates.md
gcc/testsuite/ChangeLog.linaro
gcc/testsuite/gcc.target/arm/tail-long-call.c [new file with mode: 0644]

index ed17fe6..4f9c26a 100644 (file)
@@ -1,5 +1,16 @@
 2014-05-25  Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r209808.
+       2014-04-25  Jiong Wang  <jiong.wang@arm.com>
+
+       * config/arm/predicates.md (call_insn_operand): Add long_call check.
+       * config/arm/arm.md (sibcall, sibcall_value): Force the address to
+       reg for long_call.
+       * config/arm/arm.c (arm_function_ok_for_sibcall): Remove long_call
+       restriction.
+
+2014-05-25  Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r209806.
        2014-04-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
index 43364c5..c308925 100644 (file)
@@ -6221,11 +6221,6 @@ arm_function_ok_for_sibcall (tree decl, tree exp)
   if (TARGET_VXWORKS_RTP && flag_pic && !targetm.binds_local_p (decl))
     return false;
 
-  /* Cannot tail-call to long calls, since these are out of range of
-     a branch instruction.  */
-  if (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).  */
index bb62c60..348a89c 100644 (file)
   "TARGET_32BIT"
   "
   {
-    if (!REG_P (XEXP (operands[0], 0))
-       && (GET_CODE (XEXP (operands[0], 0)) != SYMBOL_REF))
+    if ((!REG_P (XEXP (operands[0], 0))
+        && GET_CODE (XEXP (operands[0], 0)) != SYMBOL_REF)
+       || (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
+           && arm_is_long_call_p (SYMBOL_REF_DECL (XEXP (operands[0], 0)))))
      XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0));
 
     if (operands[2] == NULL_RTX)
   "TARGET_32BIT"
   "
   {
-    if (!REG_P (XEXP (operands[1], 0)) &&
-       (GET_CODE (XEXP (operands[1],0)) != SYMBOL_REF))
+    if ((!REG_P (XEXP (operands[1], 0))
+        && GET_CODE (XEXP (operands[1], 0)) != SYMBOL_REF)
+       || (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
+           && arm_is_long_call_p (SYMBOL_REF_DECL (XEXP (operands[1], 0)))))
      XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0));
 
     if (operands[3] == NULL_RTX)
index 6273e88..d74fcb3 100644 (file)
        (match_code "reg" "0")))
 
 (define_predicate "call_insn_operand"
-  (ior (match_code "symbol_ref")
+  (ior (and (match_code "symbol_ref")
+           (match_test "!arm_is_long_call_p (SYMBOL_REF_DECL (op))"))
        (match_operand 0 "s_register_operand")))
index fa25084..fea17da 100644 (file)
@@ -1,5 +1,12 @@
 2014-05-25  Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r209808.
+       2014-04-25  Jiong Wang  <jiong.wang@arm.com>
+
+       * gcc.target/arm/tail-long-call.c: New test.
+
+2014-05-25  Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r209749.
        2014-04-24  Alan Lawrence  <alan.lawrence@arm.com>
 
diff --git a/gcc/testsuite/gcc.target/arm/tail-long-call.c b/gcc/testsuite/gcc.target/arm/tail-long-call.c
new file mode 100644 (file)
index 0000000..9b27468
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-skip-if "need at least armv5te" { *-*-* } { "-march=armv[234]*" "-mthumb" } { "" } } */
+/* { dg-options "-O2 -march=armv5te -marm" } */
+/* { dg-final { scan-assembler "bx" } } */
+/* { dg-final { scan-assembler-not "blx" } } */
+
+int lcal (int) __attribute__ ((long_call));
+
+int
+dec (int a)
+{
+  return lcal (a);
+}