]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/60077 (gcc.target/i386/pr35767-5.c FAILs)
authorJakub Jelinek <jakub@redhat.com>
Fri, 7 Feb 2014 02:11:27 +0000 (03:11 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 7 Feb 2014 02:11:27 +0000 (02:11 +0000)
PR target/60077
* expr.c (emit_move_resolve_push): Export; be bit more selective
on when to clear alias set.
* expr.h (emit_move_resolve_push): Declare.
* function.h (struct function): Add tail_call_marked.
* tree-tailcall.c (optimize_tail_call): Set tail_call_marked.
* config/i386/i386-protos.h (ix86_expand_push): Remove.
* config/i386/i386.md (TImode move expander): De not call
ix86_expand_push.
(FP push expanders): Preserve memory attributes.
* config/i386/sse.md (push<mode>1): Remove.
* config/i386/i386.c (ix86_expand_vector_move): Handle push
operation.
(ix86_expand_push): Remove.
* config/i386/mmx.md (push<mode>1): Remove.

From-SVN: r207587

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/config/i386/mmx.md
gcc/config/i386/sse.md
gcc/expr.c
gcc/expr.h
gcc/function.h
gcc/tree-tailcall.c

index 33f1ccf53449af7a37275c0c6a61277ac604678a..3a389639d05fd829849bfc4543a35966991c586c 100644 (file)
@@ -1,3 +1,21 @@
+2014-02-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/60077
+       * expr.c (emit_move_resolve_push): Export; be bit more selective
+       on when to clear alias set.
+       * expr.h (emit_move_resolve_push): Declare.
+       * function.h (struct function): Add tail_call_marked.
+       * tree-tailcall.c (optimize_tail_call): Set tail_call_marked.
+       * config/i386/i386-protos.h (ix86_expand_push): Remove.
+       * config/i386/i386.md (TImode move expander): De not call
+       ix86_expand_push.
+       (FP push expanders): Preserve memory attributes.
+       * config/i386/sse.md (push<mode>1): Remove.
+       * config/i386/i386.c (ix86_expand_vector_move): Handle push
+       operation.
+       (ix86_expand_push): Remove.
+       * config/i386/mmx.md (push<mode>1): Remove.
+
 2014-02-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/60030
index 803a130e32048cad534d0d9c5a93c7dc82f5c66f..3493904864f8f8c97b5d095aa542edf7c7f43c34 100644 (file)
@@ -84,7 +84,6 @@ extern void ix86_expand_clear (rtx);
 extern void ix86_expand_move (enum machine_mode, rtx[]);
 extern void ix86_expand_vector_move (enum machine_mode, rtx[]);
 extern void ix86_expand_vector_move_misalign (enum machine_mode, rtx[]);
-extern void ix86_expand_push (enum machine_mode, rtx);
 extern rtx ix86_fixup_binary_operands (enum rtx_code,
                                       enum machine_mode, rtx[]);
 extern void ix86_fixup_binary_operands_no_copy (enum rtx_code,
index abe05aab36eb1648fd377a9be20fb30115b47dc4..18f5d57e39cfda064c9aa16a6c4ec62505668aa3 100644 (file)
@@ -16828,6 +16828,9 @@ ix86_expand_vector_move (enum machine_mode mode, rtx operands[])
   rtx op0 = operands[0], op1 = operands[1];
   unsigned int align = GET_MODE_ALIGNMENT (mode);
 
+  if (push_operand (op0, VOIDmode))
+    op0 = emit_move_resolve_push (mode, op0);
+
   /* Force constants other than zero into memory.  We do not know how
      the instructions used to build constants modify the upper 64 bits
      of the register, once we have that information we may be able
@@ -17255,30 +17258,6 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
     gcc_unreachable ();
 }
 
-/* Expand a push in MODE.  This is some mode for which we do not support
-   proper push instructions, at least from the registers that we expect
-   the value to live in.  */
-
-void
-ix86_expand_push (enum machine_mode mode, rtx x)
-{
-  rtx tmp;
-
-  tmp = expand_simple_binop (Pmode, PLUS, stack_pointer_rtx,
-                            GEN_INT (-GET_MODE_SIZE (mode)),
-                            stack_pointer_rtx, 1, OPTAB_DIRECT);
-  if (tmp != stack_pointer_rtx)
-    emit_move_insn (stack_pointer_rtx, tmp);
-
-  tmp = gen_rtx_MEM (mode, stack_pointer_rtx);
-
-  /* When we push an operand onto stack, it has to be aligned at least
-     at the function argument boundary.  However since we don't have
-     the argument type, we can't determine the actual argument
-     boundary.  */
-  emit_move_insn (tmp, x);
-}
-
 /* Helper function of ix86_fixup_binary_operands to canonicalize
    operand order.  Returns true if the operands should be swapped.  */
 
index 87feb473af56953eead20c6412c8acf4f129584a..05fc00a66fc77cc792a8066e916f2a2cca8371f6 100644 (file)
 {
   if (TARGET_64BIT)
     ix86_expand_move (TImode, operands);
-  else if (push_operand (operands[0], TImode))
-    ix86_expand_push (TImode, operands[1]);
   else
     ix86_expand_vector_move (TImode, operands);
   DONE;
        (match_operand:TF 1 "sse_reg_operand"))]
   "TARGET_SSE && reload_completed"
   [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
-   (set (mem:TF (reg:P SP_REG)) (match_dup 1))])
+   (set (match_dup 0) (match_dup 1))]
+{
+  /* Preserve memory attributes. */
+  operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
+})
 
 (define_insn "*pushxf"
   [(set (match_operand:XF 0 "push_operand" "=<,<")
        (match_operand:XF 1 "fp_register_operand"))]
   "reload_completed"
   [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
-   (set (mem:XF (reg:P SP_REG)) (match_dup 1))]
-  "operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));")
+   (set (match_dup 0) (match_dup 1))]
+{
+  operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));
+  /* Preserve memory attributes. */
+  operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
+})
 
 (define_insn "*pushdf"
   [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
        (match_operand:DF 1 "any_fp_register_operand"))]
   "reload_completed"
   [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8)))
