D-2
L-Intrinsic Functions
Copyright 1999-2002 by LSI Logic Corporation. All rights reserved.
The compiler generates code to copy the arguments to the proper
accumulator registers, if required. Eliminating the steps required in
copying the arguments minimizes execution time. Copying the
arguments is not required if:
The long argument already exists in the appropriate accumulator (for
example, if you call
L_maca
with a variable declared as type
accum_a
).
Execution time can also be minimized by not requiring the result to be
copied to its destination. Copying the result is not required if:
The destination for the intrinsic function’s result is already the target
for the instruction used to implement the intrinsic function (for
example, if
L_maca
returns a value to a variable declared as type
accum_a
)
For example, the following code is legal:
accum_b b;
int x,y;
...
b = L_maca(b,x,y);
However, it is more efficient to use:
b = L_macb(b,x,y);
In the first case (
b = L_maca(b,x,y)
), two copies are required—one to
move
{r3 r2}
to
{r1 r0}
for the argument, and another to move
{r3 r2}
to
{r1 r0}
to the destination. The second case (
b =
L_macb(b,x,y)
) requires no extra copies.
Note that a call to an
L_*a
function clobbers any variable declared with
an
accum_a
, and a call to an
L_*b
function clobbers any variable
declared with an
accum_b
. In the following example, the value of variable
a
is equivalent to
b
after the
L_maca
function call:
accum_a a;
accum_b b;
int x,y;
a = 0;
...
b = L_maca(b,x,y);