AndeStar is 16-bit/32-bit mixable ISA from when it's born. Most of 16-bit instructions are a frequently-used subset of 32-bit instructions.
In BSP v4.0.0, we transfer 32-bit instruction to 16-bit in order to reduce code size, but for performance considerations, function and branch target's first instrucntions should be a 32-bit one because CPU fecth a 32-bit instruciton every time from memory. If function's first instructions is a 16-bit, it takes CPU one more cycle to do a function call or branch.
Follow is the behavior of BSP400 to handle this:
1. If the compiler option is "-O0" or "-Os", the compiler will generate 16-bit as far as possible including the first instruction of function and branch target.
2. For other compiler optimization option, the compiler will generate 16-bit as far as possilbe exlcuding the first instruction of function and branch target.
3. There are two pseudo-ops “.off_16bit” and “.restore_16bit” which user can use to preserve 32-bit instructions or not.
In Page 30 of document “Andes_Programming_Guide_for_ISA_V3_PG010_V1.0.pdf”, user can find the following explanation:
Attachment:
sample3.jpg [ 11.87 KiB | Viewed 16104 times ]
There is a example code for these two pesudo-ops:
Attachment:
sample1.png [ 3.24 KiB | Viewed 16104 times ]
The result is:
Attachment:
sample2.png [ 6.3 KiB | Viewed 16104 times ]
Please find the related demo project in attached file.
Attachment:
demo-int.zip [202.83 KiB]
Downloaded 1636 times