Discovered reproducible problem with sdasstm8 assembler.
Problem exists for both BSET and BRES instructions.
I have not tested but suspect there's potentially a similar problem
with the BCPL (bit complement) instruction.
I found the problem - fixed it - and tested the fix...
see attachments.
I suppose you are using a quite old version of sdcc / sdas? This bug was already fixed in rev8988.
https://sourceforge.net/p/sdcc/code/8988
I tried the newest sdasstm8 (rev9059) with your Test_BRES_BSET_Orig.s.
sdasstm8 Test_BRES_BSET_Orig.s -l
And got the right result as you expected in your BSET_BRES_ProblemReport.txt.
What's more, I found that BCPL / BCCM were also right.
This bug did exist in the SDCC-3.4.0 release, and we have made many improvements to the stm8 port since then, including this bug fix.
You are suggested to try latest SDCC on the snapshot build page, or build from the source.
sdcc.sourceforge.net/snap.php
svn checkout svn://svn.code.sf.net/p/sdcc/code/trunk sdcc-code
Ben,
When you find a bug has already been fixed please mark it as closed (and
assign it to yourself). There's no point in keeping it around.
Maarten
Related
Bugs:
#2290I will close it after JerryW confirms that, or several days later if not.
Yes, I am using the 3.4.0 release, I've confirmed the fix is present and works in the 8988 build.
I have a follow up question. In the course of testing/verifying my C code after the assembler fixes, I noticed that PH optimization was targeting only the least and most significant bits (PH 11-0, 11-7, 12-0 & 12-7) for BRES/BSET.
Any particular reason for not going after the mid-field bits?
Thanks for all the good work!
Jerry
P.S.
I've also been working on some STM8 assembly floating point routines.
So far about a 10x improvement over the standard library stuff.
Any suggestions on where might be a good location to share them?
They'll likely need some extensions if we want some degree of IEEE compliance...
I thought for the bres/bset, maybe LSB & MSB appear more frequently, but others bits should also be optimized if space/time cost can be saved.
You are highly welcome to create patch tickets on
http://sourceforge.net/p/sdcc/patches/ for either your floating point improvement or new PH rules (regarding bset/bres).
I will close this bug, and please send any more suggestions to the mail list sdcc-user and sdcc-devel.