public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115065] New: AVR clz is not always fast as can be
@ 2024-05-13  8:31 WolfgaNg.Hospital at arcor dot de
  2024-05-18 10:24 ` [Bug target/115065] " gjl at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: WolfgaNg.Hospital at arcor dot de @ 2024-05-13  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115065
           Summary: AVR clz is not always fast as can be
           Product: gcc
           Version: unknown
            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 58186
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58186&action=edit
AVR assembly code for __clzhi2

For 8-bit AVRs, count leading zeroes is based on __clzhi2. (This is in contrast
to popcount using the single-register (qi) variant. Possibly due to the
convenience of having the MSB of the result cleared in just one place. No idea
if it was wiser to declare the result single-register, plenty even for
"double-width integer" arguments.)
Instruction order isn't optimal up to now, allowing to take one cycle off for
argument values 1-255. (This includes the worst case: 1.)

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

* [Bug target/115065] AVR clz is not always fast as can be
  2024-05-13  8:31 [Bug target/115065] New: AVR clz is not always fast as can be WolfgaNg.Hospital at arcor dot de
@ 2024-05-18 10:24 ` gjl at gcc dot gnu.org
  2024-05-18 13:12 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-05-18 10:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
IIUC, this is just about the timing of a branch, which in the general != 0 is
currently taken (takes 2 ticks), but it's better to only take it in the
non-common (= 0) case? So that the common case falls through and thus takes 1
cycle less.

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

* [Bug target/115065] AVR clz is not always fast as can be
  2024-05-13  8:31 [Bug target/115065] New: AVR clz is not always fast as can be WolfgaNg.Hospital at arcor dot de
  2024-05-18 10:24 ` [Bug target/115065] " gjl at gcc dot gnu.org
@ 2024-05-18 13:12 ` cvs-commit at gcc dot gnu.org
  2024-05-18 13:15 ` cvs-commit at gcc dot gnu.org
  2024-05-18 13:16 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-18 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:988838da722dea09bd81ee9d49800a6f24980372

commit r15-645-g988838da722dea09bd81ee9d49800a6f24980372
Author: Wolfgang Hospital <Wolfgang.Hospital@arcor.de>
Date:   Sat May 18 15:02:51 2024 +0200

    AVR: target/115065 - Tweak __clzhi2.

    The libgcc implementation of __clzhi2 can be tweaked by
    one cycle in some situations by re-arranging the instructions.
    It also reduces the WCET by 1 cycle.

    libgcc/
            PR target/115065
            * config/avr/lib1funcs.S (__clzhi2): Tweak.

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

* [Bug target/115065] AVR clz is not always fast as can be
  2024-05-13  8:31 [Bug target/115065] New: AVR clz is not always fast as can be WolfgaNg.Hospital at arcor dot de
  2024-05-18 10:24 ` [Bug target/115065] " gjl at gcc dot gnu.org
  2024-05-18 13:12 ` cvs-commit at gcc dot gnu.org
@ 2024-05-18 13:15 ` cvs-commit at gcc dot gnu.org
  2024-05-18 13:16 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-18 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:3b88dade7ff8a07fd0843ac1281e095cfd94453e

commit r14-10217-g3b88dade7ff8a07fd0843ac1281e095cfd94453e
Author: Wolfgang Hospital <Wolfgang.Hospital@arcor.de>
Date:   Sat May 18 15:02:51 2024 +0200

    AVR: target/115065 - Tweak __clzhi2.

    The libgcc implementation of __clzhi2 can be tweaked by
    one cycle in some situations by re-arranging the instructions.
    It also reduces the WCET by 1 cycle.

    libgcc/
            PR target/115065
            * config/avr/lib1funcs.S (__clzhi2): Tweak.

    (cherry picked from commit 988838da722dea09bd81ee9d49800a6f24980372)

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

* [Bug target/115065] AVR clz is not always fast as can be
  2024-05-13  8:31 [Bug target/115065] New: AVR clz is not always fast as can be WolfgaNg.Hospital at arcor dot de
                   ` (2 preceding siblings ...)
  2024-05-18 13:15 ` cvs-commit at gcc dot gnu.org
@ 2024-05-18 13:16 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-05-18 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
           Severity|normal                      |minor
   Target Milestone|---                         |14.2
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

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

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

end of thread, other threads:[~2024-05-18 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13  8:31 [Bug target/115065] New: AVR clz is not always fast as can be WolfgaNg.Hospital at arcor dot de
2024-05-18 10:24 ` [Bug target/115065] " gjl at gcc dot gnu.org
2024-05-18 13:12 ` cvs-commit at gcc dot gnu.org
2024-05-18 13:15 ` cvs-commit at gcc dot gnu.org
2024-05-18 13:16 ` 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).