
In-line Assembly Code
Motorola
Mixing C and Assembly Language
For More Information On This Product,
Go to: www.freescale.com
5-5
5.2.2 Output/Input Operands
The operand list is a concatenation of output and input operands which the OES can access
via the operand_id_number (see Section 5.2.1). Output or input operands consist of
operands separated by a comma (‘,’). Each operand should be associated with a C
expression and its operand constraint described below.
A colon, ‘:’, is used to separate the assembler instruction template from the first output
operand. A second colon separates the final output operand from the first input operand. A
third colon can be used to separate the input operands from the optional field
reg_save
.
Two consecutive colons are required when only input operands are needed in the operand
list, leaving us with the empty list of output operands.
The operand syntax is:
“[=]operand_constraint” (C_expression)
where:
1.
=
differentiates input and output operands. All output operands must use this
character first.
2.
operand constraint
is a single character that describes the type of resource
(memory or register) that an operand is to be loaded into or read from. Each
operand constraint has an optional set of modifiers that may be applied in the
instruction template.
3. C_expression is any valid C expression defined by the ANSI C standard. The C
expression can be either l-value or r-value. Any output operand should use the
l-value to specify the memory location to store the data.
The available operand constraints are “
A
”, “
D
”, “
R
”, “
S
”, “
i
” and “
m
”. All of these
constraints originate from the DSP56000 family architecture; therefore, a full
understanding of these constraints requires that the programmer understand this
architecture. The constraints are:
A
—One of the Address Registers (
rx
, where x = 0 through 7; see Section 5 of
the
DSP56000 Family User’s Manual
) will be allocated to the C expression (see
“OES modifier j: The following in-line assembly code is used to generate
executable assembly code. Notice that the actual register selection is totally
dependent on the C compiler but the register selected (r3 in this example) is
guaranteed to be related to the C expression used (in this case cptr, see Section
5.2).” on page 10). The C expression will be promoted to this register. Typically
the C expression should be a pointer to be assigned to an address register. The
OES modifier,
j
, can only be associated with operand constraint
A
(see Section
5.2.1).
F
Freescale Semiconductor, Inc.
n
.