public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>, Andrew Pinski <apinski@marvell.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] match.pd: Avoid another build_nonstandard_integer_type call [PR111369]
Date: Sat, 30 Sep 2023 11:44:59 +0200	[thread overview]
Message-ID: <ZRfuG4OTJ0glNRUG@tucnak> (raw)

Hi!

I really can't figure out why one would need to add extra casts.
type must be an integral type which has BIT_NOT_EXPR applied on it
which yields all ones and we need a type in which negating 0 or 1
range will yield 0 or all ones, I think all integral types satisfy
that.
This fixes PR111369, where one of the bitint*.c tests FAILs with
GCC_TEST_RUN_EXPENSIVE=1.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2023-09-30  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/111369
	* match.pd (a?~t:t -> (-(a))^t): Always convert to type rather
	than using build_nonstandard_integer_type.

--- gcc/match.pd.jj	2023-09-28 11:32:16.122434235 +0200
+++ gcc/match.pd	2023-09-29 18:05:50.554640268 +0200
@@ -6742,12 +6742,7 @@ (define_operator_list SYNC_FETCH_AND_AND
   (if (INTEGRAL_TYPE_P (type)
        && bitwise_inverted_equal_p (@1, @2, wascmp)
        && (!wascmp || element_precision (type) == 1))
-   (with {
-     auto prec = TYPE_PRECISION (type);
-     auto unsign = TYPE_UNSIGNED (type);
-     tree inttype = build_nonstandard_integer_type (prec, unsign);
-    }
-    (convert (bit_xor (negate (convert:inttype @0)) (convert:inttype @2)))))))
+   (bit_xor (negate (convert:type @0)) (convert:type @2)))))
 #endif
 
 /* Simplify pointer equality compares using PTA.  */

	Jakub


             reply	other threads:[~2023-09-30  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-30  9:44 Jakub Jelinek [this message]
2023-09-30  9:57 ` Jakub Jelinek
2023-10-03 17:48   ` [PATCH] match.pd: Avoid other build_nonstandard_integer_type calls [PR111369] Jakub Jelinek
2023-10-04  6:58     ` Richard Biener
2023-10-04  6:36   ` [PATCH] match.pd: Avoid another build_nonstandard_integer_type call [PR111369] Richard Biener
2023-10-04  6:34 ` Richard Biener

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=ZRfuG4OTJ0glNRUG@tucnak \
    --to=jakub@redhat.com \
    --cc=apinski@marvell.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).