Andes Workshop

It is currently Thu Mar 28, 2024 8:34 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Disable push25/pop25 in BSP400
PostPosted: Thu Apr 02, 2015 10:09 pm 
Offline

Joined: Fri May 04, 2012 6:49 am
Posts: 17
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:
Attachment:
pic1.png
pic1.png [ 15.99 KiB | Viewed 13163 times ]

Compile will use smw instruction as:
Attachment:
pic2.png
pic2.png [ 1.35 KiB | Viewed 13163 times ]

other than
Attachment:
pic.png
pic.png [ 1.3 KiB | Viewed 13163 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:

__attribute__((optimize("O3")))
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


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group