What is the significance of the CMOV CPU instruction?

8,778

Solution 1

The CMOV instruction is a predicated (or conditional) move instruction. It combines a branch and move instruction into one opcode.

The CMOV instruction is useful in compiler optimization because it helps remove some of the conditional jump instructions from the code. This is important in modern superscalar processors because many instruction are in flight and executed in parallel and a conditional jump instruction would make it harder to predict whether code should be executed or not until the branch is resolved.

Solution 2

When source code is compiled for the 686 architecture with gcc and the -march flag, gcc will sometimes generate object code which contains the CMOV instruction. That is because CMOV was an instruction which came with the original 686 architecture which was released 15 years ago.

A handful of processors which claim to be 686 compatible do not support this instruction. Thus, a lot of work has to be done to deal with the handful of chips that do not support this standard instruction which has been around for over 15 years and is part of the original 686 architecture any how. The Ubuntu kernel team has a limited amount of time, and decided it is no longer worth their time to continue supporting supposedly 686 compatible processors which have not been able over the past 15 years to include this instruction which is part of the core 686 instruction set.

There's nothing particularly special about the CMOV command itself, other than it was not an instruction in pre-i686 architecture (i486, i586 etc.) and that some supposedly i686 compatible chips do not have the instruction.

Share:
8,778

Related videos on Youtube

ΤΖΩΤΖΙΟΥ
Author by

ΤΖΩΤΖΙΟΥ

Updated on September 17, 2022

Comments

  • ΤΖΩΤΖΙΟΥ
    ΤΖΩΤΖΙΟΥ over 1 year

    Ubuntu 10.10 has dropped support for i586 and lesser processors, along with i686 processors that do not support the CMOV instruction (Conditional MOVe, AFAIK).

    What is so special about the CMOV command? It even has a flag of its own in the flags : line of /proc/cpuinfo.

  • koushik
    koushik over 13 years
    Very informative. Where can I get details about which of the so-called i686 compatible chips do not support this ? Any link to ubuntu kernel team website that has more info (like what a user / packager can do to deal with this) ?
  • Dennis Sheil
    Dennis Sheil over 13 years
    koushik - this discussion log from IRC should answer some of your questions - irclogs.ubuntu.com/2010/06/18/%23ubuntu-kernel.html#t14:16
  • ΤΖΩΤΖΙΟΥ
    ΤΖΩΤΖΙΟΥ over 13 years
    Thanks, Dennis. I still feel that there's something more to it, based on this article, and I quote: “CMOV instructions heavily used in compiler optimization”. Unless sb else comes up with something more detailed, please include this link in your answer and I'll accept it.
  • ΤΖΩΤΖΙΟΥ
    ΤΖΩΤΖΙΟΥ over 13 years
    Ah, just like the conditionals in ARM and ia64 architectures, in this case applying only to a move instruction. Thank you.
  • Milan
    Milan over 12 years
    @ΤΖΩΤΖΙΟΥ: See also blueraja.com/blog/285/…