From: Andrew Pinski <pinskia@gmail.com>
To: cassio.neri@gmail.com
Cc: libstdc++@gcc.gnu.org, Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Remove unnecessary "& 1" in year_month_day_last::day()
Date: Sun, 5 Nov 2023 11:54:59 -0800 [thread overview]
Message-ID: <CA+=Sn1kam8NEe=0FPTSqKuWbLtPg_f9GFancjyThFk2TZ7E8EQ@mail.gmail.com> (raw)
In-Reply-To: <CAOfgUPh20Ns6Q6YGmm59KbDa00A_PArXOiN8-s2S6RDJ3chMsQ@mail.gmail.com>
On Sun, Nov 5, 2023 at 9:13 AM Cassio Neri <cassio.neri@gmail.com> wrote:
>
> I could not find any entry in gcc's bugzilla for that. Perhaps my search wasn't good enough.
I filed https://gcc.gnu.org/PR112395 with a first attempt at the patch
(will double check it soon).
Thanks,
Andrew
>
>
> On Sun, 5 Nov 2023 at 15:58, Marc Glisse <marc.glisse@inria.fr> wrote:
>>
>> On Sun, 5 Nov 2023, Cassio Neri wrote:
>>
>> > When year_month_day_last::day() was implemented, Dr. Matthias Kretz realised
>> > that the operation "& 1" wasn't necessary but we did not patch it at that
>> > time. This patch removes the unnecessary operation.
>>
>> Is there an entry in gcc's bugzilla about having the optimizer handle this
>> kind of optimization?
>>
>> unsigned f(unsigned x){
>> if(x>=32)__builtin_unreachable();
>> return 30|(x&1); // --> 30|x
>> }
>>
>> (that optimization would come in addition to your patch, doing the
>> optimization by hand is still a good idea)
>>
>> It looks like the criterion would be a|(b&c) when the possible 1 bits of b
>> are included in the certainly 1 bits of a|c.
>>
>> --
>> Marc Glisse
prev parent reply other threads:[~2023-11-05 19:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 15:38 Cassio Neri
2023-11-05 15:58 ` Marc Glisse
2023-11-05 16:09 ` Cassio Neri
2023-11-05 19:54 ` Andrew Pinski [this message]
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='CA+=Sn1kam8NEe=0FPTSqKuWbLtPg_f9GFancjyThFk2TZ7E8EQ@mail.gmail.com' \
--to=pinskia@gmail.com \
--cc=cassio.neri@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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).