## ucomisd - unordered compare scalar doubles (64 bit floating point)

    set eflags based on 2 floats

The ucomisd instruction compares the source value (second operand) to the destination (an XMM register). The source can be an XMM register or a 64 bit memory location. An unordered comparison differs from an ordered comparison in not generating an exception for QNaN (Quiet Not a Number). It can still generate an exception if either operand is a SNaN (Signaling NaN). This was what gcc generated, so it's probably a good choice.

There is no corresponding ucomipd packed singles.

You can use ptest to determine if an XMM or YMM register is 0 in 1 instruction.

            ucomisd   xmm0, xmm1        ; compare xmm0 and xmm1
            ucomisd   xmm0, [x]         ; compare xmm0 and 64 bit variable x
            ucomisd   xmm7, [rdi]       ; compare xmm7 and 64 bit value [rdi]
                                        ; rdi holds the address of a float
            ucomisd   xmm9, [x+8*rcx]   ; compare xmm9 and 64 bit element of x
                                        ; rcx contains the array index

Most of the time after a ucomiss instruction you will use a conditional jump from one of these

            ja      ; jump if above          ; means greater than
            jae     ; jump if above or equal ; means greater than or equal
            jb      ; jump if below          ; means less than
            jbe     ; jump if below or equal ; means less than or equal
            je      ; jump if equal
            jne     ; jump if not equal
            jna     ; jump if not above            ; jbe
            jnae    ; jump if not above or equal   ; jb
            jnb     ; jump if not below            ; jae
            jnbe    ; jump if not below or equal   ; ja

### flags: ZF PF CF OF SF AF

ZF is set if the operands were equal. CF is set if the first operand is less than the second. PF is set if one of the operands is NaN and then all three are set to 1. OF, SF and AF are all set to 0. I can't yet guess why they chose to use CF rather than SF. Had they used SF the mnemonics for integer and floating point conditions would be the same.