.macro swap (A,B,TEMP) # . marks the directive
set .TEMP,.A # . marks the special variable.
set .A,.B
set .B,.TEMP
.endm # And . marks the end of the macro.
Is there a way to write this macro without specifying the TEMP parameter? For example, something like:
.macro swap (A,B)
.local pmc .TEMP
.TEMP = .A
.A = .B
.B = .TEMP
.endm
I've tried a few obvious permutations, but don't see anything that works as is.
- Michael
.local inside macros creates a local *label*.
As the macro arguments could be any kind of register, the macro can't
have the TEMP hidden inside. If you are gonna swap PMCs only, you could
write it as:
.macro swapP (A,B)
$P0 = .A
.A = .B
.B = $P0
.endm
(untested)
*But* we have an opcode called *exchange* ... It's even JITted on i386.
leo
Leopold Toetsch wrote:
> .macro swapP (A,B)
> $P0 = .A
> .A = .B
> .B = $P0
> .endm
>
> (untested)
Seems to work, thanks.
> *But* we have an opcode called *exchange* ... It's even JITted on i386.
This was just an example. Thanks.
> leo
>
>