[Patch,AVR]: Fix PR29560 (map 16-bit shift to 8-bit)

Georg-Johann Lay avr@gjlay.de
Tue Jul 26 12:04:00 GMT 2011


http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02186.html

Richard Henderson wrote:
> On 07/25/2011 10:30 AM, Georg-Johann Lay wrote:
>> 	PR target/29560
>> 	* config/avr/avr.md: Add peephole2 to map ashlhi3 to ashlqi3 if
>> 	high part of shift target is unused.
> 
> Ok.
> 
> r~

Here is a more complete version that transforms earlier
and increases the number of cases covered.

Moreover, the original peep2 is not fully correct because it
maps a 16-bit shift to a 8-bit one.  The correct mapping is

(set (match_dup 2)
     (subreg:QI (ashift:HI (zero_extend:HI (match_dup 2))
                           (match_dup 1))
                0))

instead of

(set (match_dup 2)
     (ashift:QI (match_dup 2)
                (match_dup 1)))


I don't think it makes a difference that late in the
compilation process, yet I prefer correct semantics.

The new iterators are already seen in the widening
multiply patch.

Ok?

Johann

	PR target/29560
	* config/avr/avr.md (any_extend): New code interator.
	(extend_prefix): New code attribute.
	(*ashl<extend_prefix>qihiqi3): New insns.
	(*ashl<extend_prefix>qihiqi3.mem): New insn-and-splits.
	(*ashlhiqi3): New insn-and-split.
	Add peephole2 to map ashlhi3 to ashlqi3 if high part of
	shift target is unused.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr29560-v2.diff
Type: text/x-patch
Size: 3916 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110726/b6db92b6/attachment.bin>


More information about the Gcc-patches mailing list