void test_builtin_csqrtl(_Complex long double ld) {
  if (__builtin_csqrtl(ld) != __builtin_csqrtl(ld))
    link_failure_builtin_csqrtl();
}


x86 assembly (clang, -O0):
<test_builtin_csqrtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
fldt   (%rax)
fldt   0x10(%rax)
fxch   %st(1)
fstpt  -0x20(%rbp)
fstpt  -0x10(%rbp)
movaps -0x20(%rbp),%xmm0
movaps -0x10(%rbp),%xmm1
mov    %rsp,%rax
movaps %xmm1,0x10(%rax)
movaps %xmm0,(%rax)
call   1040 <csqrtl@plt>
mov    -0x60(%rbp),%rax
fstpt  -0x58(%rbp)
fstpt  -0x4c(%rbp)
fldt   (%rax)
fldt   0x10(%rax)
fxch   %st(1)
fstpt  -0x40(%rbp)
fstpt  -0x30(%rbp)
movaps -0x40(%rbp),%xmm0
movaps -0x30(%rbp),%xmm1
mov    %rsp,%rax
movaps %xmm1,0x10(%rax)
movaps %xmm0,(%rax)
call   1040 <csqrtl@plt>
fldt   -0x58(%rbp)
fldt   -0x4c(%rbp)
fxch   %st(1)
fucomip %st(2),%st
fstp   %st(1)
setp   %cl
setne  %al
or     %cl,%al
fucomip %st(1),%st
fstp   %st(0)
setp   %dl
setne  %cl
or     %dl,%cl
or     %cl,%al
test   $0x1,%al
jne    11b4 <test_builtin_csqrtl+0x94>
jmp    11bb <test_builtin_csqrtl+0x9b>
mov    $0x0,%al
call   1030 <link_failure_builtin_csqrtl@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_builtin_csqrtl>:
sub    $0x98,%rsp
fldt   0xa0(%rsp)
fld    %st(0)
fstpt  0x38(%rsp)
fldt   0xb0(%rsp)
fld    %st(0)
fstpt  0x2c(%rsp)
fxch   %st(1)
fstpt  0x70(%rsp)
fstpt  0x80(%rsp)
movaps 0x70(%rsp),%xmm0
movaps 0x80(%rsp),%xmm1
movaps %xmm1,0x10(%rsp)
movaps %xmm0,(%rsp)
call   1040 <csqrtl@plt>
fstpt  0x44(%rsp)
fstpt  0x20(%rsp)
fldt   0x38(%rsp)
fstpt  0x50(%rsp)
fldt   0x2c(%rsp)
fstpt  0x60(%rsp)
movaps 0x50(%rsp),%xmm0
movaps 0x60(%rsp),%xmm1
movaps %xmm1,0x10(%rsp)
movaps %xmm0,(%rsp)
call   1040 <csqrtl@plt>
fldt   0x44(%rsp)
fucomip %st(1),%st
fstp   %st(0)
jne    11bd <test_builtin_csqrtl+0x9d>
jp     11bd <test_builtin_csqrtl+0x9d>
fldt   0x20(%rsp)
fucomip %st(1),%st
fstp   %st(0)
fldz
jne    11bd <test_builtin_csqrtl+0x9d>
jp     11bd <test_builtin_csqrtl+0x9d>
fstp   %st(0)
add    $0x98,%rsp
ret
fstp   %st(0)
xor    %eax,%eax
add    $0x98,%rsp
jmp    1030 <link_failure_builtin_csqrtl@plt>

LLVM IR (-O0):
define void @test_builtin_csqrtl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16 %0) {
%2 = alloca { x86_fp80, x86_fp80 }
%3 = alloca { x86_fp80, x86_fp80 }
%4 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i32 0, i32 0
%5 = load x86_fp80, x86_fp80* %4
%6 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i32 0, i32 1
%7 = load x86_fp80, x86_fp80* %6
%8 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %2, i32 0, i32 0
%9 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %2, i32 0, i32 1
store x86_fp80 %5, x86_fp80* %8
store x86_fp80 %7, x86_fp80* %9
%10 = call { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16 %2)
%11 = extractvalue { x86_fp80, x86_fp80 } %10, 0
%12 = extractvalue { x86_fp80, x86_fp80 } %10, 1
%13 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i32 0, i32 0
%14 = load x86_fp80, x86_fp80* %13
%15 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i32 0, i32 1
%16 = load x86_fp80, x86_fp80* %15
%17 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %3, i32 0, i32 0
%18 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %3, i32 0, i32 1
store x86_fp80 %14, x86_fp80* %17
store x86_fp80 %16, x86_fp80* %18
%19 = call { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16 %3)
%20 = extractvalue { x86_fp80, x86_fp80 } %19, 0
%21 = extractvalue { x86_fp80, x86_fp80 } %19, 1
%22 = fcmp une x86_fp80 %11, %20
%23 = fcmp une x86_fp80 %12, %21
%24 = or i1 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %1
%26 = call i32 (...) @link_failure_builtin_csqrtl()
br label %27
27: ; preds = %25, %1
ret void
}

LLVM IR (-O2):
define void @test_builtin_csqrtl({ x86_fp80, x86_fp80 }* nocapture byval({ x86_fp80, x86_fp80 }) align 16 %0) {
%2 = alloca { x86_fp80, x86_fp80 }
%3 = alloca { x86_fp80, x86_fp80 }
%4 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i64 0, i32 0
%5 = load x86_fp80, x86_fp80* %4
%6 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %0, i64 0, i32 1
%7 = load x86_fp80, x86_fp80* %6
%8 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %2, i64 0, i32 0
%9 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %2, i64 0, i32 1
store x86_fp80 %5, x86_fp80* %8
store x86_fp80 %7, x86_fp80* %9
%10 = tail call { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16 %2)
%11 = extractvalue { x86_fp80, x86_fp80 } %10, 0
%12 = extractvalue { x86_fp80, x86_fp80 } %10, 1
%13 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %3, i64 0, i32 0
%14 = getelementptr inbounds { x86_fp80, x86_fp80 }, { x86_fp80, x86_fp80 }* %3, i64 0, i32 1
store x86_fp80 %5, x86_fp80* %13
store x86_fp80 %7, x86_fp80* %14
%15 = tail call { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16 %3)
%16 = extractvalue { x86_fp80, x86_fp80 } %15, 0
%17 = extractvalue { x86_fp80, x86_fp80 } %15, 1
%18 = fcmp une x86_fp80 %11, %16
%19 = fcmp une x86_fp80 %12, %17
%20 = or i1 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = tail call i32 (...) @link_failure_builtin_csqrtl()
br label %23
23: ; preds = %21, %1
ret void
}