Re: Re[2]: [cc65] optimizer?

Date view Thread view Subject view

From: daniel pralle (daniel.pralle_at_stud.uni-hannover.de)
Date: 2001-06-25 13:54:02


On Sun, 24 Jun 2001, groepaz wrote:

> - replacing sequences of register-shifts by hash-table-accesses (need
> one index register, so may be used after peephole analyzing) eg:
> 
> replace:
> 
>         lda something
>         lsr a
>         lsr a
>         lsr a
>         lsr a
>         sta something
> 
> by:
>         ldx something
>         lda lsr4tab,x
>         sta something
> 
> ...saving some cycles (and memory if used often enough to compensate
> the tablesize)

Aha! you are saving THREE-cycles.
We are so little on registers that we always, me at least, need
every-REgister busy. therefor saving/restoring the INDEX-Reg. 3+3
cycles. So we are THREE-cycles MINUS!

as far as I had experienced the SHIFT-things is the LAST thing to
optimize. If you have more than FOUR shifts, like in your example, you
shift the the other way round:
replace:
	lda zp
	lsr
	lsr
	lsr
	lsr
	lsr
	sta zp

by:
	lda zp
	rol
	rol
	rol
	and #$07	; if you need the ZEROs
	sta zp


Any comments are welcome.


daniel

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:40 CET