]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/70064 (Wrong code with custom flags and quite big testcase @ i686)
authorUros Bizjak <uros@gcc.gnu.org>
Mon, 7 Mar 2016 19:54:02 +0000 (20:54 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 7 Mar 2016 19:54:02 +0000 (20:54 +0100)
PR target/70064
* config/i386/i386.h (machine_function): Add
pc_thunk_call_expanded flag.
(ix86_pc_thunk_call_expanded): New define.
* config/i386/i386.md (set_got, set_got_labelled): New expanders.
(*set_got): Rename insn pattern from set_got.
(*set_got_labelled): Rename inst pattern from set_got_labelled.
* config/i386/i386.c (ix86_compute_frame_layout): Use
ix86_pc_thunk_call_expanded to prevent red-zone.

From-SVN: r234050

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i386/i386.md

index 6a143ba94b54c44a67fe121405084db579969447..38c47b69656068261d94444375185818d9b22bbe 100644 (file)
@@ -1,3 +1,15 @@
+2016-03-07  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/70064
+       * config/i386/i386.h (machine_function): Add
+       pc_thunk_call_expanded flag.
+       (ix86_pc_thunk_call_expanded): New define.
+       * config/i386/i386.md (set_got, set_got_labelled): New expanders.
+       (*set_got): Rename insn pattern from set_got.
+       (*set_got_labelled): Rename inst pattern from set_got_labelled.
+       * config/i386/i386.c (ix86_compute_frame_layout): Use
+       ix86_pc_thunk_call_expanded to prevent red-zone.
+
 2016-03-07  Martin Jambor  <mjambor@suse.cz>
 
        * hsa.h (hsa_get_ctor_statements): Declare.
@@ -26,7 +38,7 @@
        -fno-branch-count-reg.
 
 2016-02-26  Richard Biener  <rguenther@suse.de>
-            Jeff Law  <law@redhat.com>
+           Jeff Law  <law@redhat.com>
 
        PR tree-optimization/69740
        * cfghooks.c (remove_edge): Request loop fixups if we delete
 2016-03-05  Venkataramanan Kumar  <Venkataramanan.kumar@amd.com>
 
        Fix sseimul type attribute.
-       * config/i386/znver1.md 
+       * config/i386/znver1.md
        (znver1_sseimul, znver1_sseimul_avx256, znver1_sseimul_load,
        znver1_sseimul_avx256_load) : Fix the type attribute.
-       (znver1_sseimul_di,
-       znver1_sseimul_load_di): Fix type attribute, pipe usage and latency. 
+       (znver1_sseimul_di, znver1_sseimul_load_di): Fix type attribute,
+       pipe usage and latency.
 
 2016-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        * gimplify.c (gimplify_decl_expr): For decls with REFERENCE_TYPE, also
        gimplify_type_sizes the type they refer to.
        (omp_notice_variable): Handle reference vars to VLAs.
-       * omp-low.c (lower_omp_target): Emit setup of OMP_CLAUSE_PRIVATE reference
-       to VLA decls in the second pass instead of first pass.
+       * omp-low.c (lower_omp_target): Emit setup of OMP_CLAUSE_PRIVATE
+       reference to VLA decls in the second pass instead of first pass.
 
 2016-03-02  Tom de Vries  <tom@codesourcery.com>
 
        * config.gcc (mep-*-elf): Add newlib-stdint.h to tm_file.
 
 2016-03-02  Richard Biener  <rguenther@suse.de>
-       Uros Bizjak  <ubizjak@gmail.com>
+           Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/67278
        * config/i386/i386.c (type_natural_mode): Handle XFmode vectors.
        * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths):
        Do count some PHIs in the thread path against the insn count.  Decrease
        final statement count by one as the control statement in the last
-       block will get removed.  Remove special cased code for handling PHIs            in the last block.
+       block will get removed.  Remove special cased code for handling PHIs
+       in the last block.
 
 2016-03-01  Uros Bizjak  <ubizjak@gmail.com>
 
index 27fb15ed71312d255ab0203f424d9dcd27ae7a89..5155a00ccc9359bcbfb11b65e92ed09e2c6ebd06 100644 (file)
@@ -11103,18 +11103,7 @@ output_set_got (rtx dest, rtx label)
 
   xops[1] = gen_rtx_SYMBOL_REF (Pmode, GOT_SYMBOL_NAME);
 
