Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the different between -mtune=i486 and -arch=i486

I have an old code need compiled with -m486 flag in GCC. But there is no that flag. Then I found -mtune=i486 and -arch=i486
I have read this page. But still don't know which is the best one for -m486?

like image 242
madper Avatar asked Oct 17 '12 07:10

madper


1 Answers

The -march option defines the list of instructions that may be used, the -mtune option modifies the optimization process afterwards.

You would normally use -march to specify the minimum requirements, and -mtune to optimize for what the majority of users have.

For example, the IA32 architecture defines various instructions for string handling and repetition of instructions. On the 386 and 486, these are faster and smaller than explicit assembler code because the instruction fetch and decode stages can be skipped, while on newer models, these instructions clog up the instruction pipeline as each processing step is immediately dependent on the previous, so the CPU's parallel execution functionality goes to waste.

Linux distributions typically use -march=i486 -mtune=i686 to ensure that you can still install and run on a 486, but as the majority of users have modern CPUs, the focus is on making it run optimally for these.

like image 159
Simon Richter Avatar answered Oct 13 '22 20:10

Simon Richter