]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/67260 ([sh] Register spill bug for sibcall+complex+softfloat)
authorOleg Endo <olegendo@gcc.gnu.org>
Sat, 13 Feb 2016 08:48:50 +0000 (08:48 +0000)
committerOleg Endo <olegendo@gcc.gnu.org>
Sat, 13 Feb 2016 08:48:50 +0000 (08:48 +0000)
gcc/
Backport from mainline
2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>

PR target/67260
* config/sh/sh.md (sibcall_value_pcrel): Replace =&k scratch reg with
fixed R1_REG scratch reg.

gcc/testsuite/
Backport from mainline
2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>

PR target/67260
* gcc.target/sh/torture/pr67260.c: New.

From-SVN: r233402

gcc/ChangeLog
gcc/config/sh/sh.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/torture/pr67260.c [new file with mode: 0644]

index 17c8a2485c7b700726853e1fc7a4859222f72322..320a9e846fabafd1840041e2341a108b824e7c14 100644 (file)
@@ -1,3 +1,12 @@
+2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       Backport from mainline
+       2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/67260
+       * config/sh/sh.md (sibcall_value_pcrel): Replace =&k scratch reg with
+       fixed R1_REG scratch reg.
+
 2016-02-12  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index 906abb77365290d520017a909f97cce1fb8b1923..bbbf54733ce6548b2cea6ed28647d13c1d1050ea 100644 (file)
@@ -9605,12 +9605,16 @@ label:
                      (const_string "single") (const_string "double")))
    (set_attr "type" "jump_ind")])
 
+;; sibcall_value_pcrel used to have a =&k clobber for the scratch register
+;; that it needs for the branch address.  This causes troubles when there
+;; is a big overlap of argument and return value registers.  Hence, use a
+;; fixed call clobbered register for the address.  See also PR 67260.
 (define_insn_and_split "sibcall_value_pcrel"
   [(set (match_operand 0 "" "=rf")
        (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" ""))
              (match_operand 2 "" "")))
    (use (reg:PSI FPSCR_REG))
-   (clobber (match_scratch:SI 3 "=k"))
+   (clobber (reg:SI R1_REG))
    (return)]
   "TARGET_SH2"
   "#"
@@ -9620,6 +9624,8 @@ label:
   rtx lab = PATTERN (gen_call_site ());
   rtx call_insn;
 
+  operands[3] =  gen_rtx_REG (SImode, R1_REG);
+
   emit_insn (gen_sym_label2reg (operands[3], operands[1], lab));
   call_insn = emit_call_insn (gen_sibcall_valuei_pcrel (operands[0],
                                                        operands[3],
index 835010156d56fe25b4fb4800ec335d77e16bd195..8a19de5cc789bf0dda3ee7753c36e63edb202f6b 100644 (file)
@@ -1,3 +1,11 @@
+2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       Backport from mainline
+       2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/67260
+       * gcc.target/sh/torture/pr67260.c: New.
+
 2016-02-12  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.target/sh/torture/pr67260.c b/gcc/testsuite/gcc.target/sh/torture/pr67260.c
new file mode 100644 (file)
index 0000000..a7b70f0
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-additional-options "-std=gnu99 -fPIC" }  */
+/* { dg-do compile }  */
+
+#pragma GCC visibility push(hidden)
+
+double _Complex foo (double _Complex arg);
+
+double _Complex
+bar (double _Complex arg)
+{
+  return foo (arg);
+}