Andes Workshop
http://forum.andestech.com/

Partial Optimization
http://forum.andestech.com/viewtopic.php?f=23&t=799
Page 1 of 1

Author:  cindy [ Fri Feb 07, 2014 3:23 pm ]
Post subject:  Partial Optimization

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 9678 times ]

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

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



Example:
Attachment:
demo-int-set-os.zip [128.8 KiB]
Downloaded 923 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 989 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;
}

Author:  jerry [ Tue Nov 18, 2014 6:42 pm ]
Post subject:  Re: Partial Optimization

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

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/