void foo(double *x, int *y) {
  int i;
  for (i = 0; i < 8; i++)
    x[i] -= y[i] * x[i + 1];
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    117b <foo+0x7b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <foo+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cvtdq2pd (%rsi),%xmm0
movupd 0x8(%rdi),%xmm1
movsd  (%rdi),%xmm2
unpcklpd %xmm1,%xmm2
mulpd  %xmm1,%xmm0
subpd  %xmm0,%xmm2
movupd %xmm2,(%rdi)
cvtdq2pd 0x8(%rsi),%xmm0
movupd 0x18(%rdi),%xmm2
shufpd $0x1,%xmm2,%xmm1
mulpd  %xmm2,%xmm0
subpd  %xmm0,%xmm1
movupd %xmm1,0x10(%rdi)
cvtdq2pd 0x10(%rsi),%xmm0
movupd 0x28(%rdi),%xmm1
shufpd $0x1,%xmm1,%xmm2
mulpd  %xmm1,%xmm0
subpd  %xmm0,%xmm2
movupd %xmm2,0x20(%rdi)
cvtdq2pd 0x18(%rsi),%xmm0
movupd 0x38(%rdi),%xmm2
shufpd $0x1,%xmm2,%xmm1
mulpd  %xmm2,%xmm0
subpd  %xmm0,%xmm1
movupd %xmm1,0x30(%rdi)
ret

LLVM IR (-O0):
define void @foo(double* %0, i32* %1) {
%3 = alloca double*
%4 = alloca i32*
%5 = alloca i32
store double* %0, double** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %29, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %32
9: ; preds = %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = sitofp i32 %14 to double
%16 = load double*, double** %3
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %16, i64 %19
%21 = load double, double* %20
%22 = load double*, double** %3
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = fneg double %15
%28 = call double @llvm.fmuladd.f64(double %27, double %21, double %26)
store double %28, double* %25
br label %29
29: ; preds = %9
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %6
32: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @foo(double* nocapture %0, i32* nocapture %1) {
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %0
%5 = bitcast i32* %1 to <2 x i32>*
%6 = load <2 x i32>, <2 x i32>* %5
%7 = sitofp <2 x i32> %6 to <2 x double>
%8 = getelementptr inbounds double, double* %0, i64 2
%9 = bitcast double* %3 to <2 x double>*
%10 = load <2 x double>, <2 x double>* %9
%11 = fneg <2 x double> %7
%12 = insertelement <2 x double> poison, double %4, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> %10, <2 x i32> <i32 0, i32 2>
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %10, <2 x double> %13)
%15 = bitcast double* %0 to <2 x double>*
store <2 x double> %14, <2 x double>* %15
%16 = getelementptr inbounds i32, i32* %1, i64 2
%17 = getelementptr inbounds double, double* %0, i64 3
%18 = bitcast i32* %16 to <2 x i32>*
%19 = load <2 x i32>, <2 x i32>* %18
%20 = sitofp <2 x i32> %19 to <2 x double>
%21 = getelementptr inbounds double, double* %0, i64 4
%22 = bitcast double* %17 to <2 x double>*
%23 = load <2 x double>, <2 x double>* %22
%24 = fneg <2 x double> %20
%25 = shufflevector <2 x double> %10, <2 x double> %23, <2 x i32> <i32 1, i32 2>
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %23, <2 x double> %25)
%27 = bitcast double* %8 to <2 x double>*
store <2 x double> %26, <2 x double>* %27
%28 = getelementptr inbounds i32, i32* %1, i64 4
%29 = getelementptr inbounds double, double* %0, i64 5
%30 = bitcast i32* %28 to <2 x i32>*
%31 = load <2 x i32>, <2 x i32>* %30
%32 = sitofp <2 x i32> %31 to <2 x double>
%33 = getelementptr inbounds double, double* %0, i64 6
%34 = bitcast double* %29 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = fneg <2 x double> %32
%37 = shufflevector <2 x double> %23, <2 x double> %35, <2 x i32> <i32 1, i32 2>
%38 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %35, <2 x double> %37)
%39 = bitcast double* %21 to <2 x double>*
store <2 x double> %38, <2 x double>* %39
%40 = getelementptr inbounds i32, i32* %1, i64 6
%41 = getelementptr inbounds double, double* %0, i64 7
%42 = bitcast i32* %40 to <2 x i32>*
%43 = load <2 x i32>, <2 x i32>* %42
%44 = sitofp <2 x i32> %43 to <2 x double>
%45 = bitcast double* %41 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = fneg <2 x double> %44
%48 = shufflevector <2 x double> %35, <2 x double> %46, <2 x i32> <i32 1, i32 2>
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %47, <2 x double> %46, <2 x double> %48)
%50 = bitcast double* %33 to <2 x double>*
store <2 x double> %49, <2 x double>* %50
ret void
}