double DotProductDPf(const float *v1, const float *v2) {
  double x[3], y[3];
  ((x)[0] = (v1)[0], (x)[1] = (v1)[1], (x)[2] = (v1)[2]);
  ((y)[0] = (v2)[0], (y)[1] = (v2)[1], (y)[2] = (v2)[2]);
  return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
}


x86 assembly (clang, -O0):
<DotProductDPf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DotProductDPf>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x8(%rdi),%xmm2
cvtss2sd %xmm2,%xmm2
movss  (%rsi),%xmm3
movss  0x4(%rsi),%xmm4
cvtss2sd %xmm3,%xmm3
mulsd  %xmm0,%xmm3
cvtss2sd %xmm4,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm3,%xmm4
movss  0x8(%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm4,%xmm0
ret

LLVM IR (-O0):
define double @DotProductDPf(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca [3 x double]
%6 = alloca [3 x double]
store float* %0, float** %3
store float* %1, float** %4
%7 = load float*, float** %3
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
store double %10, double* %11
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
store double %15, double* %16
%17 = load float*, float** %3
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %20, double* %21
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 0
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double %25, double* %26
%27 = load float*, float** %4
%28 = getelementptr inbounds float, float* %27, i64 1
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
store double %30, double* %31
%32 = load float*, float** %4
%33 = getelementptr inbounds float, float* %32, i64 2
%34 = load float, float* %33
%35 = fpext float %34 to double
%36 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %35, double* %36
%37 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%38 = load double, double* %37
%39 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%40 = load double, double* %39
%41 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%42 = load double, double* %41
%43 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%44 = load double, double* %43
%45 = fmul double %42, %44
%46 = call double @llvm.fmuladd.f64(double %38, double %40, double %45)
%47 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%48 = load double, double* %47
%49 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%50 = load double, double* %49
%51 = call double @llvm.fmuladd.f64(double %48, double %50, double %46)
ret double %51
}

LLVM IR (-O2):
define double @DotProductDPf(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = fpext float %3 to double
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = fpext float %6 to double
%8 = getelementptr inbounds float, float* %0, i64 2
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = load float, float* %1
%12 = fpext float %11 to double
%13 = getelementptr inbounds float, float* %1, i64 1
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = getelementptr inbounds float, float* %1, i64 2
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = fmul double %7, %15
%20 = tail call double @llvm.fmuladd.f64(double %4, double %12, double %19)
%21 = tail call double @llvm.fmuladd.f64(double %10, double %18, double %20)
ret double %21
}