From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH 1/2] simplify-rtx: The truncation of an IOR can have all bits set (PR81423)
Date: Tue, 18 Jul 2017 19:36:00 -0000 [thread overview]
Message-ID: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org> (raw)
... if it is an IOR with a constant with all bits set in the mode
that is truncated to, for example. Handle that case.
With this patch the problematic situation for the PR81423 testcase
isn't even reached; but the next patch fixes that anyway.
Bootstrapped and tested on powerpc64-linux {-m32,-m64} and on
x86_64-linux. Is this okay for trunk?
Segher
2017-07-18 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/81423
* simplify-rtx.c (simplify_truncation): Handle truncating an IOR
with a constant that is -1 in the truncated to mode.
---
gcc/simplify-rtx.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 3bce329..ef41479 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -857,6 +857,15 @@ simplify_truncation (machine_mode mode, rtx op,
return simplify_gen_unary (TRUNCATE, mode, XEXP (op, 0),
GET_MODE (XEXP (op, 0)));
+ /* (truncate:A (ior X C)) is (const_int -1) if C is equal to that already,
+ in mode A. */
+ if (GET_CODE (op) == IOR
+ && SCALAR_INT_MODE_P (mode)
+ && SCALAR_INT_MODE_P (op_mode)
+ && CONST_INT_P (XEXP (op, 1))
+ && trunc_int_for_mode (INTVAL (XEXP (op, 1)), mode) == -1)
+ return constm1_rtx;
+
return NULL_RTX;
}
\f
--
1.9.3
next reply other threads:[~2017-07-18 19:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 19:36 Segher Boessenkool [this message]
2017-07-18 19:36 ` [PATCH 2/2] combine: Fix for PR81423 Segher Boessenkool
2017-07-19 6:19 ` [PATCH 1/2] simplify-rtx: The truncation of an IOR can have all bits set (PR81423) Jeff Law
2017-07-19 19:03 ` Segher Boessenkool
2017-07-24 8:56 ` Segher Boessenkool
2017-07-24 22:06 ` Jeff Law
2017-07-25 11:25 ` Segher Boessenkool
2017-08-07 22:33 ` Segher Boessenkool
2017-08-08 16:27 ` Jeff Law
2017-07-25 11:31 ` Kyrill Tkachov
2017-07-25 22:11 ` Segher Boessenkool
2017-07-26 20:50 ` Mike Stump
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=0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org \
--to=segher@kernel.crashing.org \
--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).