Menu

#2905 Regression: mcs8051 footprint of galois_lfsr.c

open
nobody
MCS51
5
2026-02-20
2019-04-30
No

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);
}

Discussion

  • RvS

    RvS - 2026-02-19

    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

     
    👍
    2
  • RvS

    RvS - 2026-02-20

    I noticed that a further mcs51 peephole rule reduces the size again by 2 bytes and also increase the speed.

     

Log in to post a comment.

Monday.com Logo