Everything

-instalign8


< Compile Options / Object Options >

[Format]

-instalign8[={loop|inmostloop}]

[Description]

-

This option aligns instructions at branch destinations.

-

When the instalign8 option is specified, the instruction at the location address is aligned to the 8-byte boundary.

-

Instruction alignment is performed only when the instruction at the specified location exceeds the address which is a multiple of the alignment value (8)*1.

-

The following three types of branch destination can be selected by specifying the suboptions of -instalign4 and -instalign8*2.

-

No specification: Head of function and case and default labels of switch statement
inmostloop: Head of each inmost loop, head of function, and case and default labels of switch statement
loop: Head of each loop, head of function, and case and default labels of switch statement

-

When these options are selected, the alignment value of the program section is changed from 1 to 4 (for instalign4) or 8 (for instalign8).

-

These options aim to efficiently operate the instruction queues of the RX CPU and improve the speed of program execution by aligning the addresses of branch destination instructions.
This option has specifications targeting the following usage.

-

instalign8: When attempting to improve the speed of CPUs with a 64-bit instruction queue (mainly RX600 Series)

Notes 1.

This is when the instruction size is equal to or smaller than the alignment value. If the instruction size is greater than the alignment value, alignment is performed only when the number of exceeding points is two or more.

Notes 2.

Alignment is adjusted only for the branch destinations listed above; alignment of the other destinations is not adjusted. For example, when loop is selected, alignment of the head of a loop is adjusted but alignment is not adjusted at the branch destination of an if statement that is used in the loop but does not generate a loop.

-

If an object module file or a standard library that has been generated through compilation without using this option is specified for linkage, the warning W0561322 will be output at linkage but program execution will have no problem.

[Example]

-

<C source file>

dlong a;
int f1(int num)
{
    return (num+1);
}
void f2(void)
{
    a = 0;
}
void f3(void)
{
}

-

<Output code>

[When compiling with -instalign8 specified]
In the example shown below, the head of each function is aligned so that the instruction does not exceed the 8-byte boundary.

In 8-byte boundary alignment of instructions, the address will not be changed unless the target instruction exceeds the 8-byte boundary. Therefore, only the address of function f2 is actually aligned.

      .SECTION P,CODE,ALIGN=8
      .INSTALIGN 8
 _f1:                     ; Function f1, address = 0000H
      ADD     #01H,R1     ; 2 bytes
      RTS                 ; 1 byte
      .INSTALIGN 8
 _f2:                     ; Function f2, address =0008H
                          ; Note: Alignment is performed.
                          ; When a 6-byte instruction is placed at
                          ; 0003H, it exceeds the 8-byte boundary.
                          ; Thus, alignment is performed.
      MOV.L   #_a,R4      ; 6 bytes
      MOV.L   #0,[R4]     ; 3 bytes
      RTS                 ; 1 byte
      .INSTALIGN 8
 _f3:                     ; Function f3, address = 0012H
       RTS
      .END