From 665dd6f3fab6947d834153fbbdacbd3f1348e6df Mon Sep 17 00:00:00 2001 From: James Greenhalgh Date: Fri, 26 Jun 2015 13:54:53 +0000 Subject: [PATCH] [Patch AArch64 1/4] Define candidates for instruction fusion in a .def file gcc/ * 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. From-SVN: r225014 --- gcc/ChangeLog | 12 +++++++ gcc/config/aarch64/aarch64-fusion-pairs.def | 38 +++++++++++++++++++++ gcc/config/aarch64/aarch64-protos.h | 20 +++++++++++ gcc/config/aarch64/aarch64.c | 7 ---- 4 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 gcc/config/aarch64/aarch64-fusion-pairs.def diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c508303ac9b..0d81aa7a5a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2015-06-26 James Greenhalgh + + * 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. + 2015-06-26 Jiong Wang * config/aarch64/aarch64-protos.h (aarch64_symbol_type): Rename diff --git a/gcc/config/aarch64/aarch64-fusion-pairs.def b/gcc/config/aarch64/aarch64-fusion-pairs.def new file mode 100644 index 00000000000..a7b00f6975d --- /dev/null +++ b/gcc/config/aarch64/aarch64-fusion-pairs.def @@ -0,0 +1,38 @@ +/* Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by ARM Ltd. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +/* Pairs of instructions which can be fused. before including this file, + define a macro: + + AARCH64_FUSION_PAIR (name, internal_name, index_bit) + + Where: + + NAME is a string giving a friendly name for the instructions to fuse. + INTERNAL_NAME gives the internal name suitable for appending to + AARCH64_FUSE_ to give an enum name. + INDEX_BIT is the bit to set in the bitmask of supported fusion + operations. */ + +AARCH64_FUSION_PAIR ("mov+movk", MOV_MOVK, 0) +AARCH64_FUSION_PAIR ("adrp+add", ADRP_ADD, 1) +AARCH64_FUSION_PAIR ("movk+movk", MOVK_MOVK, 2) +AARCH64_FUSION_PAIR ("adrp+ldr", ADRP_LDR, 3) +AARCH64_FUSION_PAIR ("cmp+branch", CMP_BRANCH, 4) + diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 249a701a291..804aae4e6fa 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -190,6 +190,26 @@ struct tune_params const int min_div_recip_mul_df; }; +#define AARCH64_FUSION_PAIR(x, name, index) \ + AARCH64_FUSE_##name = (1 << index), +/* Supported fusion operations. */ +enum aarch64_fusion_pairs +{ + AARCH64_FUSE_NOTHING = 0, +#include "aarch64-fusion-pairs.def" + +/* Hacky macro to build AARCH64_FUSE_ALL. The sequence below expands + to: + AARCH64_FUSE_ALL = 0 | AARCH64_FUSE_index1 | AARCH64_FUSE_index2 ... */ +#undef AARCH64_FUSION_PAIR +#define AARCH64_FUSION_PAIR(x, name, y) \ + | AARCH64_FUSE_##name + + AARCH64_FUSE_ALL = 0 +#include "aarch64-fusion-pairs.def" +}; +#undef AARCH64_FUSION_PAIR + HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned); int aarch64_get_condition_code (rtx); bool aarch64_bitmask_imm (HOST_WIDE_INT val, machine_mode); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 67e21c821d0..88438b735b1 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -321,13 +321,6 @@ static const struct cpu_vector_cost xgene1_vector_cost = 1 /* cond_not_taken_branch_cost */ }; -#define AARCH64_FUSE_NOTHING (0) -#define AARCH64_FUSE_MOV_MOVK (1 << 0) -#define AARCH64_FUSE_ADRP_ADD (1 << 1) -#define AARCH64_FUSE_MOVK_MOVK (1 << 2) -#define AARCH64_FUSE_ADRP_LDR (1 << 3) -#define AARCH64_FUSE_CMP_BRANCH (1 << 4) - /* Generic costs for branch instructions. */ static const struct cpu_branch_cost generic_branch_cost = { -- 2.30.2