re PR target/68701 ("gcc -m32 -finstrument-functions -ffixed-ebp" produces internal...
authorUros Bizjak <ubizjak@gmail.com>
Tue, 8 Dec 2015 18:41:21 +0000 (19:41 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 8 Dec 2015 18:41:21 +0000 (19:41 +0100)
PR target/68701
* config/i386/i386.c (ix86_option_override_internal): Enable
-maccumulate-outgoing-args when %ebp is fixed due to stack
realignment requirements.

testsuite/ChangeLog:

PR target/68701
* testsuite/gcc.target/i386/pr68701-1.c: New test.
* testsuite/gcc.target/i386/pr68701-2.c: Ditto.

From-SVN: r231419

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr68701-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr68701-2.c [new file with mode: 0644]

index 94331edf3aa76fd1895b45764d9341629967999c..ed8dd112cdc267e19712ea148a148f04f30e466d 100644 (file)
@@ -1,3 +1,10 @@
+2015-12-08  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/68701
+       * config/i386/i386.c (ix86_option_override_internal): Enable
+       -maccumulate-outgoing-args when %ebp is fixed due to stack
+       realignment requirements.
+
 2015-12-08  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/68640
index e423b3c1897a765966e9522b5e1209dc9bb4561f..d30fbff7af489afd81b2010de0989e03d4b35ed8 100644 (file)
@@ -5296,6 +5296,17 @@ ix86_option_override_internal (bool main_args_p,
       opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
     }
 
+  /* Stack realignment without -maccumulate-outgoing-args requires %ebp,
+     so enable -maccumulate-outgoing-args when %ebp is fixed.  */
+  if (fixed_regs[BP_REG]
+      && !(opts->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS))
+    {
+      if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
+       warning (0, "fixed ebp register requires %saccumulate-outgoing-args%s",
+                prefix, suffix);
+      opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
+    }
+
   /* Figure out what ASM_GENERATE_INTERNAL_LABEL builds as a prefix.  */
   {
     char *p;
index 80f85c836e68939a860c28e5cb1f0ecb25a9fde9..55aa177a303d8df5be36c84e35b87b834b52a0f3 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-08  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/68701
+       * testsuite/gcc.target/i386/pr68701-1.c: New test.
+       * testsuite/gcc.target/i386/pr68701-2.c: Ditto.
+
 2015-12-08  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/sse4_1-round.h (do_round): Fix inline asm statements.
diff --git a/gcc/testsuite/gcc.target/i386/pr68701-1.c b/gcc/testsuite/gcc.target/i386/pr68701-1.c
new file mode 100644 (file)
index 0000000..008eb6b
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ffixed-ebp -mno-accumulate-outgoing-args" } */
+
+/* { dg-warning "fixed ebp register requires" "" { target *-*-* } 0 } */
+
+void foo (void);
+
+int
+main (int argc, char *argv[])
+{
+  foo ();
+  return argc - 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr68701-2.c b/gcc/testsuite/gcc.target/i386/pr68701-2.c
new file mode 100644 (file)
index 0000000..bfe592e
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ffixed-ebp -mno-accumulate-outgoing-args -mstackrealign -msse" } */
+
+/* { dg-warning "fixed ebp register requires" "" { target *-*-* } 0 } */
+
+typedef float V __attribute__((vector_size(16)));
+
+void bar (V a)
+{
+  volatile V b = a;
+}