* [aarch64] Add legitimize_address hook
@ 2014-10-16 16:23 Richard Earnshaw
0 siblings, 0 replies; only message in thread
From: Richard Earnshaw @ 2014-10-16 16:23 UTC (permalink / raw)
To: gcc-patches
AArch64 currently does not have a legitimize address hook to find better
solutions for loading from addresses that are not valid. The current
approach 'gets away with it' much of the time because we currently split
constants during expand. We might change that soon, since it is
inhibits other optimizations. Even so, there are some cases where we
don't get code that is as good as it can be. Consider:
typedef double t;
t f(char *a)
{
return *(t*)(a+4093) + *(t*)(a+4266);
}
This currently expands to
add x1, x0, 4093
add x0, x0, 4096
ldr d1, [x1]
ldr d0, [x0,170]
fadd d0, d1, d0
ret
With the patch, we now get
add x0, x0, 4096
ldr d1, [x0,-3]
ldr d0, [x0,170]
fadd d0, d1, d0
ret
Saving us an instruction.
* aarch64.c (aarch64_legitimize_address): New function
(TARGET_LEGITIMIZE_ADDRESS): Redefine.
Bootstrapped and tested; committed to trunk.
R.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-16 16:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16 16:23 [aarch64] Add legitimize_address hook Richard Earnshaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).