Hi,

This patch set adds support for a new command line option "-moverride".
The purpose of this command line is to allow expert-level users of the
compiler, and those comfortable with experimenting with the compiler,
*unsupported* full access to the tuning structures used in the AArch64
back-end.

For now, we only enable command-line access to the fusion pairs to
enable and whether or not to use the Cortex-A57 FMA register renaming
pass. Though in future we can expand this further.

With this patch, you might write something like:

  -moverride=fuse=adrp+add.cmp+branch:tune=rename_fma_regs

To enable fusion of adrp+add and cmp+branch and to enable the
cortex-a57-fma-steering pass.

The registration of a new sub-option is table driven, you add an
option name and a function which mutates the tuning parameters having
parsed the string you are given to aarch64_tuning_override_functions.

Expanding this for some of the other options (or groups of options) is
therefore fairly easy, but I haven't done it yet.

The patch set first refactors the fusion and pass tuning structures
to drive them through definitions in tables
( config/aarch64/aarch64-fusion-pairs.def,
  config/aarch64/aarch64-tuning-flags.def ). We then de-constify the
tune_params structure, as it can now modify. Finally we wire up the
new option, and add the parsing code to give the desired behaviour.

I've bootstrapped and tested the patch set on aarch64-none-linux-gnu
with BOOT_CFLAGS set to the example string above, and again in the
standard configuration with no issues.

OK for trunk?

Thanks,
James

---
[Patch AArch64 1/4] Define candidates for instruction fusion in a .def file

gcc/

2015-06-23  James Greenhalgh  <james.greenha...@arm.com>

        * config/aarch64/aarch64-fusion-pairs.def: New.
        * config/aarch64/aarch64-protos.h (aarch64_fusion_pairs): New.
        * config/aarch64/aarch64.c (AARCH64_FUSE_NOTHING): Move to
        aarch64_fusion_pairs.
        (AARCH64_FUSE_MOV_MOVK): Likewise.
        (AARCH64_FUSE_ADRP_ADD): Likewise.
        (AARCH64_FUSE_MOVK_MOVK): Likewise.
        (AARCH64_FUSE_ADRP_LDR): Likewise.
        (AARCH64_FUSE_CMP_BRANCH): Likewise.

---
[Patch AArch64 2/4] Control the FMA steering pass in tuning
 structures rather than as core property

gcc/

2015-06-23  James Greenhalgh  <james.greenha...@arm.com>

        * config/aarch64/aarch64.h (AARCH64_FL_USE_FMA_STEERING_PASS): Delete.
        (aarch64_tune_flags): Likewise.
        (AARCH64_TUNE_FMA_STEERING): Likewise.
        * config/aarch64/aarch64-cores.def (cortex-a57): Remove reference
        to AARCH64_FL_USE_FMA_STEERING_PASS.
        (cortex-a57.cortex-a53): Likewise.
        (cortex-a72): Use cortexa72_tunings.
        (cortex-a72.cortex-a53): Likewise.
        (exynos-m1): Likewise.
        * config/aarch64/aarch64-protos.h (tune_params): Add
        a field: extra_tuning_flags.
        * config/aarch64/aarch64-tuning-flags.def: New.
        * config/aarch64/aarch64-protos.h (AARCH64_EXTRA_TUNING_OPTION): New.
        (aarch64_extra_tuning_flags): Likewise.
        (aarch64_tune_params): Declare here.
        * config/aarch64/aarch64.c (generic_tunings): Set extra_tuning_flags.
        (cortexa53_tunings): Likewise.
        (cortexa57_tunings): Likewise.
        (thunderx_tunings): Likewise.
        (xgene1_tunings): Likewise.
        (cortexa72_tunings): New.
        * config/aarch64/cortex-a57-fma-steering.c: Include aarch64-protos.h.
         (gate): Check against aarch64_tune_params.
        * config/aarch64/t-aarch64 (cortex-a57-fma-steering.o): Depend on
        aarch64-protos.h.

---
[Patch AArch64 3/4] De-const-ify struct tune_params

gcc/

2015-06-23  James Greenhalgh  <james.greenha...@arm.com>

        * config/aarch64/aarch64-protos.h (tune_params): Remove
        const from members.
        (aarch64_tune_params): Remove const, change to no longer be
        a pointer.
        * config/aarch64/aarch64.c (aarch64_tune_params): Remove const,
        change to no longer be a pointer, initialize to generic_tunings.
        (aarch64_min_divisions_for_recip_mul): Change dereference of
        aarch64_tune_params to member access.
        (aarch64_reassociation_width): Likewise.
        (aarch64_rtx_mult_cost): Likewise.
        (aarch64_address_cost): Likewise.
        (aarch64_branch_cost): Likewise.
        (aarch64_rtx_costs): Likewise.
        (aarch64_register_move_cost): Likewise.
        (aarch64_memory_move_cost): Likewise.
        (aarch64_sched_issue_rate): Likewise.
        (aarch64_builtin_vectorization_cost): Likewise.
        (aarch64_override_options): Take a copy of the selected tuning
        struct in to aarch64_tune_params, rather than just setting
        a pointer, change dereferences of aarch64_tune_params to member
        accesses.
        (aarch64_override_options_after_change): Change dereferences of
        aarch64_tune_params to member access.
        (aarch64_macro_fusion_p): Likewise.
        (aarch_macro_fusion_pair_p): Likewise.
        * config/aarch64/cortex-a57-fma-steering.c (gate): Likewise.

---

[Patch AArch64 4/4] Add -moverride tuning command, and wire it up for
 control of fusion and fma-steering

gcc/

2015-06-23  James Greenhalgh  <james.greenha...@arm.com>

        * config/aarch64/aarch64.opt: (override): New.
        * doc/invoke.texi (override): Document.
        * config/aarch64/aarch64.c (aarch64_flag_desc): New
        (aarch64_fusible_pairs): Likewise.
        (aarch64_tuning_flags): Likewise.
        (aarch64_tuning_override_function): Likewise.
        (aarch64_tuning_override_functions): Likewise.
        (aarch64_parse_one_option_token): Likewise.
        (aarch64_parse_boolean_options): Likewise.
        (aarch64_parse_fuse_string): Likewise.
        (aarch64_parse_tune_string): Likewise.
        (aarch64_parse_one_override_token): Likewise.
        (aarch64_parse_override_string): Likewise.
        (aarch64_override_options): Parse the -override string if it
        is present.

Reply via email to