aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/aarch64/aarch64.c14
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9a62e12..c39b351 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-07 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_legitimize_address):
+ Avoid use of base_offset if offset already in range.
+
2016-09-07 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh-protos.h (struct sh_atomic_model,
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5efad46..2be750e 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5082,9 +5082,19 @@ aarch64_legitimize_address (rtx x, rtx /* orig_x */, machine_mode mode)
/* For offsets aren't a multiple of the access size, the limit is
-256...255. */
else if (offset & (GET_MODE_SIZE (mode) - 1))
- base_offset = (offset + 0x100) & ~0x1ff;
+ {
+ base_offset = (offset + 0x100) & ~0x1ff;
+
+ /* BLKmode typically uses LDP of X-registers. */
+ if (mode == BLKmode)
+ base_offset = (offset + 512) & ~0x3ff;
+ }
+ /* Small negative offsets are supported. */
+ else if (IN_RANGE (offset, -256, 0))
+ base_offset = 0;
+ /* Use 12-bit offset by access size. */
else
- base_offset = offset & ~0xfff;
+ base_offset = offset & (~0xfff * GET_MODE_SIZE (mode));
if (base_offset != 0)
{