[Patch AArch64 2/4] Control the FMA steering pass in tuning structures rather than...
authorJames Greenhalgh <james.greenhalgh@arm.com>
Fri, 26 Jun 2015 13:57:16 +0000 (13:57 +0000)
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>
Fri, 26 Jun 2015 13:57:16 +0000 (13:57 +0000)
gcc/

* 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.

From-SVN: r225015

gcc/ChangeLog
gcc/config/aarch64/aarch64-cores.def
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64-tuning-flags.def [new file with mode: 0644]
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/cortex-a57-fma-steering.c
gcc/config/aarch64/t-aarch64

index 0d81aa7a5a7daa7191e73ccf89d46517f4c0a22f..787a9e33e155ad8bcf13e32ebc579052497aac2b 100644 (file)
@@ -1,3 +1,31 @@
+2015-06-26  James Greenhalgh  <james.greenhalgh@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.
+
 2015-06-26  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * config/aarch64/aarch64-fusion-pairs.def: New.
index dfc9cc85413b7c01e4872c05e6be7ca192547198..c4e22fef3758fe7b068f4e733ff474f8e33acb4a 100644 (file)
 /* V8 Architecture Processors.  */
 
 AARCH64_CORE("cortex-a53",  cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa53, "0x41", "0xd03")
-AARCH64_CORE("cortex-a57",  cortexa57, cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_USE_FMA_STEERING_PASS, cortexa57, "0x41", "0xd07")
-AARCH64_CORE("cortex-a72",  cortexa72, cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd08")
-AARCH64_CORE("exynos-m1",   exynosm1,  cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, cortexa57, "0x53", "0x001")
+AARCH64_CORE("cortex-a57",  cortexa57, cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd07")
+AARCH64_CORE("cortex-a72",  cortexa72, cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa72, "0x41", "0xd08")
+AARCH64_CORE("exynos-m1",   exynosm1,  cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, cortexa72, "0x53", "0x001")
 AARCH64_CORE("thunderx",    thunderx,  thunderx,  8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, thunderx,  "0x43", "0x0a1")
 AARCH64_CORE("xgene1",      xgene1,    xgene1,    8,  AARCH64_FL_FOR_ARCH8, xgene1, "0x50", "0x000")
 
 /* V8 big.LITTLE implementations.  */
 
-AARCH64_CORE("cortex-a57.cortex-a53",  cortexa57cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_USE_FMA_STEERING_PASS, cortexa57, "0x41", "0xd07.0xd03")
-AARCH64_CORE("cortex-a72.cortex-a53",  cortexa72cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd08.0xd03")
+AARCH64_CORE("cortex-a57.cortex-a53",  cortexa57cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd07.0xd03")
+AARCH64_CORE("cortex-a72.cortex-a53",  cortexa72cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa72, "0x41", "0xd08.0xd03")
index 804aae4e6fa12a45103aad8d80ac83ca819acced..5d5787eef864f11f57a1b0a3161585d9fb7ce4cb 100644 (file)
@@ -188,6 +188,7 @@ struct tune_params
   const int vec_reassoc_width;
   const int min_div_recip_mul_sf;
   const int min_div_recip_mul_df;
+  const unsigned int extra_tuning_flags;
 };
 
 #define AARCH64_FUSION_PAIR(x, name, index) \
@@ -210,6 +211,26 @@ enum aarch64_fusion_pairs
 };
 #undef AARCH64_FUSION_PAIR
 
+#define AARCH64_EXTRA_TUNING_OPTION(x, name, index) \
+  AARCH64_EXTRA_TUNE_##name = (1 << index),
+/* Supported tuning flags.  */
+enum aarch64_extra_tuning_flags
+{
+  AARCH64_EXTRA_TUNE_NONE = 0,
+#include "aarch64-tuning-flags.def"
+
+/* Hacky macro to build the "all" flag mask.
+   Expands to 0 | AARCH64_TUNE_index0 | AARCH64_TUNE_index1 , etc.  */
+#undef AARCH64_EXTRA_TUNING_OPTION
+#define AARCH64_EXTRA_TUNING_OPTION(x, name, y) \
+  | AARCH64_EXTRA_TUNE_##name
+  AARCH64_EXTRA_TUNE_ALL = 0
+#include "aarch64-tuning-flags.def"
+};
+#undef AARCH64_EXTRA_TUNING_OPTION
+
+extern const struct tune_params *aarch64_tune_params;
+
 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-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
new file mode 100644 (file)
index 0000000..01aaca8
--- /dev/null
@@ -0,0 +1,34 @@
+/* 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
+   <http://www.gnu.org/licenses/>.  */
+
+/* Additional control over certain tuning parameters.  Before including
+   this file, define a macro:
+
+     AARCH64_EXTRA_TUNING_OPTION (name, internal_name, index_bit)
+
+   Where:
+
+     NAME is a string giving a friendly name for the tuning flag.
+     INTERNAL_NAME gives the internal name suitable for appending to
+     AARCH64_TUNE_ to give an enum name.
+     INDEX_BIT is the bit to set in the bitmask of supported tuning
+     flags.  */
+
+AARCH64_EXTRA_TUNING_OPTION ("rename_fma_regs", RENAME_FMA_REGS, 0)
+
index 88438b735b10376b165409eaed14144e0e462313..c1afb9acb835e4a57be5f0777ac79d1c57f70053 100644 (file)
@@ -345,7 +345,8 @@ static const struct tune_params generic_tunings =
   4,   /* fp_reassoc_width.  */
   1,   /* vec_reassoc_width.  */
   2,   /* min_div_recip_mul_sf.  */
-  2    /* min_div_recip_mul_df.  */
+  2,   /* min_div_recip_mul_df.  */
+  (AARCH64_EXTRA_TUNE_NONE)    /* tune_flags.  */
 };
 
 static const struct tune_params cortexa53_tunings =
@@ -366,7 +367,8 @@ static const struct tune_params cortexa53_tunings =
   4,   /* fp_reassoc_width.  */
   1,   /* vec_reassoc_width.  */
   2,   /* min_div_recip_mul_sf.  */
-  2    /* min_div_recip_mul_df.  */
+  2,   /* min_div_recip_mul_df.  */
+  (AARCH64_EXTRA_TUNE_NONE)    /* tune_flags.  */
 };
 
 static const struct tune_params cortexa57_tunings =
