Chapter 42. Xtensa Dependent Features
241
42.3.1. Using Density Instructions
The Xtensa instruction set has a code density option that provides 16 bit versions of some of the
most commonly used opcodes. Use of these opcodes can significantly reduce code size. When pos 
sible, the assembler automatically translates generic instructions from the core Xtensa instruction set
into equivalent instructions from the Xtensa code density option. This translation can be disabled by
using specific opcodes (Section 42.2.1 Opcode Names), by using the
 no density
command line
option (Section 42.1 Command Line Options), or by using the
no density
directive (Section 42.5.1
density).
It is a good idea not to use the density instructions directly. The assembler will automatically select
dense instructions where possible. If you later need to avoid using the code density option, you can
disable it in the assembler without having to modify the code.
42.3.2. Automatic Instruction Alignment
The Xtensa assembler will automatically align certain instructions, both to optimize performance and
to satisfy architectural requirements.
When the
 target align
command line option is enabled (Section 42.1 Command Line Options),
the assembler attempts to widen density instructions preceding a branch target so that the target in 
struction does not cross a 4 byte boundary. Similarly, the assembler also attempts to align each instruc 
tion following a call instruction. If there are not enough preceding safe density instructions to align a
target, no widening will be performed. This alignment has the potential to reduce branch penalties at
some expense in code size. The assembler will not attempt to align labels with the prefixes
.Ln
and
.LM
, since these labels are used for debugging information and are not typically branch targets.
The
LOOP
family of instructions must be aligned on either a 1 or 2 mod 4 byte boundary. The assembler
knows about this restriction and inserts the minimal number of 2 or 3 byte no op instructions to satisfy
it. When no op instructions are added, any label immediately preceding the original loop will be
moved in order to refer to the loop instruction, not the newly generated no op instruction.
Similarly, the
ENTRY
instruction must be aligned on a 0 mod 4 byte boundary. The assembler satisfies
this requirement by inserting zero bytes when required. In addition, labels immediately preceding the
ENTRY
instruction will be moved to the newly aligned instruction location.
42.4. Xtensa Relaxation
When an instruction operand is outside the range allowed for that particular instruction field,
as
can
transform the code to use a functionally equivalent instruction or sequence of instructions. This pro 
cess is known as relaxation. This is typically done for branch instructions because the distance of the
branch targets is not known until assembly time. The Xtensa assembler offers branch relaxation and
also extends this concept to function calls,
MOVI
instructions and other instructions with immediate
fields.
42.4.1. Conditional Branch Relaxation
When the target of a branch is too far away from the branch itself, i.e., when the offset from the branch
to the target is too large to fit in the immediate field of the branch instruction, it may be necessary to
replace the branch with a branch around a jump. For example,
beqz
a2, L
may result in:






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

canadian web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved