This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GAS macro formals as expression


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]