Is branch prediction used in gcc for ARM and how can I turn it off?

I am compiling some binaries for ARMv8 and ARMv7 devices and I want to disable the branch predicate . I know this question was asked once ( here ), but the target was an x86 machine. I use linaro gcc for the hand.

I do this for the sake of experiment, and I do not recommend it as a practice.

I used perf to measure branch / branch instructions.

I have 2 questions:

  • Is gcc / g ++ branch prediction used for the hand?
  • How to disable it?

I tried the following options:

  • fno-branch-target-load-optimize (2) - does not affect the size of the binary, but generates another assembly. However, branch statistics are identical without using the option.
  • -fno-if-conversion (2) - The binary size is identical, the assembly is different. This increased the number of branches performed, as well as the speed of flight of the branch. It seems that the option is delivering something.
  • -fno-guess-branch-chance - Same as above, but has a lower effect.

Can I be sure that using -fno-if-conversion and -fno-guess-branch-probabilities completely disables branch prediction?

+4
source share
1 answer

After doing more research and testing, I have my answer.

ARMv7 ISA . , , . -fno-if-conversion -fno-if-conversion2. , , .

ARMv8. AArch64 ISA , . . -fno-if-conversion ( perf). , .

+1

All Articles