From: Richard Guenther <richard.guenther@gmail.com>
To: Bernd Schmidt <bernds@codesourcery.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
Eric Botcazou <ebotcazou@adacore.com>,
Richard Sandiford <richard.sandiford@linaro.org>,
Richard Henderson <rth@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Add __builtin_clrsb, similar to clz/ctz
Date: Tue, 23 Aug 2011 10:19:00 -0000 [thread overview]
Message-ID: <CAFiYyc39Q+4LwvfQk6geaLMyYN_qa5Atp3hfh80iiDc34zrTjA@mail.gmail.com> (raw)
In-Reply-To: <4E53744B.6040502@codesourcery.com>
On Tue, Aug 23, 2011 at 11:35 AM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 08/23/11 11:05, Jakub Jelinek wrote:
>> On Mon, Jun 20, 2011 at 09:38:22PM +0200, Bernd Schmidt wrote:
>>> D'oh. Blackfin has a (clrsb:HI (operand:SI)) instruction, so adding this
>>> showed a problem with some of the existing simplify_const_unop cases:
>>> for ffs/clz/ctz/clrsb/parity/popcount, we should look at the mode of the
>>> operand, rather than the mode of the operation. This limits what we can
>>> do in that function, since op_mode is sometimes VOIDmode - we really
>>> should add builtin folders for these at some point.
>>
>>> * simplify-rtx.c (simplify_const_unary_operation): Likewise.
>>> Use op_mode rather than mode when optimizing ffs, clz, ctz, parity
>>> and popcount.
>>
>> This change is IMHO wrong,
>
> Conceptually, I think it is exactly right. It may however be
> inconvenient in some cases.
>
>> see e.g.
>> PR50161 where we have (subreg:SI (popcount:DI (const_int -1))). This
>> is supposed to yield 64, but with your changes
>> it yields 128 - the op_mode here is VOIDmode,
>
> This is what shouldn't happen.
If it shouldn't happen, does some verifier catch it?
>> cse_process_notes_1
>> perhaps could be changed for VOIDmode new_rtx to try to
>> simplify_replace_rtx it...
>
> Is this where the problem came from? Sounds like it's worth a try.
>
> Wasn't Richard S. working on a patch to give constants modes?
>
>
> Bernd
>
>
next prev parent reply other threads:[~2011-08-23 9:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-16 13:06 Bernd Schmidt
2011-06-16 13:10 ` Georg-Johann Lay
2011-06-16 13:56 ` Laurent Desnogues
2011-06-16 13:59 ` Bernd Schmidt
2011-06-16 17:03 ` Richard Henderson
2011-06-20 20:32 ` Bernd Schmidt
2011-06-20 20:48 ` Richard Henderson
2011-06-21 16:39 ` [PATCH] Fix __bultin_clrsb* (PR middle-end/49489) Jakub Jelinek
2011-06-21 16:46 ` Bernd Schmidt
2011-06-23 6:23 ` Add __builtin_clrsb, similar to clz/ctz H.J. Lu
2011-07-12 3:50 ` Hans-Peter Nilsson
2011-08-23 10:07 ` Jakub Jelinek
2011-08-23 10:08 ` Bernd Schmidt
2011-08-23 10:19 ` Richard Guenther [this message]
2011-08-23 10:25 ` Jakub Jelinek
2011-08-23 10:34 ` Bernd Schmidt
2011-08-23 13:43 ` [PATCH] For FFS/CLZ/CTZ/CLRSB/POPCOUNT/PARITY/BSWAP require operand mode equal to operation mode (or VOIDmode) (PR middle-end/50161) Jakub Jelinek
2011-08-23 14:54 ` Georg-Johann Lay
2011-08-23 15:58 ` Jakub Jelinek
2011-08-23 16:16 ` Bernd Schmidt
2011-08-23 10:45 ` Add __builtin_clrsb, similar to clz/ctz Richard Sandiford
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=CAFiYyc39Q+4LwvfQk6geaLMyYN_qa5Atp3hfh80iiDc34zrTjA@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=bernds@codesourcery.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=richard.sandiford@linaro.org \
--cc=rth@redhat.com \
/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).