This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix alignment information in RTL for known misaligned addresses.


On Fri, Dec 24, 2010 at 4:41 PM, Ramana Radhakrishnan
<ramana.radhakrishnan@arm.com> wrote:
> Hi,
>
> We've been investigating a few failures in the regression testsuite with
> Neon enabled and these show up here.
>
> http://gcc.gnu.org/ml/gcc-testresults/2010-12/msg02072.html
>
> One of the failures is with the builtins test for memcpy.
>
> memcpy is called with the following values.
>
> ?(dst=0x15360, src=0xbb7c, n=17)
>
> It ends up with a bus error on a Cortex A9 because we have a vld1.8
> instruction with an alignment specifier of 64 bits and the address we
> pass (src) in this case is not 64 bit aligned. The alignment specifiers
> are supposed to be hints to the memory system to accelerate memory
> accesses.
>
> If the address is not aligned as per the alignment specifier i.e. you've
> specified more alignment than you actually have in the base address the
> hardware will cause an unaligned access abort. ?Thus it's important for
> the compiler to track alignment information correctly.
>
> This attached patch by Richard attempts to fix this by setting the
> correct alignment to the generated memory rtx before the generation of
> the call to movmisalign_optab. By default the memory alignment is set to
> be the natural alignment of the type rather than what the alignment was
> set up to be at the gimple level.
>
> This fixes all the failures with respect to builtins.exp that were
> observed in the test report and fixes runs for a number of benchmarks
> that were failing with Neon turned on at O3. A full bootstrap and test
> for armv7-a , neon and softfp is on currently.
>
> Ok to commit if no regressions ?

The correct way to fix this is IMHO to make set_mem_attributes_minus_bitpos
not get initial alignment from the mode (but assert the mem-attrs are not
set yet in that function).  At least if I understand the problem correctly.

Ulrich promised to do this a while back ...

Richard.

> cheers
> Ramana
>
> <DATE> ?Richard Earnshaw ?<rearnsha@arm.com>
>
> ? ? ? ?* expr.c (expand_assignment): Set MEM_ALIGN correctly for
> ? ? ? ?misaligned accesses.
> ? ? ? ?(expand_expr_real_1): Likewise.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]