Which floating-point comparison?

I notice llvm provides both ordered and unordered variants of
floating-point comparison. Which of these is the right one to use by
default? I suppose the two criteria would be, in order of importance:

1. Which is more efficient (more directly maps to typical hardware)?

2. Which is more familiar (more like the way C and Fortran do it)?

I notice llvm provides both ordered and unordered variants of
floating-point comparison. Which of these is the right one to use by
default? I suppose the two criteria would be, in order of importance:

1. Which is more efficient (more directly maps to typical hardware)?

You can figure this out by looking at the output of llc:

$ cat test.ll
define i1 @less(double %x, double %y) nounwind readnone {
entry:
  %0 = fcmp ult double %x, %y ; <i1> [#uses=1]
  ret i1 %0
}
$ Debug/bin/llc <test.ll
  .section __TEXT,__text,regular,pure_instructions
  .globl _less
  .align 4, 0x90
_less: ## @less
## BB#0: ## %entry
  movsd 4(%esp), %xmm0
  ucomisd 12(%esp), %xmm0
  sbbb %al, %al
  andb $1, %al
  ret

2. Which is more familiar (more like the way C and Fortran do it)?

You can use http://llvm.org/demo/ to figure that out.

That works, thanks! It turns out that x86/SSE at least handles both
equally well, but the ordered version is what C uses.