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

Reply via email to