FCMOV
Encyclopedia
FCMOV is a floating point conditional move opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...

 of the Intel x86 architecture, first introduced in Pentium Pro
Pentium Pro
The Pentium Pro is a sixth-generation x86 microprocessor developed and manufactured by Intel introduced in November 1, 1995 . It introduced the P6 microarchitecture and was originally intended to replace the original Pentium in a full range of applications...

 processors. It copies the contents of one of the floating point stack register, depending on the contents of EFLAGS
FLAGS register (computing)
The FLAGS register is the status register in Intel x86 microprocessors that contains the current state of the processor. This register is 16 bits wide. Its successors, the EFLAGS and RFLAGS registers, are 32 bits and 64 bits wide, respectively...

 integer flag register, to the ST(0) (top of stack) register. There are 8 variants of the instruction selected by the condition codes that need be set for the instruction to perform the move.

Similar to the CMOV instruction, FCMOV allows to perform some conditional operations without the usual branching
Branch (computer science)
A branch is sequence of code in a computer program which is conditionally executed depending on whether the flow of control is altered or not . The term can be used when referring to programs in high level languages as well as program written in machine code or assembly language...

 overhead. However, it has a higher latency
Latency (engineering)
Latency is a measure of time delay experienced in a system, the precise definition of which depends on the system and the time being measured. Latencies may have different meaning in different contexts.-Packet-switched networks:...

 than conditional branch instructions. Therefore, it is most useful for simple yet unpredictable comparison or conditional operations, where it can provide substantial performance gains.

The instruction is usually used with the FCOMI instruction or the FCOM-FSTSW-SAHF idiom to set the relevant condition codes based on the result of a floating point comparison.

Variants

This table shows the variants of the FCMOV instructions. In the Opcode column, i denotes the number of the floating point stack register used as the second operand (the first is always the ST(o) register - the top of the stack). Add it to the given number to obtain the corresponding opcode.
Opcode Mnemonic Meaning Condition
DA C0+i FCMOVB Move if below Carry flag
Carry flag
In computer processors the carry flag is a single bit in a system status register used to indicate when an arithmetic carry or borrow has been generated out of the most significant ALU bit position...

 set
DA C8+i FCMOVE Move if equal Zero flag set
DA D0+i FCMOVBE Move if below or equal Carry flag or Zero flag set
DA D8+i FCMOVU Move if unordered Parity flag
Parity flag
In computer processors the parity flag indicates if the number of set bits is odd or even in the binary representation of the result of the last operation. It is normally a single bit in a processor status register....

set
DB C0+i FCMOVNB Move if not below Carry flag cleared
DB C8+i FCMOVNE Move if not equal Zero flag cleared
DB D0+i FCMOVNBE Move if not below or equal Carry flag and Zero flag cleared
DB D8+i FCMOVNU Move if not unordered Parity flag cleared

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK