
Structured Control Statements
Statement Formatting
7-10
DSP ASSEMBLER REFERENCE MANUAL
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Note that values in the <reg1> and <reg2> data registers are not saved before expression
evaluation. This means that any user data in those registers will be overwritten each time
the expression is evaluated at runtime. The programmer should take care either to save
needed contents of the registers, reassign data registers using the
SCSREG
directive, or
not use them at all in the body of the particular structured construct being executed. The
data registers used by the structured control statements are listed in Appendix F.
7.4.2
Compound Expressions
A compound expression consists of two or more simple expressions (section 7.4.1) joined
by a logical operator (
AND
or
OR
). The boolean value of the compound expression is de-
termined by the boolean values of the simple expressions and the nature of the logical
operator. Note that the result of mixing logical operators in a compound expression is un-
defined:
.IF
.IF
X1 <GT> B
AND
<LS>
AND
R1 <NE> R2
X1 <LE> B
AND
<LC>
OR
R5 <GT> R6
;this is OK
;undefined
The simple expressions are evaluated left to right. Note that this means the result of one
simple expression could have an impact on the result of subsequent simple expressions,
because of the condition code settings stemming from the Assembler-generated com-
pare.
If the compound expression is an
AND
expression and one of the simple expressions is
found to be false, any further simple expressions are not evaluated. Likewise, if the com-
pound expression is an
OR
expression and one of the simple expressions is found to be
true, any further simple expressions are not evaluated. In these cases, the compound ex-
pression is either false or true, respectively, and the condition codes reflect the result of
the last simple expression evaluated.
7.5
STATEMENT FORMATTING
The format of structured control statements differs somewhat from normal Assembler us-
age. Whereas a standard Assembler line is split into fields separated by blanks or tabs,
with no white space inside the fields, structured control statement formats vary depending
on the statement being analyzed. In general, all structured control directives are placed
in the opcode field (with an optional label in the label field) and white space separates all
distinct fields in the statement. Any structured control statement may be followed by a
comment on the same logical line.
7.5.1
Expression Formatting
Given an expression of the form:
<op1> <LT> <op2> OR <op3> <GE> <op4>
F
Freescale Semiconductor, Inc.
n
.