PING: PATCH: PR target/37049: Unaligned move used on aligned destination of push insn

H.J. Lu hjl.tools@gmail.com
Wed Aug 13 15:07:00 GMT 2008


On Mon, Aug 04, 2008 at 06:37:32AM -0700, H.J. Lu wrote:
> When we expnd push to put a value on stack, the alignment of
> destination should be at least aligned to function argument
> boundary.  Otherwise, unaligned move will be used.  Tested on
> Linux/ia32 and Linux/Intel64.  OK for trunk?
> 

OK for trunk?

Thanks.


H.J.
----
gcc/

2008-08-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/37049
	* config/i386/i386.c (ix86_expand_push): Set memory alignment
	to function argument boundary.

gcc/testsuite/

2008-08-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/37049
	* gcc.target/i386/push-1.c: New.

--- gcc/config/i386/i386.c.push	2008-08-03 23:01:19.000000000 -0700
+++ gcc/config/i386/i386.c	2008-08-03 23:07:24.000000000 -0700
@@ -11945,6 +11945,12 @@ ix86_expand_push (enum machine_mode mode
     emit_move_insn (stack_pointer_rtx, tmp);
 
   tmp = gen_rtx_MEM (mode, stack_pointer_rtx);
+
+  /* When we push an operand onto stack, it has to be aligned at least
+     at the function argument boundary.  */
+  set_mem_align (tmp,
+		 ix86_function_arg_boundary (mode, NULL_TREE));
+
   emit_move_insn (tmp, x);
 }
 
--- gcc/testsuite/gcc.target/i386/push-1.c.push	2008-08-03 23:01:38.000000000 -0700
+++ gcc/testsuite/gcc.target/i386/push-1.c	2008-08-03 23:06:03.000000000 -0700
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-w -msse2 -Os" } */
+
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+
+extern void foo (__m128 x, __m128 y ,__m128 z ,__m128 a, int size);
+
+void
+bar (void)
+{
+  __m128 x = { 1.0 };
+  foo (x, x, x, x, 5);
+}
+
+/* { dg-final { scan-assembler-not "movups" } } */



More information about the Gcc-patches mailing list