This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/78355] LRA generates unaligned accesses when SLOW_UNALIGNED_ACCESS is 1
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Nov 2016 08:44:50 +0000
- Subject: [Bug middle-end/78355] LRA generates unaligned accesses when SLOW_UNALIGNED_ACCESS is 1
- Auto-submitted: auto-generated
- References: <bug-78355-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78355
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-11-15
CC| |ebotcazou at gcc dot gnu.org,
| |vmakarov at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> I think the problem here is that SLOW_UNALIGNED_ACCESS is sloppily
> defined by my port, and defaults.h, to be a constant, but it is then
> used with naturally-aligned data, access to which is never slow, and
> expected to return false. So it would probably be best to replace the
> condition by
>
> if (!SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg))
> || (MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (innermode)
> && SLOW_UNALIGNED_ACCESS (innermode, MEM_ALIGN (reg)))
> || MEM_ALIGN (reg) >= GET_MODE_ALIGNMENT (mode))
> return true;
Yes, SLOW_UNALIGNED_ACCESS ought to be invoked only for unaligned accesses,
i.e. only when ALIGNMENT < GET_MODE_ALIGNMENT (mode), see e.g. the RTL
expander, so your proposed change is the way to go. But I'd rewrite it into:
if (!(MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (mode)
&& SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg)))
|| (MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (innermode)
&& SLOW_UNALIGNED_ACCESS (innermode, MEM_ALIGN (reg))))
return true;
I'm going to test it on ARM, which has the same settings as your port, and this
will probably also help the SPARC port for the switch to LRA.
Vladimir, what do you think?