# Linux Kernel Module Cheat

#### 29.3.4. x86 CMOVcc instructions

- userland/arch/x86_64/cmovcc.S: CMOVcc

mov if a condition is met:

    CMOVcc a, b

Equals:

    if(flag) a = b

where `cc` are the same flags as Jcc.

Vs jmp:

- https://stackoverflow.com/questions/14131096/why-is-a-conditional-move-not-vulnerable-for-branch-prediction-failure

- https://stackoverflow.com/questions/27136961/what-is-it-about-cmov-which-improves-cpu-pipeline-performance

- https://stackoverflow.com/questions/26154488/difference-between-conditional-instructions-cmov-and-jump-instructions

- https://stackoverflow.com/questions/6754454/speed-difference-between-if-else-and-ternary-operator-in-c?lq=1#comment8007791_6754495

Not necessarily faster because of branch prediction.

This is partly why the ternary `?` C operator exists: https://stackoverflow.com/questions/3565368/ternary-operator-vs-if-else

It is interesting to compare this with ARMv7 conditional execution: which is available for all instructions, as shown at: Section 30.2.5, “ARM conditional execution”.