@@ -387,7 +389,30 @@ static const struct tune_params cortexa57_tunings =
   4,   /* fp_reassoc_width.  */
   1,   /* vec_reassoc_width.  */
   2,   /* min_div_recip_mul_sf.  */
-  2    /* min_div_recip_mul_df.  */
+  2,   /* min_div_recip_mul_df.  */
+  (AARCH64_EXTRA_TUNE_RENAME_FMA_REGS) /* tune_flags.  */
+};
+
+static const struct tune_params cortexa72_tunings =
+{
+  &cortexa57_extra_costs,
+  &cortexa57_addrcost_table,
+  &cortexa57_regmove_cost,
+  &cortexa57_vector_cost,
+  &generic_branch_cost,
+  4, /* memmov_cost  */
+  3, /* issue_rate  */
+  (AARCH64_FUSE_MOV_MOVK | AARCH64_FUSE_ADRP_ADD
+   | AARCH64_FUSE_MOVK_MOVK), /* fusible_ops  */
+  16,  /* function_align.  */
+  8,   /* jump_align.  */
+  4,   /* loop_align.  */
+  2,   /* int_reassoc_width.  */
+  4,   /* fp_reassoc_width.  */
+  1,   /* vec_reassoc_width.  */
+  2,   /* min_div_recip_mul_sf.  */
+  2,   /* min_div_recip_mul_df.  */
+  (AARCH64_EXTRA_TUNE_NONE)    /* tune_flags.  */
 };
 
 static const struct tune_params thunderx_tunings =
@@ -407,7 +432,8 @@ static const struct tune_params thunderx_tunings =
   4,   /* fp_reassoc_width.  */
   1,   /* vec_reassoc_width.  */
   2,   /* min_div_recip_mul_sf.  */
-  2    /* min_div_recip_mul_df.  */
+  2,   /* min_div_recip_mul_df.  */
+  (AARCH64_EXTRA_TUNE_NONE)    /* tune_flags.  */
 };
 
 static const struct tune_params xgene1_tunings =
@@ -427,7 +453,8 @@ static const struct tune_params xgene1_tunings =
   4,   /* fp_reassoc_width.  */
   1,   /* vec_reassoc_width.  */
   2,   /* min_div_recip_mul_sf.  */
