From e8536e2b9f96f42d7f12f13254300476debd283a Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Mon, 6 Jun 2016 16:01:47 +0000 Subject: [PATCH] [2/3][AArch64] Keep CTZ components together until after reload PR middle-end/37780 * config/aarch64/aarch64.md (ctz2): Convert to define_insn_and_split. From-SVN: r237139 --- gcc/ChangeLog | 6 ++++++ gcc/config/aarch64/aarch64.md | 25 ++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d8e76b3cd8..8a1a2a6d52f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-06 Kyrylo Tkachov + + PR middle-end/37780 + * config/aarch64/aarch64.md (ctz2): Convert to + define_insn_and_split. + 2016-06-06 Kyrylo Tkachov PR middle-end/37780 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index f04f7daed27..dbc52c3286f 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3784,16 +3784,23 @@ [(set_attr "type" "rbit")] ) -(define_expand "ctz2" - [(match_operand:GPI 0 "register_operand") - (match_operand:GPI 1 "register_operand")] +;; Split after reload into RBIT + CLZ. Since RBIT is represented as an UNSPEC +;; it is unlikely to fold with any other operation, so keep this as a CTZ +;; expression and split after reload to enable scheduling them apart if +;; needed. + +(define_insn_and_split "ctz2" + [(set (match_operand:GPI 0 "register_operand" "=r") + (ctz:GPI (match_operand:GPI 1 "register_operand" "r")))] "" - { - emit_insn (gen_rbit2 (operands[0], operands[1])); - emit_insn (gen_clz2 (operands[0], operands[0])); - DONE; - } -) + "#" + "reload_completed" + [(const_int 0)] + " + emit_insn (gen_rbit2 (operands[0], operands[1])); + emit_insn (gen_clz2 (operands[0], operands[0])); + DONE; +") (define_insn "*and_compare0" [(set (reg:CC_NZ CC_REGNUM) -- 2.30.2