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 3/3] lt0_disi
Date: Mon, 20 Jul 2015 16:18:00 -0000 [thread overview]
Message-ID: <1286bfa08e97c91f44b81556a3d26d2100c76fc5.1437404024.git.segher@kernel.crashing.org> (raw)
In-Reply-To: <cover.1437404023.git.segher@kernel.crashing.org>
In-Reply-To: <cover.1437404023.git.segher@kernel.crashing.org>
After Kyrill's patch (r225996) (changing combine to do simplification
before doing some transformations) a shortcoming of the rs6000 backend
becomes obvious: we have no patterns to handle
(set (reg:DI) (lt:DI (reg:SI) (const_int 0)))
although we can do that with a single rotate-and-mask instruction.
Previously, combine usually came up with a more complex pattern (that
we do implement), hiding the issue.
This patch adds a define_insn for the pattern.
2015-07-20 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (*lt0_disi): New.
---
gcc/config/rs6000/rs6000.md | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 5727068..55ceb66 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -3475,6 +3475,17 @@ (define_insn_and_split "*rotl<mode>3_mask_dot2"
(set_attr "dot" "yes")
(set_attr "length" "4,8")])
+; Special case for less-than-0. We can do it with just one machine
+; instruction, but the generic optimizers do not realise it is cheap.
+(define_insn "*lt0_disi"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
+ (lt:DI (match_operand:SI 1 "gpc_reg_operand" "r")
+ (const_int 0)))]
+ "TARGET_POWERPC64"
+ "rlwinm %0,%1,1,31,31"
+ [(set_attr "type" "shift")])
+
+
; Two forms for insert (the two arms of the IOR are not canonicalized,
; both are an AND so are the same precedence).
--
1.8.1.4
next prev parent reply other threads:[~2015-07-20 16:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 16:13 [PATCH 0/3] rs6000: Some updates for rotate etc Segher Boessenkool
2015-07-20 16:13 ` [PATCH 1/3] Doc fixes for rot Segher Boessenkool
2015-07-20 16:19 ` David Edelsohn
2015-07-20 16:14 ` [PATCH 2/3] Fix shift amount (GPR->SI) Segher Boessenkool
2015-07-20 16:20 ` David Edelsohn
2015-07-20 16:18 ` Segher Boessenkool [this message]
2015-07-20 16:24 ` [PATCH 3/3] lt0_disi David Edelsohn
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=1286bfa08e97c91f44b81556a3d26d2100c76fc5.1437404024.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).