http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55181
Bug #: 55181 Summary: [4.7/4.8 Regression] Expensive shift loop where a bit-testing instruction could be used Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@gcc.gnu.org Target: avr The following C code: unsigned char lfsr (unsigned long number) { unsigned char b = 0; if (number & (1L << 29)) b++; if (number & (1L << 13)) b++; return b; } compiles to a right shift 29 bits of number which is very expensive because AVR has no barrel shifter. Instead, a bit-testing instruction could be used which takes just a few cycles and not more than 100 like with the right shift. 4.6.2 uses a bit testing instruction. == Command line ==