GAS macro formals as expression

Fruhwirth Clemens clemens-dated-1064096658.9b9e@endorphin.org
Wed Sep 10 22:24:00 GMT 2003


On Wed, Sep 10, 2003 at 09:09:04AM -0700, Ian Lance Taylor wrote:
> Ian Lance Taylor <ian@airs.com> writes:
> 
> > I think gas is more flexible than you give it credit for.  Try this
> > version.  It probably needs some tweaks, but I think the general
> > approach should be workable.
> > 
> 
> Oh yeah, I should mention that a sample call is
> 	ldCachePentium2 (%esp),0x2c0
> and that `NN' should probably be replaced by `NN\@'.

Thanks! Works great for me. Little chances to support offsets start
different from 0 and it produces the same code as masm. 

For those interested:

.macro  ldCachePentium2 offset,addr,byteCnt
        NN\@ = 0
        .rept   (\byteCnt + 63) / 64
                .ifeq   ((NN\@ + \offset) & 0xffffffff)
                        mov \addr,%eax
                .else
                        mov ((\offset + NN\@) & 0xffffffff) \addr,%eax
                .endif
                .if     (NN\@ + 32) < \byteCnt
                        mov ((\offset + NN\@ + 36) & 0xffffffff) \addr,%ebx
                .endif
                NN\@ = NN\@ + 64
        .endr
.endm

Regards, Clemens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030910/fdb632c9/attachment.sig>


More information about the Binutils mailing list