[PATCH] Fix *two* AVR backend bugs (PR19293 + PR19329)

Paul Schlie schlie@comcast.net
Mon Jan 24 01:17:00 GMT 2005


> From: Bernardo Innocenti <bernie@develer.com>
> I agree.  For all shift patterns, we should consistently:
> 
>  - return the input operand unchanged for shifts by 0;
>  - do the right thing for shifts between 1 and N-1;
>  - return 0 for out-of-range shifts;
> 
> I will prepare an updated patch.

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 ?

(but still wonder if GCC things the cc is set for shifts of 0 if not
optimized away?)




More information about the Gcc-patches mailing list