aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2006-09-07 20:28:30 -0400
committerJason Merrill <jason@gcc.gnu.org>2006-09-07 20:28:30 -0400
commitd0655f33aa551fddb74b0d8c591b0f58468b8527 (patch)
tree01c9bb568034eaea41601799d2f2b67c4ecf7a44 /gcc
parent2e71a7a31e0e19e69bd3a34dbfb549871d461cc9 (diff)
downloadgcc-d0655f33aa551fddb74b0d8c591b0f58468b8527.zip
gcc-d0655f33aa551fddb74b0d8c591b0f58468b8527.tar.gz
gcc-d0655f33aa551fddb74b0d8c591b0f58468b8527.tar.bz2
re PR target/13685 (Building simple test application with -march=pentium3 -Os gives SIGSEGV (unaligned sse instruction))
PR target/13685 * config/i386/i386.c (override_options): Use 128-bit stack boundary if -msse. From-SVN: r116775
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-20.c26
3 files changed, 48 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 68c78ac..a430e20 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-07 Jason Merrill <jason@redhat.com>
+
+ PR target/13685
+ * config/i386/i386.c (override_options): Use 128-bit
+ stack boundary if -msse.
+
2006-09-07 Eric Christopher <echristo@apple.com>
* config/darwin.h (MACHO_SYMBOL_FLAG_VARIABLE): Update
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f668782..962b990 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1799,22 +1799,6 @@ override_options (void)
align_functions = processor_target_table[ix86_tune].align_func;
}
- /* Validate -mpreferred-stack-boundary= value, or provide default.
- The default of 128 bits is for Pentium III's SSE __m128, but we
- don't want additional code to keep the stack aligned when
- optimizing for code size. */
- ix86_preferred_stack_boundary = ((TARGET_64BIT || TARGET_MACHO || !optimize_size)
- ? 128 : 32);
- if (ix86_preferred_stack_boundary_string)
- {
- i = atoi (ix86_preferred_stack_boundary_string);
- if (i < (TARGET_64BIT ? 4 : 2) || i > 12)
- error ("-mpreferred-stack-boundary=%d is not between %d and 12", i,
- TARGET_64BIT ? 4 : 2);
- else
- ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT;
- }
-
/* Validate -mbranch-cost= value, or provide default. */
ix86_branch_cost = ix86_cost->branch_cost;
if (ix86_branch_cost_string)
@@ -1909,6 +1893,22 @@ override_options (void)
target_flags |= MASK_NO_RED_ZONE;
}
+ /* Validate -mpreferred-stack-boundary= value, or provide default.
+ The default of 128 bits is for Pentium III's SSE __m128, but we
+ don't want additional code to keep the stack aligned when
+ optimizing for code size. */
+ ix86_preferred_stack_boundary
+ = ((TARGET_MACHO || TARGET_SSE || !optimize_size) ? 128 : 32);
+ if (ix86_preferred_stack_boundary_string)
+ {
+ i = atoi (ix86_preferred_stack_boundary_string);
+ if (i < (TARGET_64BIT ? 4 : 2) || i > 12)
+ error ("-mpreferred-stack-boundary=%d is not between %d and 12", i,
+ TARGET_64BIT ? 4 : 2);
+ else
+ ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT;
+ }
+
/* Accept -msseregparm only if at least SSE support is enabled. */
if (TARGET_SSEREGPARM
&& ! TARGET_SSE)
diff --git a/gcc/testsuite/gcc.target/i386/sse-20.c b/gcc/testsuite/gcc.target/i386/sse-20.c
new file mode 100644
index 0000000..5aa8f7a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse-20.c
@@ -0,0 +1,26 @@
+/* PR target/13685 */
+/* { dg-options "-Os -msse" } */
+
+typedef float __m128 __attribute__ ((vector_size (16)));
+typedef int __m64 __attribute__ ((vector_size (8)));
+
+int puts (const char *s);
+void foo (__m128 *, __m64 *, int);
+
+int main (void)
+{
+ foo (0, 0, 0);
+ return 0;
+}
+
+void foo (__m128 *dst, __m64 *src, int n)
+{
+ __m128 xmm0 = { 0 };
+ while (n > 64)
+ {
+ puts ("");
+ xmm0 = __builtin_ia32_cvtpi2ps (xmm0, *src);
+ *dst = xmm0;
+ n --;
+ }
+}