void __attribute__((no, noclone))
test_double(double *restrict dest, double *restrict src) {
  for (unsigned int i = 0; i < 200; ++i)
    dest[i] += src[i * 2];
}


x86 assembly (clang, -O0):
<test_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xc8,-0x14(%rbp)
jae    1150 <test_double+0x50>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <test_double+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_double>:
mov    $0x10,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movupd -0x20(%rsi,%rax,2),%xmm0
movupd (%rsi,%rax,2),%xmm1
movhpd -0x10(%rsi,%rax,2),%xmm0
movhpd 0x10(%rsi,%rax,2),%xmm1
movupd -0x10(%rdi,%rax,1),%xmm2
addpd  %xmm0,%xmm2
movupd (%rdi,%rax,1),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,-0x10(%rdi,%rax,1)
movupd %xmm0,(%rdi,%rax,1)
add    $0x20,%rax
cmp    $0x630,%rax
jne    1110 <test_double+0x10>
movsd  0xc40(%rsi),%xmm0
addsd  0x620(%rdi),%xmm0
movsd  %xmm0,0x620(%rdi)
movsd  0xc50(%rsi),%xmm0
addsd  0x628(%rdi),%xmm0
movsd  %xmm0,0x628(%rdi)
movsd  0xc60(%rsi),%xmm0
addsd  0x630(%rdi),%xmm0
movsd  %xmm0,0x630(%rdi)
movsd  0xc70(%rsi),%xmm0
addsd  0x638(%rdi),%xmm0
movsd  %xmm0,0x638(%rdi)
ret

LLVM IR (-O0):
define void @test_double(double* noalias %0, double* noalias %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
store i32 0, i32* %5
br label %6
6: ; preds = %22, %2
%7 = load i32, i32* %5
%8 = icmp ult i32 %7, 200
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load double*, double** %4
%11 = load i32, i32* %5
%12 = mul i32 %11, 2
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds double, double* %10, i64 %13
%15 = load double, double* %14
%16 = load double*, double** %3
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = fadd double %20, %15
store double %21, double* %19
br label %22
22: ; preds = %9
%23 = load i32, i32* %5
%24 = add i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @test_double(double* noalias nocapture %0, double* noalias nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ 0, %2 ], [ %26, %3 ]
%5 = shl nuw nsw i64 %4, 1
%6 = shl i64 %4, 1
%7 = or i64 %6, 4
%8 = getelementptr inbounds double, double* %1, i64 %5
%9 = getelementptr inbounds double, double* %1, i64 %7
%10 = bitcast double* %8 to <4 x double>*
%11 = bitcast double* %9 to <4 x double>*
%12 = load <4 x double>, <4 x double>* %10
%13 = load <4 x double>, <4 x double>* %11
%14 = shufflevector <4 x double> %12, <4 x double> poison, <2 x i32> <i32 0, i32 2>
%15 = shufflevector <4 x double> %13, <4 x double> poison, <2 x i32> <i32 0, i32 2>
%16 = getelementptr inbounds double, double* %0, i64 %4
%17 = bitcast double* %16 to <2 x double>*
%18 = load <2 x double>, <2 x double>* %17
%19 = getelementptr inbounds double, double* %16, i64 2
%20 = bitcast double* %19 to <2 x double>*
%21 = load <2 x double>, <2 x double>* %20
%22 = fadd <2 x double> %14, %18
%23 = fadd <2 x double> %15, %21
%24 = bitcast double* %16 to <2 x double>*
store <2 x double> %22, <2 x double>* %24
%25 = bitcast double* %19 to <2 x double>*
store <2 x double> %23, <2 x double>* %25
%26 = add nuw i64 %4, 4
%27 = icmp eq i64 %26, 196
br i1 %27, label %28, label %3
28: ; preds = %3
%29 = getelementptr inbounds double, double* %1, i64 392
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %0, i64 196
%32 = load double, double* %31
%33 = fadd double %30, %32
store double %33, double* %31
%34 = getelementptr inbounds double, double* %1, i64 394
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %0, i64 197
%37 = load double, double* %36
%38 = fadd double %35, %37
store double %38, double* %36
%39 = getelementptr inbounds double, double* %1, i64 396
%40 = load double, double* %39
%41 = getelementptr inbounds double, double* %0, i64 198
%42 = load double, double* %41
%43 = fadd double %40, %42
store double %43, double* %41
%44 = getelementptr inbounds double, double* %1, i64 398
%45 = load double, double* %44
%46 = getelementptr inbounds double, double* %0, i64 199
%47 = load double, double* %46
%48 = fadd double %45, %47
store double %48, double* %46
ret void
}