-  if (!flag_pic)
-    {
-      if (TARGET_MACHO)
-       /* We don't need a pic base, we're not producing pic.  */
-       gcc_unreachable ();
-
-      xops[2] = gen_rtx_LABEL_REF (Pmode, label ? label : gen_label_rtx ());
-      output_asm_insn ("mov%z0\t{%2, %0|%0, %2}", xops);
-      targetm.asm_out.internal_label (asm_out_file, "L",
-                                     CODE_LABEL_NUMBER (XEXP (xops[2], 0)));
-    }
-  else
+  if (flag_pic)
     {
       char name[32];
       get_pc_thunk_name (name, REGNO (dest));
@@ -11139,6 +11128,17 @@ output_set_got (rtx dest, rtx label)
                                           CODE_LABEL_NUMBER (label));
 #endif
     }
+  else
+    {
+      if (TARGET_MACHO)
+       /* We don't need a pic base, we're not producing pic.  */
+       gcc_unreachable ();
+
+      xops[2] = gen_rtx_LABEL_REF (Pmode, label ? label : gen_label_rtx ());
+      output_asm_insn ("mov%z0\t{%2, %0|%0, %2}", xops);
+      targetm.asm_out.internal_label (asm_out_file, "L",
+                                     CODE_LABEL_NUMBER (XEXP (xops[2], 0)));
+    }
 
   if (!TARGET_MACHO)
     output_asm_insn ("add%z0\t{%1, %0|%0, %1}", xops);
@@ -11524,6 +11524,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
   if (ix86_using_red_zone ()
       && crtl->sp_is_unchanging
       && crtl->is_leaf
+      && !ix86_pc_thunk_call_expanded
       && !ix86_current_function_calls_tls_descriptor)
     {
       frame->red_zone_size = to_allocate;
index 9062d631165bcbd996a9f19ddcb6f0125e126d50..027adb1108b3051fe22b94595f4bc0fdf1e5f701 100644 (file)
@@ -2494,6 +2494,10 @@ struct GTY(()) machine_function {
      expander to determine the style used.  */
   BOOL_BITFIELD use_fast_prologue_epilogue : 1;
 
+  /* Nonzero if the current function calls pc thunk and
+     must not use the red zone.  */
+  BOOL_BITFIELD pc_thunk_call_expanded : 1;
+
   /* If true, the current function needs the default PIC register, not
      an alternate register (on x86) and must not use the red zone (on
      x86_64), even if it's a leaf function.  We don't want the
@@ -2533,6 +2537,7 @@ struct GTY(()) machine_function {
 #define ix86_varargs_fpr_size (cfun->machine->varargs_fpr_size)
 #define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching)
 #define ix86_current_function_needs_cld (cfun->machine->needs_cld)
+#define ix86_pc_thunk_call_expanded (cfun->machine->pc_thunk_call_expanded)
 #define ix86_tls_descriptor_calls_expanded_in_cfun \
   (cfun->machine->tls_descriptor_call_expanded_p)
 /* Since tls_descriptor_call_expanded is not cleared, even if all TLS
index 7fec5ded031faff68fb5294a0b41d16b805f3bea..cb8bcecf630f648c2f78e41b9a7ed3d20b68ea46 100644 (file)
   ""
   "ix86_expand_prologue (); DONE;")
 
-(define_insn "set_got"
+(define_expand "set_got"
+  [(parallel
+     [(set (match_operand:SI 0 "register_operand" "=r")
+          (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
+      (clobber (reg:CC FLAGS_REG))])]
+  "!TARGET_64BIT"
+{
+  if (flag_pic && !TARGET_VXWORKS_RTP)
+    ix86_pc_thunk_call_expanded = true;
+})
+
+(define_insn "*set_got"
   [(set (match_operand:SI 0 "register_operand" "=r")
        (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
    (clobber (reg:CC FLAGS_REG))]
   [(set_attr "type" "multi")
    (set_attr "length" "12")])
 
-(define_insn "set_got_labelled"
+(define_expand "set_got_labelled"
+  [(parallel
+     [(set (match_operand:SI 0 "register_operand" "=r")
+          (unspec:SI [(label_ref (match_operand 1))]
+                     UNSPEC_SET_GOT))
+      (clobber (reg:CC FLAGS_REG))])]
+  "!TARGET_64BIT"
+{
+  if (flag_pic && !TARGET_VXWORKS_RTP)
+    ix86_pc_thunk_call_expanded = true;
+})
+
+(define_insn "*set_got_labelled"
   [(set (match_operand:SI 0 "register_operand" "=r")
        (unspec:SI [(label_ref (match_operand 1))]
         UNSPEC_SET_GOT))