Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Russell_B_1
Beginner
120 Views

Compiler Optimization level

I am running Microcontroller Studio with Quark SE C1000

How do I change the Optimization level of the Compiler?

At this point it is extremely nonexistent.

ebx  = ndata                      register uint32_t ndata;

 if((ndata & 0x20) == 0)                   // test data bit

40030184:   mov     %ebx,%eax

40030186:   and     $0x20,%eax

40030189:   test    %eax,%eax

4003018b:   jne     0x400301b7 <main+365>

 

and     $0x20,%eax     The OF and CF flags are cleared; the SF, ZF, and PF flags are set according to the result. The state of the AF flag is undefined.

test    %eax,%eax             is unnecessary it does the same thing and AND without changing the destination

 

The following code does the same thing

 if((ndata & 0x20) == 0)                   // test data bit

test    $0x20,%ebx

jne     0x400301b7 <main+365>

It runs 2.6 times faster.

 

0 Kudos
2 Replies
Richard_A_Intel
Employee
120 Views

Russell,

By default the tools build the project in debug mode to provide the user with detailed debug information.  If you want to build your project with optimizations turned on this you can select in from the drop down menu by the hammer icon as shown here:

Debug and Release Menu

This will disable your debug information in the build and turn on a set of preconfigured optimizations.  If you would like to customize what those settings are then you can do so from the projects Makefile as I described in this FAQ: https://software.intel.com/en-us/intel-system-studio-microcontrollers-support/faq#compiler-settings

Thank you,
Richard 

 

John_D_Intel
Employee
120 Views

Hey Richard, a related question: for a Zephyr project:  If I want to disable optimization for debugging, even if I select the Build Debug in the hammer it doesn't do it.    Then if I add this zephyr configuration option to the prj.conf the project gets halted in kernel files.   CONFIG_COMPILER_OPT="-O0"           #disable optimization causes project to halt

Thanks

John

 

 

Reply