From: Yuri Gribov <tetra2005@gmail.com>
To: Yuri Gribov <tetra2005@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Alan Modra <amodra@gmail.com>,
rguenth@gcc.gnu.org, richard.sandiford@linaro.org
Subject: Re: [PATCH 3/4 v3][PR 67328] Added bool conversion for wide_ints
Date: Tue, 30 May 2017 12:35:00 -0000 [thread overview]
Message-ID: <CAJOtW+4MWA5b3KBr6aAizuqx-4JpmwLrxV9mDk75AOgtQ=-bxA@mail.gmail.com> (raw)
In-Reply-To: <87lgpeocnf.fsf@linaro.org>
On Tue, May 30, 2017 at 11:35 AM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> Yuri Gribov <tetra2005@gmail.com> writes:
>> On Tue, May 30, 2017 at 7:35 AM, Richard Sandiford
>> <richard.sandiford@linaro.org> wrote:
>>> Yuri Gribov <tetra2005@gmail.com> writes:
>>>> From 330209f721a598ec393dcb5d62de3457ee282153 Mon Sep 17 00:00:00 2001
>>>> From: Yury Gribov <tetra2005@gmail.com>
>>>> Date: Fri, 26 May 2017 07:53:10 +0100
>>>> Subject: [PATCH 3/4] Added bool conversion for wide_ints.
>>>>
>>>> gcc/
>>>> 2017-05-26 Yury Gribov <tetra2005@gmail.com>
>>>>
>>>> * wide-int.cc (wi::zero_p_large): New method.
>>>> * wide-int.h (wi::zero_p): New method.
>>>
>>> Do you still need this bit? It looks like it isn't used by the other
>>> parts of the series.
>>>
>>> The idea was that wi::eq_p (x, 0) (or just x == 0, if x is a
>>> wide-int-based type) is supposed to be as fast as a dedicated zero check.
>>> It'd be OK to have a helper function anyway, but it should probably be
>>> defined using wi::eq_p.
>>>
>>> The zero_p_large fallback can never return true, since a zero of
>>> any precision will have a length of 1.
>>
>> Thanks Richard, I'll update the patch. The bool check is used in
>> successive patch (4/4), in
>> widest_int mask = wi::to_widest (@2);
>> bool mask_all_ones_p = !(mask & (mask + 1));
>
> Ah, OK. That's equivalent to mask == -1 (or wi::eq_p (@2, -1), to avoid
> the temporary).
Hm, is it? Current check ensures that N consecutive LSBs are set, not
that all bits are set. Perhaps variable name should be changed to
reflect this better.
> I think it'd be better to use one of those instead.
> There's an argument that if ! is defined, it should return an integer
> of the same precision as the argument.
True. Perhaps I should make separate
wide_int operator !()
and
bool operator bool()
-I
next prev parent reply other threads:[~2017-05-30 12:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 7:00 Yuri Gribov
2017-05-30 6:59 ` Richard Sandiford
2017-05-30 8:38 ` Yuri Gribov
2017-05-30 10:51 ` Richard Sandiford
2017-05-30 12:35 ` Yuri Gribov [this message]
2017-05-30 15:47 ` Richard Sandiford
2017-05-30 17:11 ` Yuri Gribov
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='CAJOtW+4MWA5b3KBr6aAizuqx-4JpmwLrxV9mDk75AOgtQ=-bxA@mail.gmail.com' \
--to=tetra2005@gmail.com \
--cc=amodra@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenth@gcc.gnu.org \
--cc=richard.sandiford@linaro.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).