void mvp2x2(const double *restrict a, const double *restrict v,
            double *restrict r) {
  double *pr;
  pr = r;
  *pr++ += *a++ * *v;
  *pr++ += *a++ * *v++;
  pr = r;
  *pr++ += *a++ * *v;
  *pr++ += *a++ * *v++;
}


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

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

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

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