|Disable push25/pop25 in BSP400
|Page 1 of 1|
|Author:||HuJin [ Thu Apr 02, 2015 10:09 pm ]|
|Post subject:||Disable push25/pop25 in BSP400|
AndeStar has been evolved to V3(the third generation). V3 has more better code size advantage than V2 because we design some new instructons. One example is push25 & pop25, both are 16 bits instructions and can handle prolog and epilog while in V2 compiler has to use 32 bit instruction( smw & lmw) to do the same work.
But push25 hasn't much transformation as smw(it is only 16 bits length), it will store at least 4 GPRs($r6,$gp,$fp,$lp) to stack. For there is a kind of sub function which only needs to save $lp as it doesn't touch other GPR at all. Now compiler in BSP400 has introduced two option "-mno-v3push/-mv3push" to let user to handle this case for different purpose.
First, let's introduce the behavior of BSP400 about the two options:
When optimazation level is "-Os", -mv3push” is implied used, compiler will default use push25 to do prolog. When set "-mno-v3push", compiler will use smw.adw instead.
When optimazation level is other, "-mno-v3push" is implied used, compiler will default use smw.adw to do porlog, when set "-mv3push",compiler will use push25 instead.
For example we can set "-mno-v3push" in AndeSight as:
pic1.png [ 15.99 KiB | Viewed 5741 times ]
Compile will use smw instruction as:
pic2.png [ 1.35 KiB | Viewed 5741 times ]
pic.png [ 1.3 KiB | Viewed 5741 times ]
Second, with this background, for function which is frequently called and dosen't touch any GPR we can set different optimization level for it to improve performance. The example code is:
int func (… )
If there are more functions needs to set "-O3", the C code can be as:
#pragma GCC push_options
#pragma GCC optimize ("O3")
int funcA (... )
int funcB (... )
#pragma GCC pop_options
|Page 1 of 1||All times are UTC + 8 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group