public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114835] New: AVR popcountqi2 is not fast&small as can be
@ 2024-04-24 15:20 WolfgaNg.Hospital at arcor dot de
  2024-05-07 14:32 ` [Bug target/114835] " cvs-commit at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: WolfgaNg.Hospital at arcor dot de @ 2024-04-24 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114835
           Summary: AVR popcountqi2 is not fast&small as can be
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: WolfgaNg.Hospital at arcor dot de
  Target Milestone: ---

Created attachment 58025
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58025&action=edit
AVR assembly code for __popcountqi2

For 8-bit AVRs, the current 16-instruction __popcountqi2 uses 6 ADC
instructions to establish the number of bits set in a byte.  
In "Bit Twiddling Hacks", Sean E. Anderson presents several approaches to this;
"parallel/sideways addition" can be coded with one instruction&cycle less.

When establishing the "popcount" of an uint8_t, I've seen GCC to widen the
value to "half int" and use __popcountqi2 twice.

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

* [Bug target/114835] AVR popcountqi2 is not fast&small as can be
  2024-04-24 15:20 [Bug target/114835] New: AVR popcountqi2 is not fast&small as can be WolfgaNg.Hospital at arcor dot de
@ 2024-05-07 14:32 ` cvs-commit at gcc dot gnu.org
  2024-05-07 15:12 ` gjl at gcc dot gnu.org
  2024-05-07 15:14 ` gjl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:8d2c93fcfe1afc5291bbbe162c3b7ad5764f6d8d

commit r15-286-g8d2c93fcfe1afc5291bbbe162c3b7ad5764f6d8d
Author: Wolfgang Hospital <Wolfgang.Hospital@arcor.de>
Date:   Tue May 7 16:24:39 2024 +0200

    AVR: target/114835 - Tweak popcountqi2

    libgcc/
            PR target/114835
            * config/avr/lib1funcs.S (__popcountqi2): Use code that
            is one instruction shorter / faster.

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

* [Bug target/114835] AVR popcountqi2 is not fast&small as can be
  2024-04-24 15:20 [Bug target/114835] New: AVR popcountqi2 is not fast&small as can be WolfgaNg.Hospital at arcor dot de
  2024-05-07 14:32 ` [Bug target/114835] " cvs-commit at gcc dot gnu.org
@ 2024-05-07 15:12 ` gjl at gcc dot gnu.org
  2024-05-07 15:14 ` gjl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-05-07 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Fixed in v15.

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

* [Bug target/114835] AVR popcountqi2 is not fast&small as can be
  2024-04-24 15:20 [Bug target/114835] New: AVR popcountqi2 is not fast&small as can be WolfgaNg.Hospital at arcor dot de
  2024-05-07 14:32 ` [Bug target/114835] " cvs-commit at gcc dot gnu.org
  2024-05-07 15:12 ` gjl at gcc dot gnu.org
@ 2024-05-07 15:14 ` gjl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-05-07 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Wolfgang Hospital from comment #0)
> When establishing the "popcount" of an uint8_t, I've seen GCC to widen the
> value to "half int" and use __popcountqi2 twice.

This is a different issue, please f'up PR114975.

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

end of thread, other threads:[~2024-05-07 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 15:20 [Bug target/114835] New: AVR popcountqi2 is not fast&small as can be WolfgaNg.Hospital at arcor dot de
2024-05-07 14:32 ` [Bug target/114835] " cvs-commit at gcc dot gnu.org
2024-05-07 15:12 ` gjl at gcc dot gnu.org
2024-05-07 15:14 ` gjl 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).