void mtx_mul22t(double *A, double *B, double *M) {
  M[0] = A[0] * B[0] + A[1] * B[1];
  M[1] = A[0] * B[2] + A[1] * B[3];
  M[2] = A[2] * B[0] + A[3] * B[1];
  M[3] = A[2] * B[2] + A[3] * B[3];
  return;
}


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

x86 assembly (clang, -O2):
<mtx_mul22t>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  0x18(%rsi),%xmm1
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rdx)
movsd  0x10(%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
mulsd  0x18(%rsi),%xmm1
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rdx)
ret

LLVM IR (-O0):
define void @mtx_mul22t(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %4
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = fmul double %15, %18
%20 = call double @llvm.fmuladd.f64(double %9, double %12, double %19)
%21 = load double*, double** %6
%22 = getelementptr inbounds double, double* %21, i64 0
store double %20, double* %22
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load double, double* %24
%26 = load double*, double** %5
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = load double*, double** %4
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = load double*, double** %5
%33 = getelementptr inbounds double, double* %32, i64 3
%34 = load double, double* %33
%35 = fmul double %31, %34
%36 = call double @llvm.fmuladd.f64(double %25, double %28, double %35)
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 1
store double %36, double* %38
%39 = load double*, double** %4
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
%42 = load double*, double** %5
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = load double*, double** %4
%46 = getelementptr inbounds double, double* %45, i64 3
%47 = load double, double* %46
%48 = load double*, double** %5
%49 = getelementptr inbounds double, double* %48, i64 1
%50 = load double, double* %49
%51 = fmul double %47, %50
%52 = call double @llvm.fmuladd.f64(double %41, double %44, double %51)
%53 = load double*, double** %6
%54 = getelementptr inbounds double, double* %53, i64 2
store double %52, double* %54
%55 = load double*, double** %4
%56 = getelementptr inbounds double, double* %55, i64 2
%57 = load double, double* %56
%58 = load double*, double** %5
%59 = getelementptr inbounds double, double* %58, i64 2
%60 = load double, double* %59
%61 = load double*, double** %4
%62 = getelementptr inbounds double, double* %61, i64 3
%63 = load double, double* %62
%64 = load double*, double** %5
%65 = getelementptr inbounds double, double* %64, i64 3
%66 = load double, double* %65
%67 = fmul double %63, %66
%68 = call double @llvm.fmuladd.f64(double %57, double %60, double %67)
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 3
store double %68, double* %70
ret void
}

LLVM IR (-O2):
define void @mtx_mul22t(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fmul double %7, %9
%11 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %10)
store double %11, double* %2
%12 = load double, double* %0
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = load double, double* %6
%16 = getelementptr inbounds double, double* %1, i64 3
%17 = load double, double* %16
%18 = fmul double %15, %17
%19 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %18)
%20 = getelementptr inbounds double, double* %2, i64 1
store double %19, double* %20
%21 = getelementptr inbounds double, double* %0, i64 2
%22 = load double, double* %21
%23 = load double, double* %1
%24 = getelementptr inbounds double, double* %0, i64 3
%25 = load double, double* %24
%26 = load double, double* %8
%27 = fmul double %25, %26
%28 = tail call double @llvm.fmuladd.f64(double %22, double %23, double %27)
%29 = getelementptr inbounds double, double* %2, i64 2
store double %28, double* %29
%30 = load double, double* %21
%31 = load double, double* %13
%32 = load double, double* %24
%33 = load double, double* %16
%34 = fmul double %32, %33
%35 = tail call double @llvm.fmuladd.f64(double %30, double %31, double %34)
%36 = getelementptr inbounds double, double* %2, i64 3
store double %35, double* %36
ret void
}