summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-01-25 12:31:45 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-01-27 08:01:56 -0800
commit86e040399dd5ca6b23597be4aff5edb9ac2ab5d7 (patch)
tree8b53913bf45e42fb9a1c29cbe48bcc76e37053e2
parent8b7d2f846259156df9d32c2fd69f51ac2e830328 (diff)
downloadgcc-hjl/pr69454/master.tar.gz
Don't align DImode to 32 bits if the STV pass is enabledhjl/pr69454/master
Since the STV pass uses SSE2 instructions on DImode which needs 64-bit alignment for DImode, don't align DImode to 32 bits if the STV pass is enabled. gcc/ PR target/69454 * config/i386/i386.c (convert_scalars_to_vector): Don't change stack alignment here. (ix86_minimum_alignment): Don't align DImode to 32 bits if the STV pass is enabled. gcc/testsuite/ PR target/69454 * gcc.target/i386/pr69454-1.c: New test. * gcc.target/i386/pr69454-2.c: Likewise.
-rw-r--r--gcc/config/i386/i386.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr69454-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr69454-2.c13
3 files changed, 28 insertions, 12 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index cfbdf0f1734..8babdaf714e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3588,16 +3588,6 @@ convert_scalars_to_vector ()
bitmap_obstack_release (NULL);
df_process_deferred_rescans ();
- /* Conversion means we may have 128bit register spills/fills
- which require aligned stack. */
- if (converted_insns)
- {
- if (crtl->stack_alignment_needed < 128)
- crtl->stack_alignment_needed = 128;
- if (crtl->stack_alignment_estimated < 128)
- crtl->stack_alignment_estimated = 128;
- }
-
return 0;
}
@@ -29299,8 +29289,10 @@ ix86_minimum_alignment (tree exp, machine_mode mode,
return align;
/* Don't do dynamic stack realignment for long long objects with
- -mpreferred-stack-boundary=2. */
- if ((mode == DImode || (type && TYPE_MODE (type) == DImode))
+ -mpreferred-stack-boundary=2. The STV pass uses SSE2 instructions
+ on DImode which needs 64-bit alignment for DImode. */
+ if (!(TARGET_STV && TARGET_SSE2 && optimize > 1)
+ && (mode == DImode || (type && TYPE_MODE (type) == DImode))
&& (!type || !TYPE_USER_ALIGN (type))
&& (!decl || !DECL_USER_ALIGN (decl)))
return 32;
diff --git a/gcc/testsuite/gcc.target/i386/pr69454-1.c b/gcc/testsuite/gcc.target/i386/pr69454-1.c
new file mode 100644
index 00000000000..12ecfd324c6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr69454-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -msse2 -mno-accumulate-outgoing-args -mpreferred-stack-boundary=2" } */
+
+typedef struct { long long w64[2]; } V128;
+extern V128* fn2(void);
+long long a;
+V128 b;
+void fn1() {
+ V128 *c = fn2();
+ c->w64[0] = a ^ b.w64[0];
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr69454-2.c b/gcc/testsuite/gcc.target/i386/pr69454-2.c
new file mode 100644
index 00000000000..4820b76fb72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr69454-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -msse2 -mno-accumulate-outgoing-args -mpreferred-stack-boundary=2" } */
+
+extern void fn2 (void);
+long long a, b;
+void
+fn1 (void)
+{
+ long long c = a;
+ a = b ^ a;
+ fn2 ();
+ a = c;
+}