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/work121)] Revert patches
Date: Fri, 12 May 2023 16:50:44 +0000 (GMT)	[thread overview]
Message-ID: <20230512165044.2F846387090B@sourceware.org> (raw)

https://gcc.gnu.org/g:5657ef3c2d03a8cdeee359ab40f3beada0949145

commit 5657ef3c2d03a8cdeee359ab40f3beada0949145
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Mon May 8 19:26:08 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 b053005fa92..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 ($np, $mempred) = (($mem_format eq "ds")
-			? ("NON_PREFIXED_DS", "ds_form_mem_operand")
-			: ("NON_PREFIXED_D",  "non_update_memory_operand"));
-
-  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

             reply	other threads:[~2023-05-12 16:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 16:50 Michael Meissner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-03  4:03 Michael Meissner
2023-06-02 14:45 Michael Meissner
2023-05-18  4:58 Michael Meissner
2023-05-15 20:42 Michael Meissner
2023-05-12 23:09 Michael Meissner
2023-05-12 22:54 Michael Meissner
2023-05-12 21:58 Michael Meissner
2023-05-12 21:33 Michael Meissner
2023-05-12 16:51 Michael Meissner
2023-05-12 16:51 Michael Meissner
2023-05-12 16:51 Michael Meissner
2023-05-12 16:50 Michael Meissner
2023-05-12 16:50 Michael Meissner
2023-05-12 16:50 Michael Meissner
2023-05-10 15:08 Michael Meissner
2023-05-09 20:33 Michael Meissner
2023-05-09 16:28 Michael Meissner
2023-05-08 23:26 Michael Meissner
2023-05-08 23:21 Michael Meissner
2023-05-08 23:20 Michael Meissner
2023-05-08 22:17 Michael Meissner

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=20230512165044.2F846387090B@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: 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).