aarch64-fusion-pairs.def: Add ALU_BRANCH entry.
authorJulian Brown <julian@codesourcery.com>
Fri, 30 Jun 2017 03:58:48 +0000 (03:58 +0000)
committerNaveen H.S <naveenh@gcc.gnu.org>
Fri, 30 Jun 2017 03:58:48 +0000 (03:58 +0000)
2017-06-29  Julian Brown  <julian@codesourcery.com>
    Naveen H.S  <Naveen.Hurugalawadi@cavium.com>

* config/aarch64/aarch64-fusion-pairs.def: Add ALU_BRANCH entry.
* config/aarch64/aarch64.c (AARCH64_FUSE_ALU_BRANCH): New fusion type.
(thunderx2t99_tunings): Set AARCH64_FUSE_ALU_BRANCH flag.
(aarch_macro_fusion_pair_p): Add support for AARCH64_FUSE_ALU_BRANCH.

Co-Authored-By: Naveen H.S <Naveen.Hurugalawadi@cavium.com>
From-SVN: r249828

gcc/ChangeLog
gcc/config/aarch64/aarch64-fusion-pairs.def
gcc/config/aarch64/aarch64.c

index 2c57178ef27d6f962d25659231b5b61d72486d00..f66b41ef48451ece8d57171e36926413bc6dd108 100644 (file)
@@ -1,3 +1,11 @@
+2017-06-29  Julian Brown  <julian@codesourcery.com>
+           Naveen H.S  <Naveen.Hurugalawadi@cavium.com>
+
+       * config/aarch64/aarch64-fusion-pairs.def: Add ALU_BRANCH entry.
+       * config/aarch64/aarch64.c (AARCH64_FUSE_ALU_BRANCH): New fusion type.
+       (thunderx2t99_tunings): Set AARCH64_FUSE_ALU_BRANCH flag.
+       (aarch_macro_fusion_pair_p): Add support for AARCH64_FUSE_ALU_BRANCH.
+
 2017-06-29  Naveen H.S  <Naveen.Hurugalawadi@cavium.com>
 
        * config/aarch64/aarch64.c (aarch_macro_fusion_pair_p): Push the
index f0e6dbcdd8129e3bf774f4a7f35d396d9e5a3c4f..300cd00e4bf32fd54ed3dee9110d431b379a7e81 100644 (file)
@@ -34,5 +34,6 @@ AARCH64_FUSION_PAIR ("movk+movk", MOVK_MOVK)
 AARCH64_FUSION_PAIR ("adrp+ldr", ADRP_LDR)
 AARCH64_FUSION_PAIR ("cmp+branch", CMP_BRANCH)
 AARCH64_FUSION_PAIR ("aes+aesmc", AES_AESMC)
+AARCH64_FUSION_PAIR ("alu+branch", ALU_BRANCH)
 
 #undef AARCH64_FUSION_PAIR
index b8ce5af1592ed2b489fe085321853337141b367b..037339d431d80c49699446e548d6b2707883b6a8 100644 (file)
@@ -875,7 +875,8 @@ static const struct tune_params thunderx2t99_tunings =
   &generic_approx_modes,
   4, /* memmov_cost.  */
   4, /* issue_rate.  */
-  (AARCH64_FUSE_CMP_BRANCH | AARCH64_FUSE_AES_AESMC), /* fusible_ops  */
+  (AARCH64_FUSE_CMP_BRANCH | AARCH64_FUSE_AES_AESMC
+   | AARCH64_FUSE_ALU_BRANCH), /* fusible_ops  */
   16,  /* function_align.  */
   8,   /* jump_align.  */
   16,  /* loop_align.  */
@@ -14323,6 +14324,49 @@ aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
        }
     }
 
+  if (aarch64_fusion_enabled_p (AARCH64_FUSE_ALU_BRANCH)
+      && any_condjump_p (curr))
+    {
+      /* We're trying to match:
+         prev (alu_insn) == (set (r0) plus ((r0) (r1/imm)))
+         curr (cbz) ==  (set (pc) (if_then_else (eq/ne) (r0)
+                                                        (const_int 0))
+                                                (label_ref ("SYM"))
+                                                (pc))  */
+      if (SET_DEST (curr_set) == (pc_rtx)
+         && GET_CODE (SET_SRC (curr_set)) == IF_THEN_ELSE
+         && REG_P (XEXP (XEXP (SET_SRC (curr_set), 0), 0))
+         && REG_P (SET_DEST (prev_set))
+         && REGNO (SET_DEST (prev_set))
+            == REGNO (XEXP (XEXP (SET_SRC (curr_set), 0), 0)))
+       {
+         /* Fuse ALU operations followed by conditional branch instruction.  */
+         switch (get_attr_type (prev))
+           {
+           case TYPE_ALU_IMM:
+           case TYPE_ALU_SREG:
+           case TYPE_ADC_REG:
+           case TYPE_ADC_IMM:
+           case TYPE_ADCS_REG:
+           case TYPE_ADCS_IMM:
+           case TYPE_LOGIC_REG:
+           case TYPE_LOGIC_IMM:
+           case TYPE_CSEL:
+           case TYPE_ADR:
+           case TYPE_MOV_IMM:
+           case TYPE_SHIFT_REG:
+           case TYPE_SHIFT_IMM:
+           case TYPE_BFM:
+           case TYPE_RBIT:
+           case TYPE_REV:
+           case TYPE_EXTEND:
+             return true;
+
+           default:;
+           }
+       }
+    }
+
   return false;
 }