-  2    /* min_div_recip_mul_df.  */
+  2,   /* min_div_recip_mul_df.  */
+  (AARCH64_EXTRA_TUNE_NONE)    /* tune_flags.  */
 };
 
 /* A processor implementing AArch64.  */
index 8b2d2ca6ff7d59e9c755c6efe9061c249af13e8a..385156482f2e98fba60cc5404356be993ab20f74 100644 (file)
@@ -203,13 +203,11 @@ extern unsigned aarch64_architecture_version;
 #define AARCH64_FL_FP         (1 << 1) /* Has FP.  */
 #define AARCH64_FL_CRYPTO     (1 << 2) /* Has crypto.  */
 #define AARCH64_FL_CRC        (1 << 3) /* Has CRC.  */
-/* Has static dispatch of FMA.  */
-#define AARCH64_FL_USE_FMA_STEERING_PASS (1 << 4)
 /* ARMv8.1 architecture extensions.  */
-#define AARCH64_FL_LSE       (1 << 5)  /* Has Large System Extensions.  */
-#define AARCH64_FL_PAN       (1 << 6)  /* Has Privileged Access Never.  */
-#define AARCH64_FL_LOR       (1 << 7)  /* Has Limited Ordering regions.  */
-#define AARCH64_FL_RDMA              (1 << 8)  /* Has ARMv8.1 Adv.SIMD.  */
+#define AARCH64_FL_LSE       (1 << 4)  /* Has Large System Extensions.  */
+#define AARCH64_FL_PAN       (1 << 5)  /* Has Privileged Access Never.  */
+#define AARCH64_FL_LOR       (1 << 6)  /* Has Limited Ordering regions.  */
+#define AARCH64_FL_RDMA              (1 << 7)  /* Has ARMv8.1 Adv.SIMD.  */
 
 /* Has FP and SIMD.  */
 #define AARCH64_FL_FPSIMD     (AARCH64_FL_FP | AARCH64_FL_SIMD)
@@ -230,11 +228,6 @@ extern unsigned long aarch64_isa_flags;
 #define AARCH64_ISA_FP             (aarch64_isa_flags & AARCH64_FL_FP)
 #define AARCH64_ISA_SIMD           (aarch64_isa_flags & AARCH64_FL_SIMD)
 
-/* Macros to test tuning flags.  */
-extern unsigned long aarch64_tune_flags;
-#define AARCH64_TUNE_FMA_STEERING \
-  (aarch64_tune_flags & AARCH64_FL_USE_FMA_STEERING_PASS)
-
 /* Crypto is an optional extension to AdvSIMD.  */
 #define TARGET_CRYPTO (TARGET_SIMD && AARCH64_ISA_CRYPTO)
 
index 648a88c70d4103ca2ea8ba81e0734737a0d0b9ca..07bf8de6ab5f0458dd4eb267fcd7422f22aae6e0 100644 (file)
@@ -43,6 +43,7 @@
 #include "tree-pass.h"
 #include "regrename.h"
 #include "cortex-a57-fma-steering.h"
+#include "aarch64-protos.h"
 
 #include <list>
 
@@ -1051,7 +1052,9 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *)
     {
-      return AARCH64_TUNE_FMA_STEERING && optimize >= 2;
+      return (aarch64_tune_params->extra_tuning_flags
+             & AARCH64_EXTRA_TUNE_RENAME_FMA_REGS)
+             && optimize >= 2;
     }
 
   virtual unsigned int execute (function *)
index 0371203f0a3490e10c45ec61b284dbf68f28ad1a..af154f4b2017be50b0179b7580b743067881bacf 100644 (file)
@@ -53,7 +53,8 @@ cortex-a57-fma-steering.o: $(srcdir)/config/aarch64/cortex-a57-fma-steering.c \
     dominance.h cfg.h cfganal.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(RECOG_H) \
     output.h hash-map.h $(DF_H) $(OBSTACK_H) $(TARGET_H) $(RTL_H) \
     $(CONTEXT_H) $(TREE_PASS_H) regrename.h \
-    $(srcdir)/config/aarch64/cortex-a57-fma-steering.h
+    $(srcdir)/config/aarch64/cortex-a57-fma-steering.h \
+    $(srcdir)/config/aarch64/aarch64-protos.h
        $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
                $(srcdir)/config/aarch64/cortex-a57-fma-steering.c