This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> 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?)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]