GAS macro formals as expression

Ian Lance Taylor ian@airs.com
Wed Sep 10 16:09:00 GMT 2003


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.
> 
> .macro	ldCachePentium2 addr,byteCnt
> 	NN = 0
> 	.rept	(\byteCnt + 63) / 64
> 		.ifeq	NN
> 			mov \addr,%eax
> 		.else
> 			mov	NN \addr,%eax
> 		.endif
> 		.if	(NN + 32) < \byteCnt
> 			mov NN + 36 \addr,%eax
> 		.endif
> 		NN = NN + 64
> 	.endr
> 	.endm

Oh yeah, I should mention that a sample call is
	ldCachePentium2 (%esp),0x2c0
and that `NN' should probably be replaced by `NN\@'.

Ian



More information about the Binutils mailing list