#include <limits.h> #include <math.h> #include <stdlib.h> int func(double x, double y) { if (isunordered(x, y)) return INT_MIN; if (islessgreater(x, y)) return x > y ? 1 : -1; return 0; } https://godbolt.org/z/fPxT3qfPG
x86-64 clang 21.1.0 with -Os option produces:
func: ucomisd xmm0, xmm1 jp .LBB0_1 ucomisd xmm0, xmm1 je .LBB0_3 seta al movzx eax, al lea eax, [2*rax - 1] ret .LBB0_3: xor eax, eax ret .LBB0_1: mov eax, -2147483648 ret
Note the duplicate UCOMISD instructions.