public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/113806] New: [performance] bitset::operator>>= unnecessarily sanitizes the high-word
@ 2024-02-07 12:21 rhalbersma at gmail dot com
  2024-02-08 12:58 ` [Bug libstdc++/113806] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rhalbersma at gmail dot com @ 2024-02-07 12:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113806

            Bug ID: 113806
           Summary: [performance] bitset::operator>>= unnecessarily
                    sanitizes the high-word
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rhalbersma at gmail dot com
  Target Milestone: ---

It seems that since time immemorial, bitset::operator>>= unnecessarily
sanitizes the high word by calling this->_M_do_sanitize(); 

It is unnecessary since right-shifting moves bits away from the high-word so
that the class invariant can not be violated (in contrast to
bitset::operator<<= where bits flow into the high word, and where t). 

Current LOC is 1092 in <bitset> on libstdc++ trunk, and could be removed with
no functional change.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/113806] [performance] bitset::operator>>= unnecessarily sanitizes the high-word
  2024-02-07 12:21 [Bug libstdc++/113806] New: [performance] bitset::operator>>= unnecessarily sanitizes the high-word rhalbersma at gmail dot com
@ 2024-02-08 12:58 ` redi at gcc dot gnu.org
  2024-02-15 11:44 ` cvs-commit at gcc dot gnu.org
  2024-02-15 12:44 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-08 12:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113806

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-08
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/113806] [performance] bitset::operator>>= unnecessarily sanitizes the high-word
  2024-02-07 12:21 [Bug libstdc++/113806] New: [performance] bitset::operator>>= unnecessarily sanitizes the high-word rhalbersma at gmail dot com
  2024-02-08 12:58 ` [Bug libstdc++/113806] " redi at gcc dot gnu.org
@ 2024-02-15 11:44 ` cvs-commit at gcc dot gnu.org
  2024-02-15 12:44 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 11:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113806

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:bf883e6428a545d091319c8b71fcfb35e7dd7084

commit r14-9003-gbf883e6428a545d091319c8b71fcfb35e7dd7084
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Feb 8 15:47:19 2024 +0000

    libstdc++: Remove redundant zeroing in std::bitset::operator>>= [PR113806]

    The unused bits in the high word are already zero before this operation.
    Shifting the used bits to the right cannot affect the unused bits, so we
    don't need to sanitize them.

    libstdc++-v3/ChangeLog:

            PR libstdc++/113806
            * include/std/bitset (bitset::operator>>=): Remove redundant
            call to _M_do_sanitize.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/113806] [performance] bitset::operator>>= unnecessarily sanitizes the high-word
  2024-02-07 12:21 [Bug libstdc++/113806] New: [performance] bitset::operator>>= unnecessarily sanitizes the high-word rhalbersma at gmail dot com
  2024-02-08 12:58 ` [Bug libstdc++/113806] " redi at gcc dot gnu.org
  2024-02-15 11:44 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 12:44 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-15 12:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113806

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 14, thanks for the suggestion.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-15 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 12:21 [Bug libstdc++/113806] New: [performance] bitset::operator>>= unnecessarily sanitizes the high-word rhalbersma at gmail dot com
2024-02-08 12:58 ` [Bug libstdc++/113806] " redi at gcc dot gnu.org
2024-02-15 11:44 ` cvs-commit at gcc dot gnu.org
2024-02-15 12:44 ` redi at gcc dot gnu.org

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).