public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Michael Meissner <meissner@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work087)] Make addti3/subti3 be define_insn_and_split, instead of define_expand Date: Thu, 28 Apr 2022 20:23:52 +0000 (GMT) [thread overview] Message-ID: <20220428202352.66BAA3858D28@sourceware.org> (raw) https://gcc.gnu.org/g:b7969b56b1a3233416d40d92d99d79023fd26acc commit b7969b56b1a3233416d40d92d99d79023fd26acc Author: Michael Meissner <meissner@linux.ibm.com> Date: Thu Apr 28 16:23:32 2022 -0400 Make addti3/subti3 be define_insn_and_split, instead of define_expand This patch makes addti3 and subti3 be define_insn_and_split instead of define_expand. This patch will be a building block to support in a future patch PR target/103109 which wants to optimize 128-bit some integer multiply-add combinations to use the power9 maddld, maddhd, maddhdu instructions. In order to support recognizing the multiply and add combination, we need to keep the addti3 and subti3 as complete insns through the combiner phase. 2022-04-28 Michael Meissner <meissner@linux.ibm.com> gcc/ * config/rs6000/rs6000.md (addti3): Don't immediately expand the insn. Delay expansion until the split passes. (subti3): Likewise. Diff: --- gcc/config/rs6000/rs6000.md | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 90a11366266..c9e5b5f10e0 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -7040,12 +7040,19 @@ ;; allocator from allocating registers that overlap with the inputs ;; (for example, having an input in 7,8 and an output in 6,7). We ;; also allow for the output being the same as one of the inputs. - -(define_expand "addti3" - [(set (match_operand:TI 0 "gpc_reg_operand") - (plus:TI (match_operand:TI 1 "gpc_reg_operand") - (match_operand:TI 2 "reg_or_short_operand")))] +;; +;; Addti3/subti3 are define_insn_and_splits instead of define_expand, to allow +;; for combine to make things like multiply and add with extend operations. + +(define_insn_and_split "addti3" + [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,r,r") + (plus:TI (match_operand:TI 1 "gpc_reg_operand" "r, 0,r") + (match_operand:TI 2 "reg_or_short_operand" "rI,r,0"))) + (clobber (reg:DI CA_REGNO))] "TARGET_64BIT" + "#" + "&& 1" + [(pc)] { rtx lo0 = gen_lowpart (DImode, operands[0]); rtx lo1 = gen_lowpart (DImode, operands[1]); @@ -7062,13 +7069,20 @@ emit_insn (gen_adddi3_carry (lo0, lo1, lo2)); emit_insn (gen_adddi3_carry_in (hi0, hi1, hi2)); DONE; -}) - -(define_expand "subti3" - [(set (match_operand:TI 0 "gpc_reg_operand") - (minus:TI (match_operand:TI 1 "reg_or_short_operand") - (match_operand:TI 2 "gpc_reg_operand")))] +} + [(set_attr "length" "8") + (set_attr "type" "add") + (set_attr "size" "128")]) + +(define_insn_and_split "subti3" + [(set (match_operand:TI 0 "gpc_reg_operand" "=&r,r,r") + (minus:TI (match_operand:TI 1 "reg_or_short_operand" "rI,0,r") + (match_operand:TI 2 "gpc_reg_operand" "r, r,0"))) + (clobber (reg:DI CA_REGNO))] "TARGET_64BIT" + "#" + "&& 1" + [(pc)] { rtx lo0 = gen_lowpart (DImode, operands[0]); rtx lo1 = gen_lowpart (DImode, operands[1]); @@ -7085,7 +7099,10 @@ emit_insn (gen_subfdi3_carry (lo0, lo2, lo1)); emit_insn (gen_subfdi3_carry_in (hi0, hi2, hi1)); DONE; -}) +} + [(set_attr "length" "8") + (set_attr "type" "add") + (set_attr "size" "128")]) \f ;; 128-bit logical operations expanders
reply other threads:[~2022-04-28 20:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220428202352.66BAA3858D28@sourceware.org \ --to=meissner@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).