void vector_saxpy_3d(double a, const double x[3], const double y[3],
                     double z[3]) {
  double t[3] = {a * x[0] + y[0], a * x[1] + y[1], a * x[2] + y[2]};
  z[0] = t[0];
  z[1] = t[1];
  z[2] = t[2];
}


x86 assembly (clang, -O0):
<vector_saxpy_3d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_saxpy_3d>:
movupd (%rdi),%xmm1
movupd (%rsi),%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
addpd  %xmm2,%xmm3
mulsd  0x10(%rdi),%xmm0
addsd  0x10(%rsi),%xmm0
movupd %xmm3,(%rdx)
movsd  %xmm0,0x10(%rdx)
ret

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

LLVM IR (-O2):
define void @vector_saxpy_3d(double %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3) {
%5 = bitcast double* %1 to <2 x double>*
%6 = load <2 x double>, <2 x double>* %5
%7 = bitcast double* %2 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = insertelement <2 x double> poison, double %0, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %10, <2 x double> %6, <2 x double> %8)
%12 = getelementptr inbounds double, double* %1, i64 2
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %2, i64 2
%15 = load double, double* %14
%16 = tail call double @llvm.fmuladd.f64(double %0, double %13, double %15)
%17 = bitcast double* %3 to <2 x double>*
store <2 x double> %11, <2 x double>* %17
%18 = getelementptr inbounds double, double* %3, i64 2
store double %16, double* %18
ret void
}