This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, ARM] Misaligned access support for ARM Neon
- From: Paul Brook <paul at codesourcery dot com>
- To: Julian Brown <julian at codesourcery dot com>
- Cc: Richard Earnshaw <rearnsha at arm dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Ira Rosen <IRAR at il dot ibm dot com>, gcc-patches at gcc dot gnu dot org, eres at il dot ibm dot com
- Date: Mon, 21 Dec 2009 12:20:12 +0000
- Subject: Re: [PATCH, ARM] Misaligned access support for ARM Neon
- References: <20091117171931.053faec2@rex.config> <1259593368.6000.40.camel@e200601-lin.cambridge.arm.com> <20091218172204.3c0eab5b@rex.config>
On Friday 18 December 2009, Julian Brown wrote:
> On Mon, 30 Nov 2009 15:02:48 +0000
>
> Richard Earnshaw <rearnsha@arm.com> wrote:
> > I certainly think we shouldn't be hiding knowledge about the element
> > to vector-lane mapping from the vectorizer -- and that the vectorizer
> > should understand that vector copies are not necessarily the same as
> > vectorizing loads. Anything else and we will ultimately have parts of
> > the compiler fighting against each other and that way lies subtle
> > bugs.
>
> This is a version of the patch which doesn't attempt to resolve the
> discrepancy between vector copies and vectorizing loads/stores (thus is
> only intended to work in little-endian mode, leaving big-endian mode as
> an open problem). So, vldr/vstr etc. will still be used for aligned
> accesses, and any issues with adding semantics to movmisalign<mode> are
> sidestepped.
I don't think this is correct. The original patch contained two hooks:
* VECTOR_MIN_ALIGN: Reduce the alignment required for an "aligned" vector
load.
* VECTOR_ALWAYS_MISALIGN: Use special instructions when loading vectorized
array data. To minimize churn these "special instructions" used the tree codes
and RTL patterns that already existed for misaligned vectors. With hindsight
this may have been a mistake. When this hook returns true we probably should
not be using movmisalign for unaligned vectors.
By my reading(unverified) your latest patch will use VLDR for element aligned
data and VLD1 for unaligned data. Neither of these are correct.
If you are unable to distinguish between vector objects and array data then
you have a couple of options (either or both):
- Have V_M_A return 32 for ARM. This is possible because while the ABI
required 64-bit alignment, the NEON vector load/store instructions only
require 32-bit alignment. Some care required as this will break if we end up
loading into core registers (ldrd/strd). This will "fix" int/float code but
not help short/char.
- Add movmisalign. Either ignore the fact that packed structures break, or add
yet annother hook for "misaligned vectors must be at least {-this-} aligned".
This will not work for big-endian vectors, and will go away once we implement
array load support.
Paul
P.S.
unaligned: byte aligned, typically from a packed structure.
element aligned: natural alignment of array data.
vector aligned: ABI specified alignment for vector objects.