This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix *two* AVR backend bugs (PR19293 + PR19329)
- From: Marek Michalkiewicz <marekm at amelek dot gda dot pl>
- To: Paul Schlie <schlie at comcast dot net>
- Cc: Bernardo Innocenti <bernie at develer dot com>,Giovanni Bajo <rasky at develer dot com>, denisc at overta dot ru,Stefano Fedrigo <aleph at develer dot com>, gcc-patches at gcc dot gnu dot org,Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 24 Jan 2005 08:45:43 +0100
- Subject: Re: [PATCH] Fix *two* AVR backend bugs (PR19293 + PR19329)
- References: <41F443BB.email@example.com> <BE19B6D5.8BEBfirstname.lastname@example.org>
On Sun, Jan 23, 2005 at 08:17:25PM -0500, Paul Schlie wrote:
> If you're not going to treat positive out-of-range shift as a no-op,
> it might make sense to treat arithmetic right-shifts > mode-size as
> equivalent to it's maximum valid arithmetic right-shift, thereby:
> (((signed >> y) >> y) == ((signed) x >> (2 * y))
> Thereby effectively saturating all positive shifts; but wonder if <= 0
> shifts might be most efficiently handled as a no-op, i.e. logically only
> shifting while count > 0 ?
See the patch I sent yesterday - it is supposed to do exactly that.
All shift counts <= 0 are handled as a no-op in out_shift_with_cnt.
For ashl* and lshr*, shift count >= mode_size returns 0.
For ashr*, shift count >= mode_size works like (mode_size - 1)
which copies the sign bit to all bits of the result.
The optimization in out_shift_with_cnt (where one bit is set in
__zero_reg__) only works for constant shift count in the range 1...7
and only if no hand-optimized code was output by an earlier "switch"
statement - it's not "modulo 8". No out of range counts here.
> (but still wonder if GCC things the cc is set for shifts of 0 if not
> optimized away?)
See my patch - it includes a change in notice_update_cc for ashrqi3.