void vecAxpy(double *x, double *y, int size, double alpha) {
  int i;
#pragma omp parallel for schedule(static)
  for (i = 0; i < size; i++) {
    y[i] = y[i] + alpha * x[i];
  }
}


x86 assembly (clang, -O0):
<vecAxpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1169 <vecAxpy+0x69>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111b <vecAxpy+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vecAxpy>:
test   %edx,%edx
jle    126f <vecAxpy+0x16f>
mov    %edx,%r9d
cmp    $0x4,%edx
jb     1122 <vecAxpy+0x22>
lea    (%rdi,%r9,8),%rax
cmp    %rsi,%rax
jbe    1187 <vecAxpy+0x87>
lea    (%rsi,%r9,8),%rax
cmp    %rdi,%rax
jbe    1187 <vecAxpy+0x87>
xor    %ecx,%ecx
mov    %rcx,%rax
not    %rax
test   $0x1,%r9b
je     1147 <vecAxpy+0x47>
movsd  (%rdi,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rsi,%rcx,8),%xmm1
movsd  %xmm1,(%rsi,%rcx,8)
or     $0x1,%rcx
add    %r9,%rax
je     126f <vecAxpy+0x16f>
movsd  (%rdi,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rsi,%rcx,8),%xmm1
movsd  %xmm1,(%rsi,%rcx,8)
movsd  0x8(%rdi,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rsi,%rcx,8),%xmm1
movsd  %xmm1,0x8(%rsi,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%r9
jne    1150 <vecAxpy+0x50>
jmp    126f <vecAxpy+0x16f>
mov    %r9d,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rax
mov    %rax,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rax,%rax
je     1270 <vecAxpy+0x170>
mov    %r8,%rax
and    $0xfffffffffffffffe,%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movupd (%rdi,%rdx,8),%xmm2
movupd 0x10(%rdi,%rdx,8),%xmm3
mulpd  %xmm1,%xmm2
movupd (%rsi,%rdx,8),%xmm4
addpd  %xmm2,%xmm4
movupd 0x10(%rsi,%rdx,8),%xmm2
movupd 0x20(%rsi,%rdx,8),%xmm5
movupd 0x30(%rsi,%rdx,8),%xmm6
mulpd  %xmm1,%xmm3
addpd  %xmm2,%xmm3
movupd %xmm4,(%rsi,%rdx,8)
movupd %xmm3,0x10(%rsi,%rdx,8)
movupd 0x20(%rdi,%rdx,8),%xmm2
movupd 0x30(%rdi,%rdx,8),%xmm3
mulpd  %xmm1,%xmm2
addpd  %xmm5,%xmm2
mulpd  %xmm1,%xmm3
addpd  %xmm6,%xmm3
movupd %xmm2,0x20(%rsi,%rdx,8)
movupd %xmm3,0x30(%rsi,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rax
jne    11c0 <vecAxpy+0xc0>
test   $0x1,%r8b
je     1266 <vecAxpy+0x166>
movupd (%rsi,%rdx,8),%xmm2
movupd 0x10(%rsi,%rdx,8),%xmm3
movupd (%rdi,%rdx,8),%xmm4
movupd 0x10(%rdi,%rdx,8),%xmm5
mulpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
mulpd  %xmm1,%xmm5
addpd  %xmm3,%xmm5
movupd %xmm4,(%rsi,%rdx,8)
movupd %xmm5,0x10(%rsi,%rdx,8)
cmp    %r9,%rcx
jne    1124 <vecAxpy+0x24>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    1235 <vecAxpy+0x135>
jmp    1266 <vecAxpy+0x166>

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

LLVM IR (-O2):
define void @vecAxpy(double* nocapture %0, double* nocapture %1, i32 %2, double %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %120
6: ; preds = %4
%7 = zext i32 %2 to i64
%8 = icmp ult i32 %2, 4
br i1 %8, label %89, label %9
9: ; preds = %6
%10 = getelementptr double, double* %1, i64 %7
%11 = getelementptr double, double* %0, i64 %7
%12 = icmp ugt double* %11, %1
%13 = icmp ugt double* %10, %0
%14 = and i1 %12, %13
br i1 %14, label %89, label %15
15: ; preds = %9
%16 = and i64 %7, 4294967292
%17 = insertelement <2 x double> poison, double %3, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = insertelement <2 x double> poison, double %3, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = add nsw i64 %16, -4
%22 = lshr exact i64 %21, 2
%23 = add nuw nsw i64 %22, 1
%24 = and i64 %23, 1
%25 = icmp eq i64 %21, 0
br i1 %25, label %67, label %26
26: ; preds = %15
%27 = and i64 %23, 9223372036854775806
br label %28
28: ; preds = %28, %26
%29 = phi i64 [ 0, %26 ], [ %64, %28 ]
%30 = phi i64 [ 0, %26 ], [ %65, %28 ]
%31 = getelementptr inbounds double, double* %1, i64 %29
%32 = bitcast double* %31 to <2 x double>*
%33 = load <2 x double>, <2 x double>* %32
%34 = getelementptr inbounds double, double* %31, i64 2
%35 = bitcast double* %34 to <2 x double>*
%36 = load <2 x double>, <2 x double>* %35
%37 = getelementptr inbounds double, double* %0, i64 %29
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %37, i64 2
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %39, <2 x double> %33)
%44 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %42, <2 x double> %36)
%45 = bitcast double* %31 to <2 x double>*
store <2 x double> %43, <2 x double>* %45
%46 = bitcast double* %34 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = or i64 %29, 4
%48 = getelementptr inbounds double, double* %1, i64 %47
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = getelementptr inbounds double, double* %48, i64 2
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %0, i64 %47
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %54, i64 2
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %56, <2 x double> %50)
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %59, <2 x double> %53)
%62 = bitcast double* %48 to <2 x double>*
store <2 x double> %60, <2 x double>* %62
%63 = bitcast double* %51 to <2 x double>*
store <2 x double> %61, <2 x double>* %63
%64 = add nuw i64 %29, 8
%65 = add i64 %30, 2
%66 = icmp eq i64 %65, %27
br i1 %66, label %67, label %28
67: ; preds = %28, %15
%68 = phi i64 [ 0, %15 ], [ %64, %28 ]
%69 = icmp eq i64 %24, 0
br i1 %69, label %87, label %70
70: ; preds = %67
%71 = getelementptr inbounds double, double* %1, i64 %68
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr inbounds double, double* %71, i64 2
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = getelementptr inbounds double, double* %0, i64 %68
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %77, i64 2
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %79, <2 x double> %73)
%84 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %82, <2 x double> %76)
%85 = bitcast double* %71 to <2 x double>*
store <2 x double> %83, <2 x double>* %85
%86 = bitcast double* %74 to <2 x double>*
store <2 x double> %84, <2 x double>* %86
br label %87
87: ; preds = %67, %70
%88 = icmp eq i64 %16, %7
br i1 %88, label %120, label %89
89: ; preds = %9, %6, %87
%90 = phi i64 [ 0, %9 ], [ 0, %6 ], [ %16, %87 ]
%91 = xor i64 %90, -1
%92 = and i64 %7, 1
%93 = icmp eq i64 %92, 0
br i1 %93, label %101, label %94
94: ; preds = %89
%95 = getelementptr inbounds double, double* %1, i64 %90
%96 = load double, double* %95
%97 = getelementptr inbounds double, double* %0, i64 %90
%98 = load double, double* %97
%99 = tail call double @llvm.fmuladd.f64(double %3, double %98, double %96)
store double %99, double* %95
%100 = or i64 %90, 1
br label %101
101: ; preds = %94, %89
%102 = phi i64 [ %90, %89 ], [ %100, %94 ]
%103 = sub nsw i64 0, %7
%104 = icmp eq i64 %91, %103
br i1 %104, label %120, label %105
105: ; preds = %101, %105
%106 = phi i64 [ %118, %105 ], [ %102, %101 ]
%107 = getelementptr inbounds double, double* %1, i64 %106
%108 = load double, double* %107
%109 = getelementptr inbounds double, double* %0, i64 %106
%110 = load double, double* %109
%111 = tail call double @llvm.fmuladd.f64(double %3, double %110, double %108)
store double %111, double* %107
%112 = add nuw nsw i64 %106, 1
%113 = getelementptr inbounds double, double* %1, i64 %112
%114 = load double, double* %113
%115 = getelementptr inbounds double, double* %0, i64 %112
%116 = load double, double* %115
%117 = tail call double @llvm.fmuladd.f64(double %3, double %116, double %114)
store double %117, double* %113
%118 = add nuw nsw i64 %106, 2
%119 = icmp eq i64 %118, %7
br i1 %119, label %120, label %105
120: ; preds = %101, %105, %87, %4
ret void
}