Ok I may sound ultra dumb I know... I'm sorry.
I was building a minimal image for my router (a TD-W8970 v1.2). Exploring with "make menuconfig" I ended up reading the "Target options" configuration page (under "Advanced configuration options (for developers)").
The default "Target optimization" string is:
-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc
I have some question about the last two parameters
"-mips32r2" is just a shortcut for "-march=mips32r2"
Now I usually saw mtune and march used in this way, tell me if I'm wrong:
- You have a set of devices that will run your compiled stuff
- That set has various ISA
- Choose march to be the "least common denominator" ISA between all the ISA that your device has
- Optional: use mtune if you want to optimize your binaries for a specific device, keeping compatibility with the whole initial set
So... (if I'm not wrong)... since I'm building a highly custom build just for my TD-W8970 should I write:
- Assuming "24kc" is more strict than "mips32r2" (IMO it will not makes sense the other way around)
- This will probably make the "mtune" useless (if you build something that works only on 24kc ISA it should already be optimized for 24kc ISA. Am I right?)
EDIT: I should use only -march=34kc read next posts to know why
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 optimizes for the processor specified by -march. By using -march and -mtune together, it is possible to generate code that runs on a family of processors, but optimize the code for one particular member of that family.
I read that too. That's why I made this thread. Why OpenWRT build system does not directly select the best march value (24kc in my case) after the target selection?
should generate faster code than
EDIT: I should use 34kc (instead of 24kc) see next post to know why.
It gets more interesting,
the techdata says
CPU: Lantiq XWAY VRX268.
The data sheet for VRX268 says
Lantiq Smart CPU Architecture • - 32-bit MIPS® 34Kc
Confirmed also by
And by "logread | grep revision" on my router (OpenWRT 18.06 branch snapshot)
CPU0 revision is: 00019556 (MIPS 34Kc)
CPU1 revision is: 00019556 (MIPS 34Kc)
Sooooo.... Should I use:
It is a supported architecture by GCC so that would be the logical thing to do. So yes.
To whomever would like to know which MIPS architecture are supported by GCC, see here:
Quick update. I've compiled a minimal version of last LEDE sources with "-march=34kc" and it seem to work perfectly. Did the same on 18.06, everything works but I didn't test it enough. Left trunk alonse since is unstable by itself right now.