From: Cassio Neri <cassio.neri@gmail.com>
To: libstdc++@gcc.gnu.org
Cc: Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Remove unnecessary "& 1" in year_month_day_last::day()
Date: Sun, 5 Nov 2023 16:09:23 +0000 [thread overview]
Message-ID: <CAOfgUPh20Ns6Q6YGmm59KbDa00A_PArXOiN8-s2S6RDJ3chMsQ@mail.gmail.com> (raw)
In-Reply-To: <2c114d39-4c87-65a1-3371-63e856cd0d37@inria.fr>
[-- Attachment #1: Type: text/plain, Size: 900 bytes --]
I could not find any entry in gcc's bugzilla for that. Perhaps my search
wasn't good enough.
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
>
next prev parent reply other threads:[~2023-11-05 16:09 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 [this message]
2023-11-05 19:54 ` Andrew Pinski
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=CAOfgUPh20Ns6Q6YGmm59KbDa00A_PArXOiN8-s2S6RDJ3chMsQ@mail.gmail.com \
--to=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).