Store merging refuses to widen a group below its alignment on a STRICT_ALIGNMENT
target, even where the target has a single-instruction misaligned move.  This
adds a hook for "is the misaligned access cheap", uses it in the pass, and
implements it for arm.

It is split because the three parts want different reviewers: the hook is a
global-maintainer question, the pass change is store merging, and the last patch
is arm.  Patches 1/3 and 2/3 change no generated code on any target, because the
hook defaults to false wherever STRICT_ALIGNMENT is true; nothing moves until 
3/3.

Bootstrapped and regression tested on x86_64-pc-linux-gnu, and built after 1/3 
alone and 1/3+2/3
and with the whole series (STRICT_ALIGNMENT is 0 there, so the hook is false and
the new path is not exercised); regression tested on arm-none-eabi with arm.exp,
dg.exp and tree-ssa.exp, on the default, cortex-a15 and cortex-m0 boards.

Dominic P (3):
  target: add TARGET_MISALIGNED_ACCESS_CHEAP_P
  tree-optimization: merge stores below their alignment where the target
    says it is cheap
  arm: allow merged stores below their alignment

 gcc/config/arm/arm.cc                         | 13 ++++++
 gcc/doc/tm.texi                               | 19 ++++++++
 gcc/doc/tm.texi.in                            |  2 +
 gcc/gimple-ssa-store-merging.cc               | 26 +++++++++--
 gcc/target.def                                | 21 +++++++++
 gcc/targhooks.cc                              |  9 ++++
 gcc/targhooks.h                               |  1 +
 .../gcc.dg/torture/store-merging-misaligned.c | 43 +++++++++++++++++++
 .../gcc.target/arm/store-merge-unaligned-2.c  | 18 ++++++++
 .../gcc.target/arm/store-merge-unaligned-3.c  | 16 +++++++
 .../gcc.target/arm/store-merge-unaligned-4.c  | 15 +++++++
 .../gcc.target/arm/store-merge-unaligned-5.c  | 25 +++++++++++
 .../gcc.target/arm/store-merge-unaligned-6.c  | 18 ++++++++
 .../gcc.target/arm/store-merge-unaligned.c    | 27 ++++++++++++
 14 files changed, 250 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/torture/store-merging-misaligned.c
 create mode 100644 gcc/testsuite/gcc.target/arm/store-merge-unaligned-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/store-merge-unaligned-3.c
 create mode 100644 gcc/testsuite/gcc.target/arm/store-merge-unaligned-4.c
 create mode 100644 gcc/testsuite/gcc.target/arm/store-merge-unaligned-5.c
 create mode 100644 gcc/testsuite/gcc.target/arm/store-merge-unaligned-6.c
 create mode 100644 gcc/testsuite/gcc.target/arm/store-merge-unaligned.c

-- 
2.55.0

Reply via email to