EasyManua.ls Logo

Intel i960 - Page 252

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...
Language Implementation
7-63
7
"dI" (new_mask) is the only
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. The compiler generates extra code as
necessary to make sure
new_mask matches one of the
constraints
before the asm is generated.
Example 3: emul.c
The example refers to Example 7-3 below. The asm containing the
emul
instruction is shown in bold.
Example 7-3 emul.c
typedef struct
{
unsigned int lo32;
int hi32;
} int64;
typedef int int32;
static inline
int64 asm_emul(int32 in1, int32 in2)
{
int64 temp;
asm("emul %1,%2,%0" : "=t" (temp)
: "dI" (in1), "dI" (in2));
return temp;
}
int32 mul32_check_overflow(int32 a, int32 b)
{
int64 t;
t = asm_emul(a, b);
if ((t.lo32 & 0x80000000) != 0)
{
if (t.hi32 == -1) /*upper32 matches lower32 sign bit*/
continued

Table of Contents

Related product manuals