William Coleda wrote:
A macro example in the docs shows:

 .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

.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



Reply via email to