2008-02-12 08:52 PM
RE Cosmic compiler optimisation problems
2008-02-05 10:52 PM
I posted on here a while ago about a problem with the Cosmic compiler optimiser V4.5d. I have now tracked this down. Current version is V4.5.5. Changes between V4.5d and V4.4.5 are not relevant, so this bug is still outstanding.
C code written was :- if( wAddr & 0x8000 ) Code produced with optimisation OFF was :- ld a,_ee_GetBlock$L bcp a,#128 jreq L116 ; correct Code produced with optimisation ON was :- jrpl L116 ; incorrect, test optimised away2008-02-06 01:50 AM
Hi,
jrpl is really the most effective way to test the Most Significant Bit. A good compiler will do it this way. In detail: Some commands e.g ld a,_ee_GetBlock$L will set the N-flag of the Condition Code Register (CC) when the MSbit is set. Then with jrpl you will jump on condition positiv - means N=0. ld a,_ee_GetBlock$L jrpl L116 will meet the condition (only for the MSbit) correctly and is most effective. Regards WoRo2008-02-06 08:39 PM
2008-02-08 08:50 AM
Hi luca
Thanks for you response. I think you have misinterpreted my post. The code is optimised down to a single jrpl instruction ! There is no instruction preceding it to set the flags for the conditional jump. Strangely, further along in the code the exact same test is coded correctly.2008-02-08 08:09 PM
mailto:luca.ubiali@cosmic.fr
; I'll provide an explanation or a fix as necessary. Regards, Luca (Cosmic)2008-02-12 08:52 PM