[PicForth] Re: -! optimisation problem
David McNab
david at rebirthing.co.nz
Mon Dec 6 17:14:17 CET 2004
Samuel Tardieu wrote:
> David> I'm porting some assembler to pure forth, and the former
> David> generated code is causing some issues.
>
> Both codes are correct. However, I have implemented the optimization
> you suggested in my development version, please tell me if it works
> for you.
Works a charm. Thanks heaps for that, and for doing it so quickly.
Got a 5-word saving as well in one picforth word alone :)
The code in question is lib3, the core 24-bit division routine.
It appears that 'movf 0x29,w / sublw 0x00 / 0x30,f', for some values of
the two variables, leaves C in a different state to
'movf 0x29,w / subwf 0x30,f'. I guess this could be investigated further
with a bruteforce check of all values of the 2 variables, but it's
5:10am here and I'm way too tired atm.
With the former, the 24-bit division code was failing. With the latter,
it succeeds. Which makes me happy, because lib3 is now pure picforth,
with not a single ']asm' cop-out.
PicForth's rapid evolution is taking it to a point where it's getting
harder and harder to save codesize with assembler. That's something
which few, if any, high level language implementations can claim.
--
Cheers
David
More information about the PicForth
mailing list