From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 745433858D28; Mon, 8 May 2023 22:17:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 745433858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683584259; bh=I1XZAU5FPrrWAWOG+0DmkUqkoVUG4pm7hzrH2YAo6/c=; h=From:To:Subject:Date:From; b=MWtaiCu1HQudvlwi2qorysg3xWnUJHCU4Q6mXCfAeYAu1+zv1I+A+U8gGh/FQ9wxI mKPUxUG81/DrhOZxvssA53L7dfDNXX/p7IUfD6PKwKXNErcfTl7n+Z/MAtML6seHWh TA4tiPuvRzrZsBlRjvDhIKjHCMchm8ggwDvIEBCw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Michael Meissner To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work121)] Revert patches X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/users/meissner/heads/work121 X-Git-Oldrev: 6f8f8132475f03160ee924eb02cbcc3c15fc8334 X-Git-Newrev: 1c9ca427b3d63f47bb7eb370a3aec8add4e9c66f Message-Id: <20230508221739.745433858D28@sourceware.org> Date: Mon, 8 May 2023 22:17:39 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1c9ca427b3d63f47bb7eb370a3aec8add4e9c66f commit 1c9ca427b3d63f47bb7eb370a3aec8add4e9c66f Author: Michael Meissner Date: Mon May 8 18:17:36 2023 -0400 Revert patches Diff: --- gcc/config/rs6000/genfusion.pl | 212 +++++++++++++++++------------------------ 1 file changed, 86 insertions(+), 126 deletions(-) diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index 84de9ac3542..e4db352e0ce 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -53,135 +53,95 @@ sub mode_to_ldst_char return '?'; } -# Print the insns for load and compare with -1/0/1. -# Arguments: -# lmode -- integer mode ("DI", "SI", "HI", or "QI"). -# result -- "clobber", "GPR", or $lmode -# ccmode -- sign vs. unsigned ("CC" or "CCUNS"). -# mem_format -- memory format ("d" or "ds"). - -sub print_ld_cmpi_p10 -{ - my ($lmode, $result, $ccmode, $mem_format) = @_; - - my $ldst = mode_to_ldst_char($lmode); - - # Set various things based on whether the comparisons are signed or - # unsigned. - my ($cmpl, $const_pred, $sign_zero, $a_or_z) - = (($ccmode eq "CCUNS") - ? ("l", "const_0_to_1_operand", "zero", "z") - : ("", "const_m1_to_1_operand", "sign", "a")); - - # For clobber, we need a SI/DI reg in case we split because we have to - # sign/zero extend. - my $clobbermode = ($lmode =~ m/^(QI|HI)$/) ? "GPR" : $lmode; - - # We always need extension if result > lmode. - my $extend = (($result =~ m/^EXT/ - || $result eq "GPR" - || $clobbermode eq "GPR") ? $sign_zero : "none"); - - # DI-mode doesn't do sign/zero extension. - my $echr = ($lmode eq "DI") ? "" : $a_or_z; - - # Handle DS vs. D format memory. - my ($mempred, $np) = (($mem_format eq "ds") - ? ("ds_form_mem_operand", "NON_PREFIXED_DS") - : ("non_update_memory_operand", "NON_PREFIXED_D")); - - print ";; load-cmpi fusion pattern generated by gen_ld_cmpi_p10\n"; - - my $info = join (" ", - "load mode is ${lmode} result mode is ${result}", - "compare mode is ${ccmode} extend is ${extend}"); - - print ";; ${info}\n"; - - my $name = join ("", - "l${ldst}${echr}_cmp${cmpl}di_cr0_${lmode}", - "_${result}_${ccmode}_${extend}"); - - my $cmp_op1 = "(match_operand:${lmode} 1 \"${mempred}\" \"m\")"; - - my $spaces = " " x (length ($ccmode) + 18); - - print "(define_insn_and_split \"*${name}\"\n"; - print " [(set (match_operand:${ccmode} 2 \"cc_reg_operand\" \"=x\")\n"; - print " (compare:${ccmode} ${cmp_op1}\n"; - print "${spaces}(match_operand:${lmode} 3 \"${const_pred}\" \"n\")))\n"; - - if ($result eq "clobber") - { - print " (clobber (match_scratch:${clobbermode} 0 \"=r\"))]\n"; - } - - else - { - my $load_op0 = "(match_operand:${result} 0 \"gpc_reg_operand\" \"=r\")"; - my $load_op1 = (($result eq $lmode) - ? "(match_dup 1)" - : "(${extend}_extend:${result} (match_dup 1))"); - print " (set ${load_op0} ${load_op1})]\n"; - } - - print " \"(TARGET_P10_FUSION)\"\n"; - print " \"l${ldst}${echr}%X1 %0,%1\\;cmp${cmpl}di %2,%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),\n"; - print " ${lmode}mode, ${np}))\"\n"; - - if ($extend eq "none") - { - print " [(set (match_dup 0) (match_dup 1))\n"; - } - - else - { - my $resultmode = ($result eq "clobber") ? $clobbermode : $result; - print " [(set (match_dup 0) (${extend}_extend:${resultmode} (match_dup 1)))\n"; - } - - print " (set (match_dup 2)\n"; - print " (compare:${ccmode} (match_dup 0) (match_dup 3)))]\n"; - print " \"\"\n"; - print " [(set_attr \"type\" \"fused_load_cmpi\")\n"; - print " (set_attr \"cost\" \"8\")\n"; - print " (set_attr \"length\" \"8\")])\n"; - print "\n"; -} - sub gen_ld_cmpi_p10 { - my ($lmode, $result, $mempred, $np, $mem_format); - - foreach $lmode ("DI","SI", "HI", "QI") - { - foreach $result ("clobber", $lmode, "EXT${lmode}") - { - # EXTDI does not exist, and we cannot directly produce HI/QI results. - next if ($result =~ m/^(EXTDI|HI|QI)$/); - - # Don't allow EXTQI because that would allow HI result which we can't do. - $result = "GPR" if ($result eq "EXTQI"); - - # Handle CCmode (sign extended compares to -1, 0, or 1). We don't have - # a LBA instruction, so skip QImode. Both LD and LWA are DS-form - # instructions. - if ($lmode ne "QI") - { - $mem_format = ($lmode =~ m/^(DI|SI)$/) ? "ds" : "d"; - print_ld_cmpi_p10 ($lmode, $result, "CC", $mem_format); - } - - # Handle CCUNS mode (zero extended compares to 0 or 1. - # ld is DS-form, but lwz is not. - $mem_format = ($lmode eq "DI") ? "ds" : "d"; - - print_ld_cmpi_p10 ($lmode, $result, "CCUNS", $mem_format); - } + my ($lmode, $ldst, $clobbermode, $result, $cmpl, $echr, $constpred, + $mempred, $ccmode, $np, $extend, $resultmode); + 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. + $result = "GPR" if $result eq "EXTQI"; + CCMODE: foreach $ccmode ('CC','CCUNS') { + $np = "NON_PREFIXED_D"; + $mempred = "non_update_memory_operand"; + 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"; + $mempred = "ds_form_mem_operand"; + } + $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"; + $mempred = "ds_form_mem_operand"; + } + $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 \"${mempred}\" \"m\")\n"; + if ($ccmode eq 'CCUNS') { print " "; } + 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)\"\n"; + print " \"l${ldst}${echr}%X1 %0,%1\\;cmp${cmpl}di %2,%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),\n"; + print " ${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) (match_dup 3)))]\n"; + print " \"\"\n"; + print " [(set_attr \"type\" \"fused_load_cmpi\")\n"; + print " (set_attr \"cost\" \"8\")\n"; + print " (set_attr \"length\" \"8\")])\n"; + print "\n"; + } } + } } sub gen_logical_addsubf