SDKZSPF LSI, SDKZSPF Datasheet - Page 84

no-image

SDKZSPF

Manufacturer Part Number
SDKZSPF
Description
Manufacturer
LSI
Datasheet

Specifications of SDKZSPF

Lead Free Status / Rohs Status
Supplier Unconfirmed
3.10.5.4 Example 4
3.10.5.5 Example 5
3.10.6 Optimization of Inline Assembly
3-30
The example above adds the 32-bit product of the high and low 16 bits
of val to acc. Note that the high part of val is obtained with the %o2
operand and that the accumulator is printed with the %m0 operand. Also
note that acc is both an input and an output argument, and that the
constraint for acc when it appears as an output argument is c, an
accumulator, and when it appears as an input argument is 0, which tells
the compiler that these two arguments must be in the same location. If
acc is in r0 and val is in r3r2, the following code is generated:
asm(“mov %%smode, %0” : :
The example shown above sets %smode to val. Note that %smode is not
specified as a clobbered register, because %smode has no meaning to the
compiler. If val is a symbolic constant with the value 3, the following
code is generated:
You can find additional examples of using the asm directive in the header
file N_Intrinsic.h.
asm(“bits %smode, 7”);
The example shown above sets bit 7 in %smode. This example illustrates
the general rule that if the assembly statement contains an argument (as
in Example 4, which contains the argument %0), a reference to a register
must contain an additional per cent (%) sign. Example 5 contains no
argument, so a single % preceding smode is used.
For purposes of optimization, the compiler assumes that inline assembly
has no effect except to modify the output variables. Thus inline assembly
can be removed by optimization if none of the output variables is
subsequently used. Inline assembly that must not be deleted or
C Cross Compiler
Copyright © 1999-2003 by LSI Logic Corporation. All rights reserved.
“0” (acc), “r” (val));
mac.a r2, r3
“rn” (val));
mov %smode, 3