From: Jeff Law <jeffreyalaw@gmail.com>
To: Andrew Pinski <apinski@marvell.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] Handle const_int in expand_single_bit_test
Date: Tue, 6 Jun 2023 20:56:29 -0600 [thread overview]
Message-ID: <63a725b2-73c1-37d8-2579-73936e16208b@gmail.com> (raw)
In-Reply-To: <20230605055331.2864335-2-apinski@marvell.com>
On 6/4/23 23:53, Andrew Pinski via Gcc-patches wrote:
> After expanding directly to rtl instead of
> creating a tree, we could end up with
> a const_int which is not ready to be handled
> by extract_bit_field.
> So need to the constant folding here instead.
>
> OK? bootstrapped and tested on x86_64-linux-gnu with no regressions.
>
> PR middle-end/110117
>
> gcc/ChangeLog:
>
> * expr.cc (expand_single_bit_test): Handle
> const_int from expand_expr.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/pr110117-1.c: New test.
> * gcc.dg/pr110117-2.c: New test.
> ---
> gcc/expr.cc | 10 +++++++---
> gcc/testsuite/gcc.dg/pr110117-1.c | 31 +++++++++++++++++++++++++++++++
> gcc/testsuite/gcc.dg/pr110117-2.c | 7 +++++++
> 3 files changed, 45 insertions(+), 3 deletions(-)
> create mode 100644 gcc/testsuite/gcc.dg/pr110117-1.c
> create mode 100644 gcc/testsuite/gcc.dg/pr110117-2.c
>
> diff --git a/gcc/expr.cc b/gcc/expr.cc
> index ca008cd453e..868d812eb1a 100644
> --- a/gcc/expr.cc
> +++ b/gcc/expr.cc
> @@ -12958,12 +12958,16 @@ expand_single_bit_test (location_t loc, enum tree_code code,
>
> rtx inner0 = expand_expr (inner, NULL_RTX, VOIDmode, EXPAND_NORMAL);
>
> + if (CONST_SCALAR_INT_P (inner0))
> + {
> + wide_int t = rtx_mode_t (inner0, operand_mode);
> + bool setp = (wi::lrshift(t, bitnum) & 1) != 0;
Formatting nit. Space before the open paren for wi::lrshift's args.
OK with that change.
jeff
next prev parent reply other threads:[~2023-06-07 2:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 5:53 [PATCH 1/2] Improve do_store_flag for single bit when there is no non-zero bits Andrew Pinski
2023-06-05 5:53 ` [PATCH 2/2] Handle const_int in expand_single_bit_test Andrew Pinski
2023-06-07 2:56 ` Jeff Law [this message]
2023-06-07 2:54 ` [PATCH 1/2] Improve do_store_flag for single bit when there is no non-zero bits Jeff Law
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=63a725b2-73c1-37d8-2579-73936e16208b@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=apinski@marvell.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).