#2273 [PIC16] Bit toggle optimized only sometimes

open
nobody
None
PIC16
5
2016-01-16
2014-05-07
No

sdcc version:
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.4.0 #8981 (Apr 5 2014) (Linux)

sdcc command:
$ sdcc -mpic16 -p18f2550 --use-non-free toggle.c

Having this fragment of code, both lines do the same, i.e. toggling a bit in LATA.

LATAbits.LATA0 = !LATAbits.LATA0;
LATA ^= 0x01;

However, only the second line is translated to a BTG instruction. The first line produces 16 assembly lines.

Thanks!

1 Attachments

Discussion


Log in to post a comment.