-   (set (mem:DF (reg:P SP_REG)) (match_dup 1))])
+   (set (match_dup 0) (match_dup 1))]
+{
+  /* Preserve memory attributes. */
+  operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
+})
 
 (define_insn "*pushsf_rex64"
   [(set (match_operand:SF 0 "push_operand" "=X,X,X")
        (match_operand:SF 1 "any_fp_register_operand"))]
   "reload_completed"
   [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2)))
-   (set (mem:SF (reg:P SP_REG)) (match_dup 1))]
+   (set (match_dup 0) (match_dup 1))]
 {
   rtx op = XEXP (operands[0], 0);
   if (GET_CODE (op) == PRE_DEC)
       gcc_assert (CONST_INT_P (op));
     }
   operands[2] = op;
+  /* Preserve memory attributes. */
+  operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
 })
 
 (define_split
index 239e5db710580b4c128d6b9499cda59d4d4a5529..214acde23c4692d405d447234ad70974e482b96a 100644 (file)
   [(const_int 0)]
   "ix86_split_long_move (operands); DONE;")
 
-(define_expand "push<mode>1"
-  [(match_operand:MMXMODE 0 "register_operand")]
-  "TARGET_MMX"
-{
-  ix86_expand_push (<MODE>mode, operands[0]);
-  DONE;
-})
-
 (define_expand "movmisalign<mode>"
   [(set (match_operand:MMXMODE 0 "nonimmediate_operand")
        (match_operand:MMXMODE 1 "nonimmediate_operand"))]
index cbebd87c425bd25bb39bd280665d64fcc471ce6c..345b6e087af021e16f3729fe3f3f8ce5a76abb62 100644 (file)
   operands[2] = CONST0_RTX (DFmode);
 })
 
-(define_expand "push<mode>1"
-  [(match_operand:VMOVE 0 "register_operand")]
-  "TARGET_SSE"
-{
-  ix86_expand_push (<MODE>mode, operands[0]);
-  DONE;
-})
-
 (define_expand "movmisalign<mode>"
   [(set (match_operand:VMOVE 0 "nonimmediate_operand")
        (match_operand:VMOVE 1 "nonimmediate_operand"))]
index 878a51b2510f794864098913b03a3a1c08092105..c1f67f4e4a04d2a1b4f6e784714d30200b091d6a 100644 (file)
@@ -3221,7 +3221,7 @@ emit_move_via_integer (enum machine_mode mode, rtx x, rtx y, bool force)
 /* A subroutine of emit_move_insn_1.  X is a push_operand in MODE.
    Return an equivalent MEM that does not use an auto-increment.  */
 
-static rtx
+rtx
 emit_move_resolve_push (enum machine_mode mode, rtx x)
 {
   enum rtx_code code = GET_CODE (XEXP (x, 0));
@@ -4070,7 +4070,7 @@ emit_single_push_insn_1 (enum machine_mode mode, rtx x, tree type)
     {
       set_mem_attributes (dest, type, 1);
 
-      if (flag_optimize_sibling_calls)
+      if (cfun->tail_call_marked)
        /* Function incoming arguments may overlap with sibling call
           outgoing arguments and we cannot allow reordering of reads
           from function arguments with stores to outgoing arguments
index da5d4a6d56fdbeaf438a9631e281bfff1f655894..5111f06e8560af52b17f813f018341b799c7bb74 100644 (file)
@@ -413,6 +413,7 @@ extern rtx emit_move_insn_1 (rtx, rtx);
 
 extern rtx emit_move_complex_push (enum machine_mode, rtx, rtx);
 extern rtx emit_move_complex_parts (rtx, rtx);
+extern rtx emit_move_resolve_push (enum machine_mode, rtx);
 
 /* Push a block of length SIZE (perhaps variable)
    and return an rtx to address the beginning of the block.  */
index c22f6614bd89285e96ad0c7c102961231160b363..38a0fc4688d9c036afef6fb7c7edcb0e0007e177 100644 (file)
@@ -667,6 +667,9 @@ struct GTY(()) function {
   /* Nonzero if the current function contains any loops with
      nonzero value in loop->simduid.  */
   unsigned int has_simduid_loops : 1;
+
+  /* Set when the tail call has been identified.  */
+  unsigned int tail_call_marked : 1;
 };
 
 /* Add the decl D to the local_decls list of FUN.  */
index ff19f639a69294c0bb9957ce329cf5e879de9c31..3488c2fc2c22984fd37c9631b8392c69d2d3239c 100644 (file)
@@ -909,6 +909,7 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls)
       gimple stmt = gsi_stmt (t->call_gsi);
 
       gimple_call_set_tail (stmt, true);
+      cfun->tail_call_marked = true;
       if (dump_file && (dump_flags & TDF_DETAILS))
         {
          fprintf (dump_file, "Found tail call ");