i960 Processor Compiler User's Guide
7-68
7
• "=d" (wtmp) is the second
output-spec
. It is the second operand,
i.e., operand 1. The
"d"
constraint
indicates that any global or
word register can be used.
•
"dI" (val) is the first
input-spec
. It is the third operand,
i.e., operand 2. The
"dI"
constraint
indicates that any global or
word register containing a constant in the range 0 through 31 can be
used.
•
"m" (*p) is the second
input-spec
. It is the fourth operand,
i.e., operand 3. Again, any memory operand may be used.
•
"d" (p) is the third
input-spec
. It is the fifth operand, i.e.,
operand 4. Again, any global or word register may be used.
NOTE. Again, this example specifies five operands, though the
asm-template requires only three. The additional operands tell the
compiler about objects whose values may be changed by the asm
statement or whose value the asm statement may need.
Example 6: modpc.c
The following example refers to the short C program shown in
Example 7-6 below. The asm containing the
modpc instruction is shown
in bold.
Example 7-6 atadd.c
extern inline unsigned
modpc (unsigned new_pc, unsigned mask)
{
int wtmp;
__asm__ __volatile__("modpc %1,%1,%0" : "=d"(new_pc), :
"dI"(mask),"0" (new_pc));
return new_pc;
}
continued ☛