Rotate patterns that split byte sized rotates into moves do not correctly consider overlap of operands. This was noted on a similar but different shift bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39635 and detailed here http://lists.gnu.org/archive/html/avr-gcc-list/2009-03/msg00158.html Bug raised to reference separate testcase and fix.
Subject: Bug 41885 Author: hutchinsonandy Date: Sat Oct 31 00:38:10 2009 New Revision: 153773 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153773 Log: PR target/41885 * gcc.target/avr/torture/pr41885.c: New test. Added: trunk/gcc/testsuite/gcc.target/avr/torture/pr41885.c Modified: trunk/gcc/testsuite/ChangeLog
Subject: Bug 41885 Author: hutchinsonandy Date: Fri Jan 8 23:01:45 2010 New Revision: 155746 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155746 Log: 2010-01-08 Andy Hutchinson <hutchinsonandy@gcc.gnu.org> PR target/41885 * avr.md (rotlqi3): Add CONST_INT_P check. (rotlhi3): Delete. (rotlhi3_8): Delete. (rotlsi3): Delete. (rotlsi3_8): Delete. (rotlsi3_16): Delete. (rotlsi3_24): Delete. (rotl<mode>3): New. (*rotw<mode>3): New. (*rotb<mode>3): New. *avr.c (avr_rotate_bytes): New function. *avr-proto.h (avr_rotate_bytes): New function. Modified: trunk/gcc/ChangeLog trunk/gcc/config/avr/avr-protos.h trunk/gcc/config/avr/avr.c trunk/gcc/config/avr/avr.md
Fixed with Andy's patch. 4.5.0 passes the testcase.