public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-7202] match.pd: Fix up (X & Y) CMP 0 -> X CMP2 ~Y simplifications [PR104499]
Date: Fri, 11 Feb 2022 19:27:43 +0000 (GMT)	[thread overview]
Message-ID: <20220211192743.66AD2385841B@sourceware.org> (raw)

https://gcc.gnu.org/g:9355a8c35883b5125851bb9b4169a1a1cd8e343f

commit r12-7202-g9355a8c35883b5125851bb9b4169a1a1cd8e343f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Feb 11 20:27:23 2022 +0100

    match.pd: Fix up (X & Y) CMP 0 -> X CMP2 ~Y simplifications [PR104499]
    
    The following testcase ICEs on x86_64-linux, because match.pd emits
    there a NOP_EXPR cast from int*8 vector type with BLKmode to
    unsigned*8 vector type with BLKmode and vec-lowering isn't prepared
    to handle such casts.
    
    Fixed by using VIEW_CONVERT_EXPR instead.
    
    2022-02-11  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/104499
            * match.pd ((X & Y) CMP 0 -> X CMP2 ~Y): Use view_convert instead
            of convert.
    
            * gcc.c-torture/compile/pr104499.c: New test.

Diff:
---
 gcc/match.pd                                   |  2 +-
 gcc/testsuite/gcc.c-torture/compile/pr104499.c | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 0f326233cbb..10f62284862 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -5778,7 +5778,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
       (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
        (icmp @0 { csts; })
        (with { tree utype = unsigned_type_for (TREE_TYPE (@1)); }
-	 (icmp (convert:utype @0) { csts; }))))))))
+	 (icmp (view_convert:utype @0) { csts; }))))))))
 
 /* When one argument is a constant, overflow detection can be simplified.
    Currently restricted to single use so as not to interfere too much with
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr104499.c b/gcc/testsuite/gcc.c-torture/compile/pr104499.c
new file mode 100644
index 00000000000..e5d5cddc81c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr104499.c
@@ -0,0 +1,11 @@
+/* PR tree-optimization/104499 */
+
+typedef int __attribute__((__vector_size__ (8 * sizeof (int)))) V;
+
+V v;
+
+void
+foo (void)
+{
+  v = ((1 | v) != 1);
+}


                 reply	other threads:[~2022-02-11 19:27 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=20220211192743.66AD2385841B@sourceware.org \
    --to=jakub@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).