[Patch, AVR]: PR49313, fix PR29524

Richard Henderson rth@redhat.com
Thu Jun 16 19:17:00 GMT 2011


On 06/15/2011 02:47 AM, Georg-Johann Lay wrote:
> +#if defined (L_loop_ffsqi2)
> +;; Helper for ffshi2, ffssi2
> +;; r25:r24 = r26 + zero_extend16 (ffs8(r24))
> +;; r24 must be != 0
> +;; clobbers: r26
> +DEFUN __loop_ffsqi2

Why does this function have "loop" in its name?  The actual
implementation is surely irrelevant.

> +DEFUN __ffshi2
> +    clr  r26
> +    cpse r24, __zero_reg__
> +1:  XJMP __loop_ffsqi2
> +    ldi  r26, 8
> +    or   r24, r25

It probably doesn't matter to execution speed, but why the
OR here, when you know that r24 is 0?  Wouldn't the logic
be clearer spelling this with MOV?

> +#if defined (L_ctzsi2)
> +;; count trailing zeros
> +;; r25:r24 = ctz32 (r25:r22)
> +;; ctz(0) = 32

Note that GCC does not define ctz(0).  It's explicitly undefined.
Why are you forcing a particular value here?


r~



More information about the Gcc-patches mailing list