This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/29524] [4.2/4.3 Regression] Too much RAM used: __clz_tab[] linked
- From: "anrp at mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Sep 2007 21:48:03 -0000
- Subject: [Bug target/29524] [4.2/4.3 Regression] Too much RAM used: __clz_tab[] linked
- References: <bug-29524-10671@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from anrp at mit dot edu 2007-09-08 21:48 -------
(In reply to comment #10)
> Here's an untested (I'm going to try to figure out how to get it to build into
> the AVR build) function that replaces the definition of clz_tab with a 6
> instruction bit of code:
>
> ; r2 in, r3 out
> ; r2 clobbered
> ; Z, C, N. V clobbered
> clz_compute:
> ldi r3, 0x09 ; preload output
> clc ; clear C (guarentees termination with 8 loops)
> clz_compute_loop1:
> rol r2 ; push MSB into C
> dec r3 ; dec output
> brcs clz_end ; if C is set (msb was set), we're done
> rjmp clz_compute_loop1 ; otherwise, repeat
> clz_end:
>
And the first bug of the day, clc should be sec. brcs will only jump out if C
is set. On to prodding gcc...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29524