Hi,
Wonder if anybody here knows if GNU assembler can do macro concatenation (like armasm), I was porting some code from armasm to gnu assembler this morning and got stuck at a macro for a good few hours, it seemed that GNU was unable to handle a specific situation.
out .req r0
x_r .req r1
x_i .req r2
y_r .req r3
y_i .req r4
z_r .req r5
z_i .req r6
.macro test a,b,c
add \a,\b_i,\c_r
.endm
The code above has names defined for registers, where values x,y,z have real and imaginary parts that are handled by postfixing the name with _r or _i, all is good so far, until you realise that the macro will not replace \b or \c with the argument value as I assume it believes the argument name is \b_i or \c_r. The armasm assembler copes with this by using syntax line $a._r where the argument has a start and end token, which is a much better idea.
I spent a good hour or so searching the web for a solution but to no avail, luckily my workaround is simple, instead of post fixing the with _r or _i, I prefix the register with r_ or i_ and then the macro argument concatenation works in my situation as the argument is stopped by the operand, so:
out .req r0
r_x .req r1
i_x .req r2
r_y .req r3
i_y .req r4
r_z .req r5
i_z .req r6
.macro test a,b,c
add \a,i_\b,r_\c
.endm
Seems like a bit of an oversight that there isn't a mechanism to do the former, either that or I didn't find the magic escape character to make it all work.
Adrian