Support unaligned load/store on more ARM targets

JF Bastien jfb at google.com
Wed May 15 14:24:39 PDT 2013


> When this option (unaligned access) was initially added the discussion
> ended with the default being conservative and correct. Subtarget can
> surely redefine it, if necessary (like Darwin).
>

Do you have a reference to the original discussion?


> So, the proper solution here would be:
>
> 1. Allow unaligned access on Linux
> 2. Add flag to control the behavior
> 3. Left the current conservative behavior for everything else
>

I'm not sure I agree: as you said subtargets can redefine the value, and in
other cases GCC's behavior is matched. Specifically I made this fix for
PNaCl, and I didn't want to fix performance just for PNaCl and ignore other
platforms, so I dug into what GCC and Linux do, and the rationale seems
sane: ARMv7 hardware has a feature to trap on unaligned accesses but that
feature is AFAIK used by OSes as a system-wide setting (not per-process).
ARMv7 hardware *must* support unaligned accesses, it's just a question of
whether the OS configures them to trap. I tried explaining this in the
code, see ARM ARM revC "A3.2.1 Unaligned data access" for more details.

My fix therefore follows what seems to be the sane way to use ARMv7
hardware, but this can always be overwritten with the -arm-strict-align
flag. Do you think that my assessment of "sane behavior on ARMv7" is
incorrect, and do you have subtarget examples where this would be a bad
thing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130515/e54b9967/attachment.html>


More information about the llvm-commits mailing list