]> gcc.gnu.org Git - gcc.git/commitdiff
[AArch64][2/5] Implement adrp+add fusion
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Mon, 24 Nov 2014 10:50:45 +0000 (10:50 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Mon, 24 Nov 2014 10:50:45 +0000 (10:50 +0000)
* config/aarch64/aarch64.c: Include tm-constrs.h
(AARCH64_FUSE_ADRP_ADD): Define.
(cortexa57_tunings): Add AARCH64_FUSE_ADRP_ADD to fuseable_ops.
(cortexa53_tunings): Likewise.
(aarch_macro_fusion_pair_p): Handle AARCH64_FUSE_ADRP_ADD.

From-SVN: r218010

gcc/ChangeLog
gcc/config/aarch64/aarch64.c

index b3ee3da8af81a2e55c358f751012b8b4eaec5c62..0835501cf30824df2118260e6905484fe8a7b7ee 100644 (file)
@@ -1,3 +1,11 @@
+2014-11-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * config/aarch64/aarch64.c: Include tm-constrs.h
+       (AARCH64_FUSE_ADRP_ADD): Define.
+       (cortexa57_tunings): Add AARCH64_FUSE_ADRP_ADD to fuseable_ops.
+       (cortexa53_tunings): Likewise.
+       (aarch_macro_fusion_pair_p): Handle AARCH64_FUSE_ADRP_ADD.
+
 2014-11-24  Martin Liska  <mliska@suse.cz>
 
        * ipa-inline.c (edge_badness): long is replaced by sreal
index e9be8bc95e53b7fca7def751a84660fdb0d3259f..0388e42278fcda5fb8f5044b49087166fe129c5a 100644 (file)
@@ -77,6 +77,7 @@
 #include "dumpfile.h"
 #include "builtins.h"
 #include "rtl-iter.h"
+#include "tm-constrs.h"
 
 /* Defined for convenience.  */
 #define POINTER_BYTES (POINTER_SIZE / BITS_PER_UNIT)
@@ -306,6 +307,7 @@ static const struct cpu_vector_cost cortexa57_vector_cost =
 
 #define AARCH64_FUSE_NOTHING   (0)
 #define AARCH64_FUSE_MOV_MOVK  (1 << 0)
+#define AARCH64_FUSE_ADRP_ADD  (1 << 1)
 
 #if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007
 __extension__
@@ -329,7 +331,7 @@ static const struct tune_params cortexa53_tunings =
   &generic_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
   NAMED_PARAM (issue_rate, 2),
-  NAMED_PARAM (fuseable_ops, AARCH64_FUSE_MOV_MOVK)
+  NAMED_PARAM (fuseable_ops, (AARCH64_FUSE_MOV_MOVK | AARCH64_FUSE_ADRP_ADD))
 };
 
 static const struct tune_params cortexa57_tunings =
@@ -340,7 +342,7 @@ static const struct tune_params cortexa57_tunings =
   &cortexa57_vector_cost,
   NAMED_PARAM (memmov_cost, 4),
   NAMED_PARAM (issue_rate, 3),
-  NAMED_PARAM (fuseable_ops, AARCH64_FUSE_MOV_MOVK)
+  NAMED_PARAM (fuseable_ops, (AARCH64_FUSE_MOV_MOVK | AARCH64_FUSE_ADRP_ADD))
 };
 
 static const struct tune_params thunderx_tunings =
@@ -10427,6 +10429,32 @@ aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
         }
     }
 
+  if (simple_sets_p
+      && (aarch64_tune_params->fuseable_ops & AARCH64_FUSE_ADRP_ADD))
+    {
+
+      /*  We're trying to match:
+          prev (adrp) == (set (reg r1)
+                              (high (symbol_ref ("SYM"))))
+          curr (add) == (set (reg r0)
+                             (lo_sum (reg r1)
+                                     (symbol_ref ("SYM"))))
+          Note that r0 need not necessarily be the same as r1, especially
+          during pre-regalloc scheduling.  */
+
+      if (satisfies_constraint_Ush (SET_SRC (prev_set))
+          && REG_P (SET_DEST (prev_set)) && REG_P (SET_DEST (curr_set)))
+        {
+          if (GET_CODE (SET_SRC (curr_set)) == LO_SUM
+              && REG_P (XEXP (SET_SRC (curr_set), 0))
+              && REGNO (XEXP (SET_SRC (curr_set), 0))
+                 == REGNO (SET_DEST (prev_set))
+              && rtx_equal_p (XEXP (SET_SRC (prev_set), 0),
+                              XEXP (SET_SRC (curr_set), 1)))
+            return true;
+        }
+    }
+
   return false;
 }
 
This page took 0.12041 seconds and 5 git commands to generate.