8-28
EPSOn
S5U1C17001C ManUal
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
8 aSSEMBlEr
sjr
xx
/
xjr
xx
instructions
Branch distance = -128 to 126:
The extended instruction is expanded with no
ext
used.
Branch distance = -1,048,576 to -130 or 128 to 1,048,574:
The extended instruction is expanded with one
ext
used.
Branch distance = -16,777,216 to -1,048,578 or 1,048,576 to 16,777,214:
The extended instruction is expanded with two
ext
used.
Note that
ext
instructions may be removed even in a case other than "
ext 0
". In the example below, no
ext
instruction is required since operand 3 will be automatically sign extended if all the bits of operands 1
and 2 and the MSB of operand 3 are 1. In this case, the added
ext
instructions are removed.
Example:
L1:
nop
xjrgt L1 ;
(L1 - branch address - 2) >> 1
→
-2
Before optimization
After optimization
nop
nop
ext 0x7
←
operand 1 (
imm3
)
jrgt 0x7e
ext 0x1fff
←
operand 2 (
imm13
)
jrgt 0x7c
←
operand 3 (
sign7
)
Optimization 4: for absolute branch instructions (
scalla
/
xcalla
/
sjpa
/
xjpa
instructions)
Example:
sub:
ret
main:
xsub.a %sp,0x4
:
xcalla sub
add.a %sp,0x4
ret
The assembler obtains the destination address (
sub
) from the dump and map files and determines the
number of
ext
instructions to be used directly from the destination address.
Destination address = 0 to 0x7f:
The extended instruction is expanded with no
ext
used.
Destination address = 0x80 to 0xfffff: The extended instruction is expanded with one
ext
used.
Destination address = 0xfffff to 0xffffff: The extended instruction is expanded with two
ext
used.
Optimization 5: when the operand is an expression using a symbol
Example:
sub:
ret
main:
xsub.a %sp,0x4
:
xldb %r0,[sub+0x2]
add.a %sp,0x4
ret
The assembler evaluates the expression in the operand and determines the number of
ext
instructions to be
used.
Evaluation result = 0 to 0x7f:
The extended instruction is expanded with no
ext
used.
Evaluation result = 0x80 to 0xfffff: The extended instruction is expanded with one
ext
used.
Evaluation result = 0xfffff to 0xffffff: The extended instruction is expanded with two
ext
used.
Summary of Contents for S5U1C17001C
Page 6: ......
Page 17: ...1 General S5U1C17001C Manual 1 General ...
Page 18: ......
Page 21: ...1 2 Install S5U1C17001C Manual 2 Installation ...
Page 22: ......
Page 29: ...3 SoftDev S5U1C17001C Manual 3 Software Development Procedures ...
Page 30: ......
Page 103: ...4 SrcFiles S5U1C17001C Manual 4 Source files ...
Page 104: ......
Page 121: ...5 IDE S5U1C17001C Manual 5 gnU17 iDE ...
Page 122: ......
Page 365: ...6 Compiler S5U1C17001C Manual 6 C Compiler ...
Page 366: ......
Page 385: ...7 Library S5U1C17001C Manual 7 library ...
Page 386: ......
Page 405: ...8 Assemblr S5U1C17001C Manual 8 assembler ...
Page 406: ......
Page 439: ...9 Linker S5U1C17001C Manual 9 linker ...
Page 440: ......
Page 449: ...10 Debugger S5U1C17001C Manual 10 Debugger ...
Page 450: ......
Page 626: ...11 Tools S5U1C17001C Manual 11 Other Tools ...
Page 627: ......
Page 696: ...S1C17 Family C Compiler Package Quick Reference Reference ...