void test_builtin_cproj(_Complex double d) {
  if (__builtin_cproj(d) != __builtin_cproj(d))
    link_failure_builtin_cproj();
}


x86 assembly (clang, -O0):
<test_builtin_cproj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <cproj@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <cproj@plt>
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movaps %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
ucomisd %xmm3,%xmm2
setne  %al
setp   %cl
or     %cl,%al
ucomisd %xmm0,%xmm1
setne  %cl
setp   %dl
or     %dl,%cl
or     %cl,%al
test   $0x1,%al
jne    11b9 <test_builtin_cproj+0x99>
jmp    11c0 <test_builtin_cproj+0xa0>
mov    $0x0,%al
call   1030 <link_failure_builtin_cproj@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_builtin_cproj>:
push   %rax
call   1040 <cproj@plt>
ucomisd %xmm1,%xmm0
jp     112e <test_builtin_cproj+0xe>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <link_failure_builtin_cproj@plt>

LLVM IR (-O0):
define void @test_builtin_cproj(double %0, double %1) {
%3 = alloca { double, double }
%4 = alloca { double, double }
%5 = alloca { double, double }
%6 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %6
%7 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %7
%8 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%9 = load double, double* %8
%10 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%11 = load double, double* %10
%12 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%13 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
store double %9, double* %12
store double %11, double* %13
%14 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%15 = load double, double* %14
%16 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
%17 = load double, double* %16
%18 = call { double, double } @cproj(double %15, double %17)
%19 = extractvalue { double, double } %18, 0
%20 = extractvalue { double, double } %18, 1
%21 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%22 = load double, double* %21
%23 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%24 = load double, double* %23
%25 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
%26 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
store double %22, double* %25
store double %24, double* %26
%27 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
%28 = load double, double* %27
%29 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
%30 = load double, double* %29
%31 = call { double, double } @cproj(double %28, double %30)
%32 = extractvalue { double, double } %31, 0
%33 = extractvalue { double, double } %31, 1
%34 = fcmp une double %19, %32
%35 = fcmp une double %20, %33
%36 = or i1 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %2
%38 = call i32 (...) @link_failure_builtin_cproj()
br label %39
39: ; preds = %37, %2
ret void
}

LLVM IR (-O2):
define void @test_builtin_cproj(double %0, double %1) {
%3 = tail call { double, double } @cproj(double %0, double %1)
%4 = extractvalue { double, double } %3, 0
%5 = extractvalue { double, double } %3, 1
%6 = fcmp uno double %4, %5
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @link_failure_builtin_cproj()
br label %9
9: ; preds = %7, %2
ret void
}