Assembling VLE Instructions

The mnemonics for VLE (Variable Length Encoding) instructions begin with "se_" or "e_". The compiler's inline assembler recognizes these mnemonics when the compiler is configured to generate VLE object code.

Only a subset of EIS instructions have equivalent VLE instructions. To save you time and effort, the inline assembler can convert regular EIS instructions to equivalent VLE instructions automatically. In other words, the inline assembler can generate VLE object code from inline assembly statements that use only regular mnemonics. Controlling VLE inline assembly shows how to control VLE code generation for inline assembly statements.

Table 1. Controlling VLE inline assembly
To control this option from here... use this setting
CodeWarrior IDE

Select Zen in the Processor drop-down list box of the Properties > C/C++ Build > Settings > Tool Settings > PowerPC CPU panel, then check Translate PPC Asm to VLE ASM (Zen) in Properties > C/C++ Build > Settings > Tool Settings > PowerPC Compiler > Processor panel.

command line -ppc_asm_to_vle

The stand-alone assembler also recognizes and generates VLE instructions. Controlling VLE code generation for the standalone assembler shows how to control VLE code generation with the standalone assembler.

Table 2. Controlling VLE code generation for the standalone assembler
To control this option from here... use this setting
CodeWarrior IDE

Select Zen in the Processor drop-down list box of the Properties > C/C++ Build > Settings > Tool Settings > PowerPC CPU panel, then check Generate VLE ISEL Instructions in Properties > C/C++ Build > Settings > Tool Settings > PowerPC Compiler > Processor panel.

command line -vle

To specify that a section containing executable code should be executed in the processor's VLE mode, use the text_vle identifier with the .section directive. Examples of specifying VLE sections in standalone assembly shows examples.

Figure 1. Examples of specifying VLE sections in standalone assembly
.section .text_vle # Section name is .text_vle
.section .text,text_vle # Section name is .text
.section .littletext,text_vle # Section name is .littletext

Unlike the inline assembler, the standalone assembler does not offer the option to convert regular instruction mnemonics to VLE instructions. To perform this conversion automatically, copy and paste standalone assembly source code into a C or C++ source file, shown in Using automatic VLE instruction conversion .

Figure 2. Using automatic VLE instruction conversion
extern asm void my_func(void)
{
    nofralloc /* No stack frame. */
    /* Paste standalone assembly source code here. */
}