Message ID | 4DFB1C6F.1050807@gjlay.de |
---|---|
State | New |
Headers | show |
On 06/17/2011 02:20 AM, Georg-Johann Lay wrote: > Richard Henderson schrieb: >> 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. > > hmmm. I needed some global name that can be referenced from __ffshi2 > resp. __ffssi2. The function in itself is not very helpful as stand > alone. You prefer some other naming for such global helpers? __ffsqi_nz perhaps? > The following instruction is BRNE, a conditional branch. Oops, missed that, sorry. > Yes, you are right. Following patchlet ok? > > Johann > > > * config/avr/libgcc.S (__ctzsi2, __ctzhi2): > Map zero to 255. You'd also delete the COUNT_LEADING_ZEROS_0 definition in longlong.h. r~
Richard Henderson schrieb: > On 06/17/2011 02:20 AM, Georg-Johann Lay wrote: >> Richard Henderson schrieb: >>> On 06/15/2011 02:47 AM, Georg-Johann Lay wrote: >> >> Yes, you are right. Following patchlet ok? >> >> Johann >> >> * config/avr/libgcc.S (__ctzsi2, __ctzhi2): >> Map zero to 255. > > You'd also delete the COUNT_LEADING_ZEROS_0 definition in longlong.h. > > r~ __clzsi2(0) still returns 32 as it does not use ctz. So if implementation of ctz affects validity of COUNT_LEADING_ZEROS_0 that's bit confusing... Johann
Index: config/avr/libgcc.S =================================================================== --- config/avr/libgcc.S (Revision 175104) +++ config/avr/libgcc.S (Arbeitskopie) @@ -977,12 +977,10 @@ ENDF __loop_ffsqi2 #if defined (L_ctzsi2) ;; count trailing zeros ;; r25:r24 = ctz32 (r25:r22) -;; ctz(0) = 32 +;; ctz(0) = 255 DEFUN __ctzsi2 XCALL __ffssi2 dec r24 - sbrc r24, 7 - ldi r24, 32 ret ENDF __ctzsi2 #endif /* defined (L_ctzsi2) */ @@ -990,12 +988,10 @@ ENDF __ctzsi2 #if defined (L_ctzhi2) ;; count trailing zeros ;; r25:r24 = ctz16 (r25:r24) -;; ctz(0) = 16 +;; ctz(0) = 255 DEFUN __ctzhi2 XCALL __ffshi2 dec r24 - sbrc r24, 7 - ldi r24, 16 ret ENDF __ctzhi2 #endif /* defined (L_ctzhi2) */