void test_float_builtins(float F, double D, long double LD) {
  volatile int res;
  res = __builtin_isinf(F);
  res = __builtin_isinf(D);
  res = __builtin_isinf(LD);
  res = __builtin_isinf_sign(F);
  res = __builtin_isinf_sign(D);
  res = __builtin_isinf_sign(LD);
  res = __builtin_isfinite(F);
  res = __builtin_isnormal(F);
}


x86 assembly (clang, -O0):
<test_float_builtins>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
fstpt  -0x20(%rbp)
movss  -0x4(%rbp),%xmm0
movaps 0xef0(%rip),%xmm5
pand   %xmm5,%xmm0
movss  0xed8(%rip),%xmm2
ucomiss %xmm2,%xmm0
setae  %al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
movapd 0xedb(%rip),%xmm3
pand   %xmm3,%xmm0
movsd  0xedf(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
fldt   -0x20(%rbp)
fabs
flds   0xe9b(%rip)
fxch   %st(1)
fucomip %st(1),%st
setae  %al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
movss  -0x4(%rbp),%xmm4
movaps %xmm4,%xmm0
pand   %xmm5,%xmm0
movmskps %xmm4,%edx
shl    $0x1f,%edx
not    %edx
shr    $0x1f,%edx
xor    %eax,%eax
ucomiss %xmm2,%xmm0
mov    %edx,%ecx
lea    -0x1(%rcx,%rcx,1),%edx
mov    %eax,%ecx
cmovae %edx,%ecx
mov    %ecx,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm2
movaps %xmm2,%xmm0
pand   %xmm3,%xmm0
movq   %xmm2,%rcx
test   %rcx,%rcx
setns  %cl
ucomisd %xmm1,%xmm0
movzbl %cl,%edx
mov    %edx,%ecx
lea    -0x1(%rcx,%rcx,1),%edx
mov    %eax,%ecx
cmovae %edx,%ecx
mov    %ecx,-0x24(%rbp)
fldt   -0x20(%rbp)
fld    %st(0)
fstpt  -0x30(%rbp)
movswq -0x28(%rbp),%rcx
fabs
test   %rcx,%rcx
setns  %cl
fucomip %st(1),%st
fstp   %st(0)
movzbl %cl,%edx
mov    %edx,%ecx
lea    -0x1(%rcx,%rcx,1),%ecx
cmovae %ecx,%eax
mov    %eax,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
movaps 0xe10(%rip),%xmm1
pand   %xmm1,%xmm0
movss  0xdf8(%rip),%xmm1
ucomiss %xmm1,%xmm0
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
movss  -0x4(%rbp),%xmm1
ucomiss %xmm1,%xmm1
setnp  %al
movaps 0xde4(%rip),%xmm0
pand   %xmm0,%xmm1
movss  0xdcc(%rip),%xmm0
ucomiss %xmm0,%xmm1
setb   %dl
movss  0xdba(%rip),%xmm0
ucomiss %xmm1,%xmm0
setbe  %cl
and    %dl,%al
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_float_builtins>:
fldt   0x8(%rsp)
fld    %st(0)
fstpt  -0x18(%rsp)
movswq -0x10(%rsp),%rdi
movaps 0xee9(%rip),%xmm2
movq   %xmm1,%rcx
pand   0xeec(%rip),%xmm1
movmskps %xmm0,%eax
and    $0x1,%eax
neg    %eax
or     $0x1,%eax
xor    %edx,%edx
test   %rcx,%rcx
setns  %dl
xor    %r8d,%r8d
xor    %r11d,%r11d
ucomisd 0xedb(%rip),%xmm1
setae  %r11b
fabs
lea    -0x1(%rdx,%rdx,1),%r10d
cmovb  %r8d,%r10d
xor    %ecx,%ecx
test   %rdi,%rdi
setns  %cl
flds   0xec6(%rip)
xor    %edi,%edi
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %dil
lea    -0x1(%rcx,%rcx,1),%ecx
cmovb  %r8d,%ecx
ucomiss %xmm0,%xmm0
andps  %xmm0,%xmm2
setnp  %r9b
xor    %edx,%edx
xor    %esi,%esi
ucomiss 0xe9d(%rip),%xmm2
setae  %dl
mov    %edx,-0x1c(%rsp)
mov    %r11d,-0x1c(%rsp)
cmovb  %r8d,%eax
mov    %edi,-0x1c(%rsp)
mov    %eax,-0x1c(%rsp)
mov    %r10d,-0x1c(%rsp)
mov    %ecx,-0x1c(%rsp)
setne  %sil
mov    %esi,-0x1c(%rsp)
setb   %al
movss  0xe6d(%rip),%xmm0
ucomiss %xmm2,%xmm0
setbe  %cl
and    %r9b,%cl
and    %al,%cl
movzbl %cl,%eax
mov    %eax,-0x1c(%rsp)
ret

LLVM IR (-O0):
define void @test_float_builtins(float %0, double %1, x86_fp80 %2) {
%4 = alloca float
%5 = alloca double
%6 = alloca x86_fp80
%7 = alloca i32
store float %0, float* %4
store double %1, double* %5
store x86_fp80 %2, x86_fp80* %6
%8 = load float, float* %4
%9 = call float @llvm.fabs.f32(float %8)
%10 = fcmp oeq float %9, 0x7FF0000000000000
%11 = zext i1 %10 to i32
store volatile i32 %11, i32* %7
%12 = load double, double* %5
%13 = call double @llvm.fabs.f64(double %12)
%14 = fcmp oeq double %13, 0x7FF0000000000000
%15 = zext i1 %14 to i32
store volatile i32 %15, i32* %7
%16 = load x86_fp80, x86_fp80* %6
%17 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %16)
%18 = fcmp oeq x86_fp80 %17, 0xK7FFF8000000000000000
%19 = zext i1 %18 to i32
store volatile i32 %19, i32* %7
%20 = load float, float* %4
%21 = call float @llvm.fabs.f32(float %20)
%22 = fcmp oeq float %21, 0x7FF0000000000000
%23 = bitcast float %20 to i32
%24 = icmp slt i32 %23, 0
%25 = select i1 %24, i32 -1, i32 1
%26 = select i1 %22, i32 %25, i32 0
store volatile i32 %26, i32* %7
%27 = load double, double* %5
%28 = call double @llvm.fabs.f64(double %27)
%29 = fcmp oeq double %28, 0x7FF0000000000000
%30 = bitcast double %27 to i64
%31 = icmp slt i64 %30, 0
%32 = select i1 %31, i32 -1, i32 1
%33 = select i1 %29, i32 %32, i32 0
store volatile i32 %33, i32* %7
%34 = load x86_fp80, x86_fp80* %6
%35 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %34)
%36 = fcmp oeq x86_fp80 %35, 0xK7FFF8000000000000000
%37 = bitcast x86_fp80 %34 to i80
%38 = icmp slt i80 %37, 0
%39 = select i1 %38, i32 -1, i32 1
%40 = select i1 %36, i32 %39, i32 0
store volatile i32 %40, i32* %7
%41 = load float, float* %4
%42 = call float @llvm.fabs.f32(float %41)
%43 = fcmp one float %42, 0x7FF0000000000000
%44 = zext i1 %43 to i32
store volatile i32 %44, i32* %7
%45 = load float, float* %4
%46 = fcmp oeq float %45, %45
%47 = call float @llvm.fabs.f32(float %45)
%48 = fcmp ult float %47, 0x7FF0000000000000
%49 = fcmp uge float %47, 0x3810000000000000
%50 = and i1 %46, %48
%51 = and i1 %50, %49
%52 = zext i1 %51 to i32
store volatile i32 %52, i32* %7
ret void
}

