I am compiling some binaries for an ARMv8 and ARMv7 devices and I want to disable the branch predication. I know this question has been asked once (here) but the target was an x86 machine. I'm using a linaro gcc for arm.
I'm doing this for experiment sake and I don't recommend this as a practice.
I have used perf to measure branch instructions / branch misses count.
So I have 2 questions:
- Is branch predication utilised gcc/g++ for arm?
- How can I disable it?
I have tried the following options:
- fno-branch-target-load-optimize(2) - No effect on the binary size but generated different assembly. However the branch statistics are identical as without using the option.
- -fno-if-conversion(2) - Binary size identical, assembly different. This increased the number of branches being executed and also the branch miss rate. It appears that the option dose something.
- -fno-guess-branch-probability - Same as above but it had lower impact.
So can I be sure that using -fno-if-conversion and -fno-guess-branch-probability are completely disabling branch predication?