public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: dje.gcc@gmail.com,	Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH] rs6000: New iterator CCEITHER
Date: Sat, 15 Jun 2019 00:16:00 -0000	[thread overview]
Message-ID: <7e834747176614058c525a9d0f25d92bede1db76.1560557395.git.segher@kernel.crashing.org> (raw)

This expands to both CC and CCUNS, it's useful for isel for example.

Tested on powerpc64le-linux; committing to trunk.


Segher


2019-06-15  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.md (CCEITHER): New define_mode_iterator.
	(un): New define_mode_attr.
	(isel_signed_<mode>, isel_unsigned_<mode>): Delete, merge into ...
	(isel_<un>signed_<GPR:mode>): ... this.  New define_insn.
	(isel_reversed_signed_<mode>, isel_reversed_unsigned_<mode>): Delete,
	merge into ...
	(isel_reversed_<un>signed_<GPR:mode>): ... this.  New define_insn.

---
 gcc/config/rs6000/rs6000.md | 37 ++++++-------------------------------
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index b1f3bc3..eb03e4d 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -5055,23 +5055,13 @@ (define_expand "mov<mode>cc"
 ;; leave out the mode in operand 4 and use one pattern, but reload can
 ;; change the mode underneath our feet and then gets confused trying
 ;; to reload the value.
-(define_insn "isel_signed_<mode>"
+(define_mode_iterator CCEITHER [CC CCUNS])
+(define_mode_attr un [(CC "") (CCUNS "un")])
+(define_insn "isel_<un>signed_<GPR:mode>"
   [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
 	(if_then_else:GPR
 	 (match_operator 1 "scc_comparison_operator"
-			 [(match_operand:CC 4 "cc_reg_operand" "y,y")
-			  (const_int 0)])
-	 (match_operand:GPR 2 "reg_or_zero_operand" "O,b")
-	 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
-  "TARGET_ISEL"
-  "isel %0,%2,%3,%j1"
-  [(set_attr "type" "isel")])
-
-(define_insn "isel_unsigned_<mode>"
-  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
-	(if_then_else:GPR
-	 (match_operator 1 "scc_comparison_operator"
-			 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
+			 [(match_operand:CCEITHER 4 "cc_reg_operand" "y,y")
 			  (const_int 0)])
 	 (match_operand:GPR 2 "reg_or_zero_operand" "O,b")
 	 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
@@ -5083,26 +5073,11 @@ (define_insn "isel_unsigned_<mode>"
 ;; isel can handle reversed comparisons so long as the operands are
 ;; registers.
 
-(define_insn "*isel_reversed_signed_<mode>"
+(define_insn "*isel_reversed_<un>signed_<GPR:mode>"
   [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
 	(if_then_else:GPR
 	 (match_operator 1 "scc_rev_comparison_operator"
-			 [(match_operand:CC 4 "cc_reg_operand" "y,y")
-			  (const_int 0)])
-	 (match_operand:GPR 2 "gpc_reg_operand" "r,r")
-	 (match_operand:GPR 3 "reg_or_zero_operand" "O,b")))]
-  "TARGET_ISEL"
-{
-  PUT_CODE (operands[1], reverse_condition (GET_CODE (operands[1])));
-  return "isel %0,%3,%2,%j1";
-}
-  [(set_attr "type" "isel")])
-
-(define_insn "*isel_reversed_unsigned_<mode>"
-  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
-	(if_then_else:GPR
-	 (match_operator 1 "scc_rev_comparison_operator"
-			 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
+			 [(match_operand:CCEITHER 4 "cc_reg_operand" "y,y")
 			  (const_int 0)])
 	 (match_operand:GPR 2 "gpc_reg_operand" "r,r")
 	 (match_operand:GPR 3 "reg_or_zero_operand" "O,b")))]
-- 
1.8.3.1

                 reply	other threads:[~2019-06-15  0:16 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=7e834747176614058c525a9d0f25d92bede1db76.1560557395.git.segher@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@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).