LLVM IR (-O2):
define void @test_float_builtins(float %0, double %1, x86_fp80 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = tail call float @llvm.fabs.f32(float %0)
%7 = fcmp oeq float %6, 0x7FF0000000000000
%8 = zext i1 %7 to i32
store volatile i32 %8, i32* %4
%9 = tail call double @llvm.fabs.f64(double %1)
%10 = fcmp oeq double %9, 0x7FF0000000000000
%11 = zext i1 %10 to i32
store volatile i32 %11, i32* %4
%12 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %2)
%13 = fcmp oeq x86_fp80 %12, 0xK7FFF8000000000000000
%14 = zext i1 %13 to i32
store volatile i32 %14, i32* %4
%15 = bitcast float %0 to i32
%16 = icmp sgt i32 %15, -1
%17 = select i1 %16, i32 1, i32 -1
%18 = select i1 %7, i32 %17, i32 0
store volatile i32 %18, i32* %4
%19 = bitcast double %1 to i64
%20 = icmp slt i64 %19, 0
%21 = select i1 %20, i32 -1, i32 1
%22 = select i1 %10, i32 %21, i32 0
store volatile i32 %22, i32* %4
%23 = bitcast x86_fp80 %2 to i80
%24 = icmp slt i80 %23, 0
%25 = select i1 %24, i32 -1, i32 1
%26 = select i1 %13, i32 %25, i32 0
store volatile i32 %26, i32* %4
%27 = fcmp one float %6, 0x7FF0000000000000
%28 = zext i1 %27 to i32
store volatile i32 %28, i32* %4
%29 = fcmp ord float %0, 0.000000e+00
%30 = fcmp ult float %6, 0x7FF0000000000000
%31 = fcmp uge float %6, 0x3810000000000000
%32 = and i1 %29, %30
%33 = and i1 %31, %32
%34 = zext i1 %33 to i32
store volatile i32 %34, i32* %4
ret void
}