Re: A92: Constants and immediate values + movem


[Prev][Next][Index][Thread]

Re: A92: Constants and immediate values + movem



At 22:17 1997-08-17 -0500, you wrote:

>>>Actually, ADDQ can add values from 1 to 8.  Using ADDQ can speed up
>>>additions to data registers, but when adding to an address register
>>>it is not any faster than an LEA.  It does save 2 bytes though.
>>
>>No it doesn't. Then again, A68K may substitute LEA when the addition
>>is 1-8, it substitutes ADD for ADDQ or ADDI...
>>
>>My .92p-file didn't get any shorter. I didn't compare sizes on the
>>calc - the .92p:s file header is constant size, or is it?
>
>Wrong!  The ADDQ really is smaller than LEA!  Actually, LEA (An),An is
>the same size as ADDQ, but LEA d(An),An is two bytes longer.  The reason
>that the files may seem to be the same size is that the object file
>format output by A68K always rounds the length of each section (Fargo
>programs should only have one) up to the nearest four bytes.  If you
>take 1024 bytes of code and optimize it to 1022, you won't notice any
>difference in the output size.  However, if you change two LEA (An),An
>into ADDQ.L #n,An, you will always see a four byte size decrease.

OK, I noticed that now - just cut 40 bytes from my program :)

A friend told me he'd seen a site with just these kind of tips for using
other mnemonics just like this. You wouldn't know where that is?

>A good 68000 assembler will automatically convert the LEA into an ADDQ
>when it is possible (if the offset is 1 to 8) or to a SUBQ (if the offset
>is -1 to -8).  However, A68K is not that advanced.  A68K does not change
>between ADDQ and LEA.

Does A68K substitute anything? ADD/ADDQ/ADDI?


Niklas Brunlid
PQF Quote follows:

"Kneel and deliver!"
        -- Casanunda, the worlds smallest lover turns highwaydwarf
           (Terry Pratchett, Lords and Ladies)


Follow-Ups: References: