Andes Workshop

It is currently Thu Mar 28, 2024 9:46 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Partial Optimization
PostPosted: Fri Feb 07, 2014 3:23 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
There are several ways to set partial optimization.

(1) set individual file optimization:
Right click on one file, then set its optimization
Attachment:
1.png
1.png [ 16.25 KiB | Viewed 9672 times ]

Attachment:
2.png
2.png [ 77.89 KiB | Viewed 9271 times ]

Attachment:
3.png
3.png [ 7.38 KiB | Viewed 9271 times ]



Example:
Attachment:
demo-int-set-os.zip [128.8 KiB]
Downloaded 922 times


(2)
Syntax:
http://gcc.gnu.org/onlinedocs/gcc/Funct ... agmas.html

#pragma GCC push_options
#pragma GCC optimize ("O0")


// code ...
#pragma GCC pop_options

Reference: (Chinese page)
viewtopic.php?f=16&t=225&p=296

Example:
Attachment:
demo-int-pragma.zip [128.9 KiB]
Downloaded 987 times


(3)
Optimize single function to specific optimization level.
In the following code, it is set as -Os.

void __attribute__ ((optimize("Os"))) __cpu_init()
{
unsigned int tmp;

/* turn on BTB */
tmp = 0x0;
__nds32__mtsr(tmp, NDS32_SR_MISC_CTL);


/* Set PSW INTL to 0 */
tmp = __nds32__mfsr(NDS32_SR_PSW);
tmp = tmp & 0xfffffff9;
/* ....*/
return;
}


Top
 Profile Send private message E-mail  
 
 Post subject: Re: Partial Optimization
PostPosted: Tue Nov 18, 2014 6:42 pm 
Offline

Joined: Thu Apr 03, 2014 10:09 am
Posts: 42
About the optimize("Ox") , optimize level is a limitation that no support "Os1" and "Os2". Because the "Os1" and "Os2" are defined by Andes not standard GCC optimize level.

(2)
Syntax:
http://gcc.gnu.org/onlinedocs/gcc/Funct ... agmas.html

#pragma GCC push_options
#pragma GCC optimize ("O0")

// code ...
#pragma GCC pop_options


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

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 16 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