From: "Hurugalawadi, Naveen" <Naveen.Hurugalawadi@cavium.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
"Pinski, Andrew" <Andrew.Pinski@cavium.com>
Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>,
James Greenhalgh <james.greenhalgh@arm.com>, nd <nd@arm.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][AArch64] Implement ALU_BRANCH fusion
Date: Mon, 27 Mar 2017 07:33:00 -0000 [thread overview]
Message-ID: <CO2PR07MB2694C7735276CCB2A0233A4583330@CO2PR07MB2694.namprd07.prod.outlook.com> (raw)
In-Reply-To: <CA+=Sn1k0ptRuMu02zz+CFnPC99PazRyE_EbKurYjPLS8wH9w4A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
Hi,
Thanks for the review and suggestions.
> I think the patch isn't quite complete yet. You will also need changes in
> generic code. Currently sched_macro_fuse_insns() does:
Modified the sched_macro_fuse_insns() as required.
> Basically the idea is to push the check for CC usage into target macros
Done. Pushed the check into target macros.
The modifications were generic and and quite different from ALU+BRANCH
fusion; a separate patch is posted with the above 2 modifications at:-
https://gcc.gnu.org/ml/gcc-patches/2017-03/msg01368.html
> Also in aarch64.c's macro fusion you need check that the branch
>> instruction uses the same register
Added to check that same registers are used in ALU and Branch instruction.
Bootstrapped and Regression tested on AArch64.
Please review the patch and let us know if its okay?
Thanks,
Naveen
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: alu-branch-4.patch --]
[-- Type: text/x-patch; name="alu-branch-4.patch", Size: 2359 bytes --]
diff --git a/gcc/config/aarch64/aarch64-fusion-pairs.def b/gcc/config/aarch64/aarch64-fusion-pairs.def
index f0e6dbc..300cd00 100644
--- a/gcc/config/aarch64/aarch64-fusion-pairs.def
+++ b/gcc/config/aarch64/aarch64-fusion-pairs.def
@@ -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
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 4f769a4..31bc5f4 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -792,7 +792,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. */
@@ -13981,6 +13982,50 @@ aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
return true;
}
+ 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)))
+ return false;
+
+ /* 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;
}
next prev parent reply other threads:[~2017-03-27 4:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <VI1PR0802MB26218E2C0940948518A0571783210@VI1PR0802MB2621.eurprd08.prod.outlook.com>
2017-03-15 15:20 ` Wilco Dijkstra
2017-03-21 5:37 ` Andrew Pinski
2017-03-27 7:33 ` Hurugalawadi, Naveen [this message]
2017-04-25 7:44 ` [PING][PATCH][AArch64] " Hurugalawadi, Naveen
2017-04-25 11:39 ` Wilco Dijkstra
2017-04-26 12:59 ` Hurugalawadi, Naveen
2017-04-26 14:29 ` Wilco Dijkstra
2017-04-27 7:32 ` Hurugalawadi, Naveen
2017-05-11 4:57 ` [PING] [PATCH] [AArch64] " Hurugalawadi, Naveen
2017-05-26 7:14 ` [PING 2] " Hurugalawadi, Naveen
2017-05-26 11:39 ` Wilco Dijkstra
2017-06-14 10:29 ` [PING 3] " Hurugalawadi, Naveen
2017-06-14 11:37 ` [PING][PATCH][AArch64] " James Greenhalgh
2017-03-06 5:12 [PATCH][AArch64] " Hurugalawadi, Naveen
2017-03-08 18:04 ` James Greenhalgh
2017-03-09 6:22 ` Hurugalawadi, Naveen
2017-03-09 10:22 ` James Greenhalgh
2017-03-15 5:33 ` Hurugalawadi, Naveen
2017-03-15 9:23 ` Kyrill Tkachov
2017-03-15 10:04 ` Hurugalawadi, Naveen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO2PR07MB2694C7735276CCB2A0233A4583330@CO2PR07MB2694.namprd07.prod.outlook.com \
--to=naveen.hurugalawadi@cavium.com \
--cc=Andrew.Pinski@cavium.com \
--cc=Kyrylo.Tkachov@arm.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=james.greenhalgh@arm.com \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).