This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR target/35767: x86 backend uses aligned load on unaligned memory
On Tue, May 27, 2008 at 7:51 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 27, 2008 at 04:41:57PM +0200, Uros Bizjak wrote:
>> On Tue, May 27, 2008 at 4:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> > When __attribute__((packed)) is applied to __m128, it becomes
>> > unaligned. We can't use aligned access on it. Also we should
>> > check canonical type since it may be used for parameter passing.
>> > This patch fixes the problem, similar to _Decimal128. OK for
>> > mainline?
>>
>> IIRC, using SSE_REG_MODE_P resulted in unaligned access when SSE mode
>> values were passed on (or spilled to?) the stack, so the change that
>
> I noticed it also. It was a middle-end bug where it failed to
> record alignment on spill slot. It was fixed as the part of
> PR middle-end/36253:
>
> http://gcc.gnu.org/ml/gcc-patches/2008-05/msg01615.html
>
> @@ -432,6 +438,7 @@
> frame_offset += size;
>
> x = gen_rtx_MEM (mode, addr);
> + set_mem_align (x, alignment_in_bits);
> MEM_NOTRAP_P (x) = 1;
>
> stack_slot_list
>
>> your patch now reverts was introduced [1]. Since there was a lot of
>> work recently in this area, can you check how SSE values are pushed to
>> stack with your patch?
>>
>> [1] http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01863.html
>
> I will double check it.
>
http://gcc.gnu.org/ml/gcc-patches/2008-05/msg01615.html
added
+ /* Verify that the alignment of spill space is equal to or greater
+ than required. */
+ gcc_assert (GET_MODE_ALIGNMENT (GET_MODE (mem)) <= MEM_ALIGN (mem));
+
There are no regressions on Linux/Intel64:
http://gcc.gnu.org/ml/gcc-testresults/2008-05/msg02339.html
which is configured with
--enable-clocale=gnu --with-system-zlib --enable-checking=assert
--with-demangler-in-ld --enable-shared --enable-threads=posix
--enable-haifa --prefix=/usr/gcc-4.4 --with-local-prefix=/usr/local
H.J.