This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
i386 PATCH for target/13685
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>
- Date: Thu, 07 Sep 2006 20:26:45 -0400
- Subject: i386 PATCH for target/13685
The testcase in 13685 breaks because -Os implies a smaller
PREFERRED_STACK_BOUNDARY than SSE requires. This patch causes us to use
the 128-bit boundary if SSE is enabled, which fixes the bug.
Tested i686-pc-linux-gnu, applied to trunk.
2006-09-07 Jason Merrill <jason@redhat.com>
PR target/13685
* config/i386/i386.c (override_options): Use 128-bit
stack boundary if -msse.
Index: config/i386/i386.c
===================================================================
*** config/i386/i386.c (revision 116703)
--- config/i386/i386.c (working copy)
*************** override_options (void)
*** 1798,1819 ****
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)
--- 1798,1803 ----
*************** override_options (void)
*** 1908,1913 ****
--- 1892,1913 ----
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)
Index: testsuite/gcc.target/i386/sse-20.c
===================================================================
*** testsuite/gcc.target/i386/sse-20.c (revision 0)
--- testsuite/gcc.target/i386/sse-20.c (revision 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 --;
+ }
+ }