GAS macro formals as expression

Ian Lance Taylor ian@airs.com
Wed Sep 10 15:21:00 GMT 2003


Fruhwirth Clemens <clemens-dated-1064070224.93d5@endorphin.org> writes:

> For instance this masm macro:
> 
> ldCache macro addr,byteCnt,cpuName
> NN=0
>   rept (byteCnt+63)/64                  ;force cache line load (Pentium only)
>     irp QQ,<%(NN)>
>     mov         eax,addr[QQ]
>         endm
>    if (NN+32) lt byteCnt
>     irp QQ,<%(NN+36)>
>       mov       ebx,addr[QQ]
>         endm
>    endif
> NN=NN+64
>   endm
> endm
> 
> I reimplemented this loop with this recursive gas macro:

Why didn't you use the gas rept and irp pseudo-ops?  Would they not
work for this application?

Another possibility is to use a preprocessor, like m4, instead of
using gas macros.

Ian



More information about the Binutils mailing list