The avoid-store-forwarding pass is disabled by default and therefore
in the risk of bit-rotting.  This patch addresses this by enabling
the pass at O2 or higher.

We are, also, adding the target-specific cost function
`avoid_store_forwarding_reorder_cost_p`. There is no specific implementation
for this at the time. It always returns "true" on AArch64 and the return value
depends on the newly added `asf-default-cost-value` parameter for all the other
targets, which is "false" by default.

Bootstrapped/regtested on AArch64 and x86_64.

Changes in v3:
- Add `avoid_store_forwarding_reorder_cost_p` function
- Add `asf-default-cost-value` parameter
- Use `avoid_store_forwarding_reorder_cost_p` for each store in ASF.
- Update x86_64 testcases.
- Update assembly patterns in `bitfield-bitint-abi-align16.c` and
`bitfield-bitint-abi-align8.c`.
- Fix bug where the result of `store_bit_field` is not used in the
following instructions.

Changes in v2:
- Update assembly patterns in `bitfield-bitint-abi-align16.c` and
`bitfield-bitint-abi-align8.c`.

Changes in v1:
- Enable asf by default at O2 or higher.

Konstantinos Eleftheriou (4):
  asf: Add cost function for store/load reordering
  aarch64: Add implementation for avoid_store_forwarding_reorder_cost_p
  asf: Check store-load reordering cost before applying the
    transformation
  asf: Update destination register after store_bit_field when needed

kelefth (1):
  asf: Enable pass at O2 or higher

 gcc/avoid-store-forwarding.cc                 | 55 ++++++++++++++++++-
 gcc/config/aarch64/aarch64.cc                 | 13 +++++
 gcc/doc/invoke.texi                           |  3 +-
 gcc/doc/tm.texi                               |  7 +++
 gcc/doc/tm.texi.in                            |  2 +
 gcc/opts.cc                                   |  1 +
 gcc/params.opt                                |  4 ++
 gcc/target.def                                |  9 +++
 gcc/targhooks.cc                              |  9 +++
 gcc/targhooks.h                               |  5 ++
 .../aarch64/avoid-store-forwarding-6.c        | 29 ++++++++++
 .../aarch64/bitfield-bitint-abi-align16.c     | 25 +++++----
 .../aarch64/bitfield-bitint-abi-align8.c      | 25 +++++----
 .../abi/callabi/avoid-store-forwarding-1.c    |  2 +-
 .../abi/callabi/avoid-store-forwarding-2.c    |  2 +-
 15 files changed, 164 insertions(+), 27 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/avoid-store-forwarding-6.c

-- 
2.50.1

Reply via email to