+2017-10-26 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_legitimize_address_displacement):
+ Improve unaligned TImode/TFmode base/offset split.
+
2017-10-26 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
/* Split an out-of-range address displacement into a base and offset.
Use 4KB range for 1- and 2-byte accesses and a 16KB range otherwise
to increase opportunities for sharing the base address of different sizes.
- For unaligned accesses and TI/TF mode use the signed 9-bit range. */
+ Unaligned accesses use the signed 9-bit range, TImode/TFmode use
+ the intersection of signed scaled 7-bit and signed 9-bit offset. */
static bool
aarch64_legitimize_address_displacement (rtx *disp, rtx *off, machine_mode mode)
{
HOST_WIDE_INT offset = INTVAL (*disp);
- HOST_WIDE_INT base = offset & ~(GET_MODE_SIZE (mode) < 4 ? 0xfff : 0x3ffc);
+ HOST_WIDE_INT base;
- if (mode == TImode || mode == TFmode
- || (offset & (GET_MODE_SIZE (mode) - 1)) != 0)
+ if (mode == TImode || mode == TFmode)
+ base = (offset + 0x100) & ~0x1f8;
+ else if ((offset & (GET_MODE_SIZE (mode) - 1)) != 0)
base = (offset + 0x100) & ~0x1ff;
+ else
+ base = offset & ~(GET_MODE_SIZE (mode) < 4 ? 0xfff : 0x3ffc);
*off = GEN_INT (base);
*disp = GEN_INT (offset - base);
+2017-10-26 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * gcc.target/aarch64/ldp_stp_unaligned_2.c: New file.
+
2017-10-26 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.target/arm/require-pic-register-loc.c: Use wider regex for
--- /dev/null
+/* { dg-options "-O2 -fomit-frame-pointer" } */
+
+/* Check that we split unaligned LDP/STP into base and aligned offset. */
+
+typedef struct
+{
+ int a, b, c, d, e;
+} S;
+
+void foo (S *);
+
+void test (int x)
+{
+ S s = { .a = x };
+ foo (&s);
+}
+
+/* { dg-final { scan-assembler-not "mov\tx\[0-9\]+, sp" } } */