SDCC 3.9.1 #11241 (MINGW64)
command line: 'sdcc -mmcs51 --opt-code-size --fverbose-asm -c galois_lfsr.c'
Code size groove compare to 3.6.9 #9960 to 31 from 26 bytes.
3 dead instructions manipulating R5 and R6 appear.
galois_lfsr.c is:
unsigned char spm_test(void)
{
static unsigned char reg = 1;
reg = ((reg & 1) ? (reg >> 1)^0xe1 : (reg >> 1));
return(reg);
}
Defect can be closed. Does not occur in 4.6.0 anymore.
Attached patch further reduces the size to 24 bytes by removing an IMO superfluous reload of A.
Regards,
Ruud
I noticed that a further mcs51 peephole rule reduces the size again by 2 bytes and also increase the speed.