void __attribute__((no, noclone))
test_double(double *restrict a, double *restrict b, int step) {
  step = step & 7;
  for (int i = 0; i < 87; ++i) {
    double r1 = a[i * step + 0] += 1;
    a[i * step + 1] += 2;
    a[i * step + 2] += 4;
    a[i * step + 3] += 8;
    b[i] += r1;
  }
}


x86 assembly (clang, -O0):
<test_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x57,-0x18(%rbp)
jge    11df <test_double+0xdf>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  0xed6(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xea6(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  0xe7b(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  0xe50(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111f <test_double+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_double>:
and    $0x7,%edx
add    $0x10,%rdi
mov    %rdx,%rax
shl    $0x4,%rax
mov    $0x1,%ecx
movapd 0xee5(%rip),%xmm0
movapd 0xeed(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd -0x10(%rdi),%xmm2
movupd (%rdi),%xmm3
addpd  %xmm0,%xmm2
movupd %xmm2,-0x10(%rdi)
addpd  %xmm1,%xmm3
movupd %xmm3,(%rdi)
addsd  -0x8(%rsi,%rcx,8),%xmm2
movsd  %xmm2,-0x8(%rsi,%rcx,8)
cmp    $0x57,%rcx
je     118d <test_double+0x8d>
movupd -0x10(%rdi,%rdx,8),%xmm2
movupd (%rdi,%rdx,8),%xmm3
addpd  %xmm0,%xmm2
movupd %xmm2,-0x10(%rdi,%rdx,8)
addpd  %xmm1,%xmm3
addsd  (%rsi,%rcx,8),%xmm2
movupd %xmm3,(%rdi,%rdx,8)
movsd  %xmm2,(%rsi,%rcx,8)
add    $0x2,%rcx
add    %rax,%rdi
jmp    1130 <test_double+0x30>
ret

LLVM IR (-O0):
define void @test_double(double* noalias %0, double* noalias %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = and i32 %9, 7
store i32 %10, i32* %6
store i32 0, i32* %7
br label %11
11: ; preds = %58, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 87
br i1 %13, label %14, label %61
14: ; preds = %11
%15 = load double*, double** %4
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = mul nsw i32 %16, %17
%19 = add nsw i32 %18, 0
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %15, i64 %20
%22 = load double, double* %21
%23 = fadd double %22, 1.000000e+00
store double %23, double* %21
store double %23, double* %8
%24 = load double*, double** %4
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = mul nsw i32 %25, %26
%28 = add nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %24, i64 %29
%31 = load double, double* %30
%32 = fadd double %31, 2.000000e+00
store double %32, double* %30
%33 = load double*, double** %4
%34 = load i32, i32* %7
%35 = load i32, i32* %6
%36 = mul nsw i32 %34, %35
%37 = add nsw i32 %36, 2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %33, i64 %38
%40 = load double, double* %39
%41 = fadd double %40, 4.000000e+00
store double %41, double* %39
%42 = load double*, double** %4
%43 = load i32, i32* %7
%44 = load i32, i32* %6
%45 = mul nsw i32 %43, %44
%46 = add nsw i32 %45, 3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %42, i64 %47
%49 = load double, double* %48
%50 = fadd double %49, 8.000000e+00
store double %50, double* %48
%51 = load double, double* %8
%52 = load double*, double** %5
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = fadd double %56, %51
store double %57, double* %55
br label %58
58: ; preds = %14
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %11
61: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @test_double(double* noalias nocapture %0, double* noalias nocapture %1, i32 %2) {
%4 = and i32 %2, 7
%5 = zext i32 %4 to i64
br label %7
6: ; preds = %7
ret void
7: ; preds = %27, %3
%8 = phi i64 [ 0, %3 ], [ %44, %27 ]
%9 = mul nuw nsw i64 %8, %5
%10 = getelementptr inbounds double, double* %0, i64 %9
%11 = bitcast double* %10 to <2 x double>*
%12 = load <2 x double>, <2 x double>* %11
%13 = fadd <2 x double> %12, <double 1.000000e+00, double 2.000000e+00>
%14 = bitcast double* %10 to <2 x double>*
store <2 x double> %13, <2 x double>* %14
%15 = add nuw nsw i64 %9, 2
%16 = getelementptr inbounds double, double* %0, i64 %15
%17 = bitcast double* %16 to <2 x double>*
%18 = load <2 x double>, <2 x double>* %17
%19 = fadd <2 x double> %18, <double 4.000000e+00, double 8.000000e+00>
%20 = bitcast double* %16 to <2 x double>*
store <2 x double> %19, <2 x double>* %20
%21 = getelementptr inbounds double, double* %1, i64 %8
%22 = load double, double* %21
%23 = extractelement <2 x double> %13, i64 0
%24 = fadd double %23, %22
store double %24, double* %21
%25 = or i64 %8, 1
%26 = icmp eq i64 %25, 87
br i1 %26, label %6, label %27
27: ; preds = %7
%28 = mul nuw nsw i64 %25, %5
%29 = getelementptr inbounds double, double* %0, i64 %28
%30 = bitcast double* %29 to <2 x double>*
%31 = load <2 x double>, <2 x double>* %30
%32 = fadd <2 x double> %31, <double 1.000000e+00, double 2.000000e+00>
%33 = bitcast double* %29 to <2 x double>*
store <2 x double> %32, <2 x double>* %33
%34 = add nuw nsw i64 %28, 2
%35 = getelementptr inbounds double, double* %0, i64 %34
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = fadd <2 x double> %37, <double 4.000000e+00, double 8.000000e+00>
%39 = bitcast double* %35 to <2 x double>*
store <2 x double> %38, <2 x double>* %39
%40 = getelementptr inbounds double, double* %1, i64 %25
%41 = load double, double* %40
%42 = extractelement <2 x double> %32, i64 0
%43 = fadd double %42, %41
store double %43, double* %40
%44 = add nuw nsw i64 %8, 2
br label %7
}