[patch, avr, pr71676 and pr71678] Issues with casesi expand

Georg-Johann Lay avr@gjlay.de
Mon Sep 26 15:06:00 GMT 2016


On 26.09.2016 15:19, Pitchumani Sivanupandi wrote:
> Attached patch for PR71676 and PR71678.
>
> PR71676 is for AVR target that generates wrong code when switch case index is
> more than 16 bits.
>
> Switch case index of larger than SImode are checked for out of range before
> 'casesi' expand. RTL expand of casesi gets index as SImode, but index is
> compared in HImode and ignores upper 16bits.
>
> Attached patch changes the expansion for casesi to make the index comparison
> in SImode and code generation accordingly.
>
> PR71678 is ICE because below pattern in 'casesi' is not recognized.
> (set (reg:HI 47)
>      (minus:HI (subreg:HI (subreg:SI (reg:DI 44) 0) 0)
>                (reg:HI 45)))
>
> Fix of PR71676 avoids the above pattern as it changes the comparison
> to SImode.

But this means that all comparisons are now performed in SImode which is a 
great performance loss for most programs which will switch on 16-bit values.

IMO we need a less intrusive (w.r.t. performance) approach.

Johann


> Regtested using avrtest. No regression found.
>
> If OK, could someone commit please?
>
> Is this OK for gcc-5-branch?
>
> Regards,
> Pitchumani
>
> gcc/ChangeLog
>
> 2016-09-26  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>
>
>     PR target/71676
>     PR target/71678
>     * config/avr/avr.md (casesi): Change index compare to SI mode.
>
> gcc/testsuite/ChangeLog
>
> 2016-09-26  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>
>
>     PR target/71676
>     PR target/71678
>     * gcc.target/avr/pr71676-1.c: New test.
>     * gcc.target/avr/pr71676.c: New test.
>     * gcc.target/avr/pr71678.c: New test.
>



More information about the Gcc-patches mailing list