[ARM] PR 82445 - suppress 32-bit aligned ldrd/strd peepholing with -mno-unaligned...
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 19 Oct 2017 13:10:42 +0000 (13:10 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Thu, 19 Oct 2017 13:10:42 +0000 (13:10 +0000)
commit3bb3d60b1e67ececd2e0549f42fbf7d98e024c6b
treea14a795717464a028ac09330f1d6291ef87df06c
parent07d7c611fc0c4be0a0be935efe97a7887e78bc2a
[ARM] PR 82445 - suppress 32-bit aligned ldrd/strd peepholing with -mno-unaligned-access

Peephole patterns exist in the arm backend to spot load/store
operations to adjacent memory operations in order to convert them into
ldrd/strd instructions.  However, when we have strict alignment
enforced, then we can only do this if the accesses are known to be
64-bit aligned; this is unlikely to be the case for most loads.  The
patch adds some alignment checking to the code that validates the
addresses for use in the peephole patterns.  This should also fix
incorrect generation of ldrd/strd with unaligned accesses that could
previously have occurred on ARMv5e where all such operations must be
64-bit aligned.

I've added some new tests as well.  In doing so I discovered that the
ldrd/strd peephole tests could never fail since they would match the
source file name in the scanned assembly as well as any instructions
of the intended type.  I've fixed those by tightening the scan results
slightly.

gcc:

* config/arm/arm.c (align_ok_ldrd_strd): New function.
(mem_ok_for_ldrd_strd): New parameter align.  Extract the alignment of the
mem into it.
(gen_operands_ldrd_strd): Validate the alignment of the accesses.

testsuite:

* gcc.target/arm/peep-ldrd-1.c: Tighten test scan pattern.
* gcc.target/arm/peep-strd-1.c: Likewise.
* gcc.target/arm/peep-ldrd-2.c: New test.
* gcc.target/arm/peep-strd-2.c: New test.

From-SVN: r253890
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
gcc/testsuite/gcc.target/arm/peep-ldrd-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/peep-strd-1.c
gcc/testsuite/gcc.target/arm/peep-strd-2.c [new file with mode: 0644]