I read about this
http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html
-mtune=arch
Optimize for arch. Among other things, this option controls the way instructions are scheduled, and the perceived cost of arithmetic operations. The list of arch values is the same as for -march.
When this option is not used, GCC will optimize for the processor specified by -march. By using -march and -mtune together, it is possible to generate code that will run on a family of processors, but optimize the code for one particular member of that family.
`-mtune' defines the macros `_MIPS_TUNE' and `_MIPS_TUNE_foo', which work in the same way as the `-march' ones described above.
This is the gist of the thread:
By using -march and -mtune together, it is possible to generate code that will run on a family of processors, but optimize the code for one particular member of that family.
You check what feature is supported by your SoC by consoling into your router and issuing the following command:
root@OpenWrt:/# cat /proc/cpuinfo
system type : Ralink RT3052 id:1 rev:3
machine : Aztech HW550-3G
processor : 0
cpu model : MIPS 24KEc V4.12
BogoMIPS : 255.59
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0000, 0x0740, 0x0100, 0x00c0]
ASEs implemented : mips16 dsp
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
Go to
http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html
See which -march flag matches the closest to the SoC you have.
The above example would be '-mtune 24kec' and you can add '-mdsp' to optimize for dsp (Digital Signal Processing)
-------------------------- In Theory Not Tested -----------------------------------------------
Some SoC have 'mt'(Multithreading) in the ASE.
http://www.mips.com/products/architectures/mips-mt-ase/
You can add -mmt to the flag
You can also do 'make kernel_menuconfig' and enable multithreading in kernel config
---------------------------------------------------------------------------------------------------
I have been using modified -mtune flags so far no issues regarding stability is observed.
So I compiled 2 images 1 with the normal -mtune=mips32r2 and 1 with the -mtune=24kc (For the TP-Link WR1043ND)
First I ran md5checksum to confirm that different code was emitted and sure enough the checksums were different.
Next I ran the openssl benchmark
-mtune=mip32r2 | 1.0.0g | 21405770 | 6854610 | 4664930 | 2842120 | 2909780 | 1034830 | 4920130 | 4270740 | 3777190 | 3.5 | 121.4 | 12.2 | 10.1 |
-mtune=24kc | 1.0.0g | 21521180 | 6969730 | 4764010 | 2889050 | 3114950 | 1105850 | 5409050 | 4683250 | 4176140 | 4.4 | 153.3 | 15.4 | 12.6 |
Anyone wants to confirm my results?
To verify the difference accurately
-Keep all other variables constant like: Trunk Version, Packages Selected, Default Configuation
-Change only the CFLAGs
(Last edited by alphasparc on 16 Apr 2012, 16:51)