Menu

#489 Less optimal code generation in 3.5.0 (vs 3.4.0)

None
open
nobody
None
5
2016-02-11
2015-10-06
No

The size of a few sdcc library objects has increased from SDCC 3.4.0 to 3.5.0 on the PIC16 port. For instance, divuchar was 110 bytes and now it's 118 bytes.

To my knowlegde, the divuchar source code hasn't changed:
https://sourceforge.net/p/sdcc/code/HEAD/tree/trunk/sdcc/device/lib/pic16/libsdcc/char/divuchar.c

And the compilation command for divuchar during SDCC build process is the same on both:

3.4.0

$ '/tmp/sdcc/sdcc-3.4.0/device/lib/pic16//../../../bin/sdcc' -DHAVE_CONFIG_H -I. -I..  -I. -I../../../include/pic16 -I../../../non-free/include/pic16  --std-c99 --asm="'/usr/local/bin/gpasm'" --no-warn-non-free --fomit-frame-pointer --obanksel=9 --denable-peeps --optimize-cmp --optimize-df --i-code-in-asm -DUSE_FLOATS=0 -mpic16 -p18f452 -c -o divuchar.o `test -f 'char/divuchar.c' || echo './'`char/divuchar.c

3.5.0

$ '/tmp/sdcc/sdcc-3.5.0/device/lib/pic16//../../../bin/sdcc' -DHAVE_CONFIG_H -I. -I..  -I. -I../../../include/pic16 -I../../../non-free/include/pic16  --std-c99 --asm="'/usr/local/bin/gpasm'" --no-warn-non-free --fomit-frame-pointer --obanksel=9 --denable-peeps --optimize-cmp --optimize-df --i-code-in-asm -DUSE_FLOATS=0 -mpic16 -p18f452 -c -o divuchar.o `test -f 'char/divuchar.c' || echo './'`char/divuchar.c

However, you can compare the asm output of both on the files attached. The while (--count) generates a few more asssambly lines on 3.5.0. The code seems correct, though, so this report is more to understand what the cause might be and if that has other implications.

Thanks as always.

Diego

1 Attachments

Discussion

  • Ben Shi

    Ben Shi - 2015-10-07

    That is due to an iTemp3 is not killed in arch-independant optimization, in 3.5.0 comparing to 3.4.0.

     
  • Ben Shi

    Ben Shi - 2015-10-07
    • Category: PIC16 --> other
     
  • Ben Shi

    Ben Shi - 2016-02-10

    Such ticket can be moved to feature requests, since no wrong code is generated. But I have no access.

     
  • Maarten Brock

    Maarten Brock - 2016-02-11

    Ticket moved from /p/sdcc/bugs/2424/

    Can't be converted:

    • _category: other
     

Log in to post a comment.