public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aaron Sawdey <acsawdey@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/acsawdey/heads/fusion-combine)] Continued work in progress. Bootstraps. Date: Fri, 4 Dec 2020 04:24:21 +0000 (GMT) [thread overview] Message-ID: <20201204042421.B95033860C33@sourceware.org> (raw) https://gcc.gnu.org/g:2a5aef9cfbf95a12d2121aa48faeb6842f26b6d8 commit 2a5aef9cfbf95a12d2121aa48faeb6842f26b6d8 Author: Aaron Sawdey <acsawdey@linux.ibm.com> Date: Thu Dec 3 22:19:34 2020 -0600 Continued work in progress. Bootstraps. Diff: --- gcc/config/rs6000/genfusion.pl | 137 ++++++++++++++++++++++---------------- gcc/config/rs6000/predicates.md | 9 +++ gcc/config/rs6000/rs6000-protos.h | 3 +- gcc/config/rs6000/rs6000.c | 8 +-- gcc/config/rs6000/t-rs6000 | 6 +- 5 files changed, 95 insertions(+), 68 deletions(-) diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index d19c1b49558..39aa6f53d4b 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -12,66 +12,85 @@ sub mode_to_ldst_char sub gen_ld_cmpi_p10 { - LMODE: foreach $lmode ('DI','SI','HI','QI') { - $ldst = mode_to_ldst_char($lmode); - RESULT: foreach $result ('clobber', $lmode, "EXT".$lmode) { - next RESULT if $result eq "EXTDI"; - CCMODE: foreach $ccmode ('CC','CCUNS') { - if ( $ccmode eq 'CC' ) { - next CCMODE if $lmode eq 'QI'; - $cmpl = ""; - $echr = "a"; - $constpred = "const_m1_to_1_operand"; - } else { - $cmpl = "l"; - $echr = "z"; - $constpred = "const_0_to_1_operand"; - } - if ($lmode eq 'DI') { $echr = ""; } - if ($result =~ m/EXT/) { - if ( $ccmode eq 'CC' ) { - $extend = "sign"; - } else { - $extend = "zero"; - } - } else { - $extend = "none"; - } - print ";; load-cmpi fusion pattern generated by gen_ld_cmpi_p10\n"; - print ";; load mode is $lmode result mode is $result compare mode is $ccmode extend is $extend\n"; - - print "(define_insn_and_split \"*l${ldst}${echr}_cmp${cmpl}di_cr0_${lmode}_${result}_${ccmode}_${extend}\"\n"; - print " [(set (match_operand:${ccmode} 2 \"cc_reg_operand\" \"=x\")\n"; - print " (compare:${ccmode} (match_operand:${lmode} 1 \"memory_operand\" \"m\")\n"; - print " (match_operand:${lmode} 3 \"${constpred}\" \"n\")))\n"; - if ($result eq 'clobber') { - print " (clobber (match_scratch:${lmode} 0 \"=r\"))]\n"; - } elsif ($result eq $lmode) { - print " (set (match_operand:${result} 0 \"gpc_reg_operand\" \"=r\") (match_dup 1))]\n"; - } else { - print " (set (match_operand:${result} 0 \"gpc_reg_operand\" \"=r\") (${extend}_extend:${result} (match_dup 1)))]\n"; - } - print " \"(TARGET_P10_FUSION && TARGET_P10_FUSION_LD_CMPI)\"\n"; - print " \"l${ldst}${echr}%X1 %0,%1\\;cmp${cmpl}di 0,%0,%3\"\n"; - print " \"&& reload_completed\n"; - print " && (cc_reg_not_cr0_operand (operands[2], CCmode)\n"; - print " || !address_is_non_pfx_d_or_x (XEXP (operands[1],0), ${lmode}mode))\"\n"; - if ($extend eq "none") { - print " [(set (match_dup 0) (match_dup 1))\n"; - } else { - print " [(set (match_dup 0) (${extend}_extend:${result} (match_dup 1)))\n"; - } - print " (set (match_dup 2)\n"; - print " (compare:${ccmode} (match_dup 0)\n"; - print " (match_dup 3)))]\n"; - print " \"\"\n"; - print " [(set_attr \"type\" \"load\")\n"; - print " (set_attr \"cost\" \"8\")\n"; - print " (set_attr \"length\" \"8\")])\n"; - print "\n"; - } - } + LMODE: foreach $lmode ('DI','SI','HI','QI') { + $ldst = mode_to_ldst_char($lmode); + $clobbermode = $lmode; + # For clobber, we need a SI/DI reg in case we split because we have to sign/zero extend. + if ( $lmode eq 'HI' || $lmode eq 'QI' ) { $clobbermode = "GPR"; } + RESULT: foreach $result ('clobber', $lmode, "EXT".$lmode) { + # EXTDI does not exist, and we cannot directly produce HI/QI results. + next RESULT if $result eq "EXTDI" || $result eq "HI" || $result eq "QI"; + # Don't allow EXTQI because that would allow HI result which we can't do. + if ( $result eq "EXTQI" ) { $result = "GPR"; } + CCMODE: foreach $ccmode ('CC','CCUNS') { + $np = "NON_PREFIXED_D"; + if ( $ccmode eq 'CC' ) { + next CCMODE if $lmode eq 'QI'; + if ( $lmode eq 'DI' || $lmode eq 'SI' ) { + # ld and lwa are both DS-FORM. + $np = "NON_PREFIXED_DS"; + } + $cmpl = ""; + $echr = "a"; + $constpred = "const_m1_to_1_operand"; + } else { + if ( $lmode eq 'DI' ) { + # ld is DS-form, but lwz is not. + $np = "NON_PREFIXED_DS"; + } + $cmpl = "l"; + $echr = "z"; + $constpred = "const_0_to_1_operand"; + } + if ($lmode eq 'DI') { $echr = ""; } + if ($result =~ m/EXT/ || $result eq 'GPR' || $clobbermode eq 'GPR') { + # We always need extension if result > lmode. + if ( $ccmode eq 'CC' ) { + $extend = "sign"; + } else { + $extend = "zero"; + } + } else { + # Result of SI/DI does not need sign extension. + $extend = "none"; + } + print ";; load-cmpi fusion pattern generated by gen_ld_cmpi_p10\n"; + print ";; load mode is $lmode result mode is $result compare mode is $ccmode extend is $extend\n"; + + print "(define_insn_and_split \"*l${ldst}${echr}_cmp${cmpl}di_cr0_${lmode}_${result}_${ccmode}_${extend}\"\n"; + print " [(set (match_operand:${ccmode} 2 \"cc_reg_operand\" \"=x\")\n"; + print " (compare:${ccmode} (match_operand:${lmode} 1 \"non_update_memory_operand\" \"m\")\n"; + print " (match_operand:${lmode} 3 \"${constpred}\" \"n\")))\n"; + if ($result eq 'clobber') { + print " (clobber (match_scratch:${clobbermode} 0 \"=r\"))]\n"; + } elsif ($result eq $lmode) { + print " (set (match_operand:${result} 0 \"gpc_reg_operand\" \"=r\") (match_dup 1))]\n"; + } else { + print " (set (match_operand:${result} 0 \"gpc_reg_operand\" \"=r\") (${extend}_extend:${result} (match_dup 1)))]\n"; + } + print " \"(TARGET_P10_FUSION && TARGET_P10_FUSION_LD_CMPI)\"\n"; + print " \"l${ldst}${echr}%X1 %0,%1\\;cmp${cmpl}di 0,%0,%3\"\n"; + print " \"&& reload_completed\n"; + print " && (cc_reg_not_cr0_operand (operands[2], CCmode)\n"; + print " || !address_is_non_pfx_d_or_x (XEXP (operands[1],0), ${lmode}mode, ${np}))\"\n"; + if ($extend eq "none") { + print " [(set (match_dup 0) (match_dup 1))\n"; + } else { + $resultmode = $result; + if ( $result eq 'clobber' ) { $resultmode = $clobbermode } + print " [(set (match_dup 0) (${extend}_extend:${resultmode} (match_dup 1)))\n"; + } + print " (set (match_dup 2)\n"; + print " (compare:${ccmode} (match_dup 0)\n"; + print " (match_dup 3)))]\n"; + print " \"\"\n"; + print " [(set_attr \"type\" \"load\")\n"; + print " (set_attr \"cost\" \"8\")\n"; + print " (set_attr \"length\" \"8\")])\n"; + print "\n"; + } } + } } diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 071149aada8..78de8102f44 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -852,6 +852,15 @@ || GET_CODE (XEXP (op, 0)) == PRE_DEC || GET_CODE (XEXP (op, 0)) == PRE_MODIFY))")) +;; Anything that matches memory_operand but does not update the address. +(define_predicate "non_update_memory_operand" + (match_code "mem") +{ + if (update_address_mem (op, mode)) + return 0; + return memory_operand (op, mode); +}) + ;; Return 1 if the operand is a MEM with an indexed-form address. (define_special_predicate "indexed_address_mem" (match_test "(MEM_P (op) diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 566a4a82eb9..cd644083558 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -191,7 +191,8 @@ enum non_prefixed_form { extern enum insn_form address_to_insn_form (rtx, machine_mode, enum non_prefixed_form); -extern bool address_is_non_pfx_d_or_x (rtx addr, machine_mode mode); +extern bool address_is_non_pfx_d_or_x (rtx addr, machine_mode mode, + enum non_prefixed_form non_prefix_format); extern bool prefixed_load_p (rtx_insn *); extern bool prefixed_store_p (rtx_insn *); extern bool prefixed_paddi_p (rtx_insn *); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 939d3e21d9c..26fe976e2e1 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -25713,15 +25713,9 @@ address_to_insn_form (rtx addr, } bool -address_is_non_pfx_d_or_x (rtx addr, machine_mode mode) +address_is_non_pfx_d_or_x (rtx addr, machine_mode mode, enum non_prefixed_form non_prefixed_format) { enum insn_form result_form; - enum non_prefixed_form non_prefixed_format; - - if ( mode == DImode ) - non_prefixed_format = NON_PREFIXED_DS; - else - non_prefixed_format = NON_PREFIXED_D; result_form = address_to_insn_form (addr, mode, non_prefixed_format); diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000 index 1ddb5729cb2..bcc71a9e21b 100644 --- a/gcc/config/rs6000/t-rs6000 +++ b/gcc/config/rs6000/t-rs6000 @@ -47,6 +47,9 @@ rs6000-call.o: $(srcdir)/config/rs6000/rs6000-call.c $(COMPILE) $< $(POSTCOMPILE) +$(srcdir)/config/rs6000/fusion.md: $(srcdir)/config/rs6000/genfusion.pl + $(srcdir)/config/rs6000/genfusion.pl > $(srcdir)/config/rs6000/fusion.md + $(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \ $(srcdir)/config/rs6000/rs6000-cpus.def $(SHELL) $(srcdir)/config/rs6000/genopt.sh $(srcdir)/config/rs6000 > \ @@ -86,4 +89,5 @@ MD_INCLUDES = $(srcdir)/config/rs6000/rs64.md \ $(srcdir)/config/rs6000/mma.md \ $(srcdir)/config/rs6000/crypto.md \ $(srcdir)/config/rs6000/htm.md \ - $(srcdir)/config/rs6000/dfp.md + $(srcdir)/config/rs6000/dfp.md \ + $(srcdir)/config/rs6000/fusion.md
reply other threads:[~2020-12-04 4:24 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=20201204042421.B95033860C33@sourceware.org \ --to=acsawdey@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).