peep-strd-1.c
218 Bytes
-
[ARM] PR 82445 - suppress 32-bit aligned ldrd/strd peepholing with -mno-unaligned-access · 3bb3d60b
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
Richard Earnshaw committed