void test_csqrtf(_Complex float f) {
  if (csqrtf(f) != csqrtf(f))
    link_failure_csqrtf();
}


x86 assembly (clang, -O0):
<test_csqrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movlpd %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  %xmm1,-0x10(%rbp)
movss  %xmm0,-0xc(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <csqrtf@plt>
movlpd %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  %xmm1,-0x20(%rbp)
movss  %xmm0,-0x1c(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <csqrtf@plt>
movss  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
movlpd %xmm1,-0x28(%rbp)
movss  -0x28(%rbp),%xmm3
movss  -0x24(%rbp),%xmm1
ucomiss %xmm3,%xmm2
setne  %al
setp   %cl
or     %cl,%al
ucomiss %xmm1,%xmm0
setne  %cl
setp   %dl
or     %dl,%cl
or     %cl,%al
test   $0x1,%al
jne    11c3 <test_csqrtf+0xa3>
jmp    11ca <test_csqrtf+0xaa>
mov    $0x0,%al
call   1030 <link_failure_csqrtf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_csqrtf>:
sub    $0x28,%rsp
movaps %xmm0,0x10(%rsp)
call   1040 <csqrtf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <csqrtf@plt>
movaps (%rsp),%xmm1
ucomiss %xmm0,%xmm1
jne    1159 <test_csqrtf+0x39>
jp     1159 <test_csqrtf+0x39>
cmpneqps %xmm0,%xmm1
pextrw $0x2,%xmm1,%eax
test   $0x1,%al
jne    1159 <test_csqrtf+0x39>
add    $0x28,%rsp
ret
xor    %eax,%eax
add    $0x28,%rsp
jmp    1030 <link_failure_csqrtf@plt>

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

LLVM IR (-O2):
define void @test_csqrtf(<2 x float> %0) {
%2 = tail call <2 x float> @csqrtf(<2 x float> %0)
%3 = extractelement <2 x float> %2, i64 0
%4 = tail call <2 x float> @csqrtf(<2 x float> %0)
%5 = extractelement <2 x float> %4, i64 0
%6 = fcmp une float %3, %5
%7 = fcmp une <2 x float> %2, %4
%8 = extractelement <2 x i1> %7, i64 1
%9 = or i1 %6, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = tail call i32 (...) @link_failure_csqrtf()
br label %12
12: ; preds = %10, %1
ret void
}