i960 Processor Compiler User's Guide
7-66
7
Consider the lines containing the asm:
__asm__ volatile ("synmovq %2,%3" : "=m"(*IAC_dst)
: "m"(*IAC_p),"d"(IAC_dst),"d"(IAC_p));}
• "synmovq %2,%3" is the
asm-template
. synmovq writes four
words into reserved memory on the i960 KB processor, and then sends
a message to the i960 processor telling it to do a software interrupt.
synmovq takes two arguments,
src
and
dst
, where
src
is the location
to copy from, and
dst
is the location to copy to. These values are
provided by the
out-list
and
in-list
.
•
"=m" (*IAC_dst) is the only
output-spec
. It is the first operand,
i.e., operand 0. The
"=m"
constraint
indicates that any memory
operand can be used.
•
"m" (*IAC_p) is the first
input-spec
. It is the second operand,
i.e., operand 1. Again, any memory operand can be used.
•
"d" (IAC_dst) is the second
input-spec
. It is the third operand,
i.e., operand 2. The
"d"
constraint
indicates that any global or
local word register or a constant from 0 to 31 may be used. This
register is only read, not written, so it acts as its own input.
•
"d" (IAC_p) is the third
input-spec
. It is the fourth operand,
i.e., operand 3. Again, any global or word register may be used.
NOTE. In this example, four operands were specified, although the
asm-template
required only two. The additional operands
(in this instance, operands 0 and 1) tell the compiler about objects
whose values may be changed by the asm statement or whose value the
asm statement may need. In this case, the asm modifies memory, which
may affect optimizations the compiler performs at runtime. The only
actual output from the asm is the memory written.