EasyManua.ls Logo

Intel i960 - Page 253

Intel i960
347 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
i960 Processor Compiler User's Guide
7-64
7
Example 7-3 emul.c (continued)
return t.lo32;
}
else
{
if (t.hi32 == 0) /*upper32 matches lower32 sign bit */
return t.lo32;
}
overflow_error("32 bit multiply overflowed");
return t.lo32;
}
Consider the line containing the asm:
asm("emul %1,%2,%0" : "=t" (temp) : "dI" (in1), "dI" (in2));
"emul %1,%2,%0" is the
asm-template
. The emul instruction takes
three arguments:
src1, src2, and dst. These values are provided by
the
out-list
and
in-list
.
"=t" (temp) is the only
output-spec
. It is the first operand, i.e.,
operand 0. The
"=t"
constraint
indicates that this operand must go
in a double word register in order for the
asm-template
to generate a
legal instruction.
"dI" (in1) is the first
input-spec
. It is operand 1. The "dI"
constraint
indicates that operand 1 must be in a word register, or be
a constant from 0 to 31 for the
asm-template
to generate a legal
instruction. The compiler generates the extra code as necessary to
make sure the value of
in1 matches one of the
constraints
before
the asm is generated.
"dI" (in2) is the second
input-spec
. It is operand 2. Again the
"dI"
constraint
indicates that operand 1 must be in a word register,
or be a constant from 0 to 31. As before, the compiler makes sure that
the operand matches one of the
constraints
before generating the
asm. In this example,
temp is declared as a local variable, and its type
(int64) has the necessary size (8 bytes) and alignment (8 bytes) to go

Table of Contents

Related product manuals