void foo(float *output, float *input) {
  int i = 0;
  for (i = 0; i < 32; i++)
    output[i] = __builtin_roundf(input[i]);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    1165 <foo+0x55>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <roundf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <foo+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x80(%rsi),%rax
cmp    %rdi,%rax
jbe    1199 <foo+0x89>
lea    0x80(%r14),%rax
cmp    %r15,%rax
jbe    1199 <foo+0x89>
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  (%r15,%rbx,4),%xmm0
call   1030 <roundf@plt>
movss  %xmm0,(%r14,%rbx,4)
movss  0x4(%r15,%rbx,4),%xmm0
call   1030 <roundf@plt>
movss  %xmm0,0x4(%r14,%rbx,4)
movss  0x8(%r15,%rbx,4),%xmm0
call   1030 <roundf@plt>
movss  %xmm0,0x8(%r14,%rbx,4)
movss  0xc(%r15,%rbx,4),%xmm0
call   1030 <roundf@plt>
movss  %xmm0,0xc(%r14,%rbx,4)
add    $0x4,%rbx
cmp    $0x20,%rbx
jne    1140 <foo+0x30>
jmp    146f <foo+0x35f>
movups (%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,(%r14)
movups 0x10(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x10(%r14)
movups 0x20(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x20(%r14)
movups 0x30(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x30(%r14)
movups 0x40(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x40(%r14)
movups 0x50(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x50(%r14)
movups 0x60(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x60(%r14)
movups 0x70(%r15),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <roundf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <roundf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <roundf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x70(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @foo(float* nocapture writeonly %0, float* nocapture %1) {
%3 = getelementptr float, float* %0, i64 32
%4 = getelementptr float, float* %1, i64 32
%5 = icmp ugt float* %4, %0
%6 = icmp ugt float* %3, %1
%7 = and i1 %5, %6
br i1 %7, label %55, label %8
8: ; preds = %2
%9 = bitcast float* %1 to <4 x float>*
%10 = load <4 x float>, <4 x float>* %9
%11 = call <4 x float> @llvm.round.v4f32(<4 x float> %10)
%12 = bitcast float* %0 to <4 x float>*
store <4 x float> %11, <4 x float>* %12
%13 = getelementptr inbounds float, float* %1, i64 4
%14 = bitcast float* %13 to <4 x float>*
%15 = load <4 x float>, <4 x float>* %14
%16 = call <4 x float> @llvm.round.v4f32(<4 x float> %15)
%17 = getelementptr inbounds float, float* %0, i64 4
%18 = bitcast float* %17 to <4 x float>*
store <4 x float> %16, <4 x float>* %18
%19 = getelementptr inbounds float, float* %1, i64 8
%20 = bitcast float* %19 to <4 x float>*
%21 = load <4 x float>, <4 x float>* %20
%22 = call <4 x float> @llvm.round.v4f32(<4 x float> %21)
%23 = getelementptr inbounds float, float* %0, i64 8
%24 = bitcast float* %23 to <4 x float>*
store <4 x float> %22, <4 x float>* %24
%25 = getelementptr inbounds float, float* %1, i64 12
%26 = bitcast float* %25 to <4 x float>*
%27 = load <4 x float>, <4 x float>* %26
%28 = call <4 x float> @llvm.round.v4f32(<4 x float> %27)
%29 = getelementptr inbounds float, float* %0, i64 12
%30 = bitcast float* %29 to <4 x float>*
store <4 x float> %28, <4 x float>* %30
%31 = getelementptr inbounds float, float* %1, i64 16
%32 = bitcast float* %31 to <4 x float>*
%33 = load <4 x float>, <4 x float>* %32
%34 = call <4 x float> @llvm.round.v4f32(<4 x float> %33)
%35 = getelementptr inbounds float, float* %0, i64 16
%36 = bitcast float* %35 to <4 x float>*
store <4 x float> %34, <4 x float>* %36
%37 = getelementptr inbounds float, float* %1, i64 20
%38 = bitcast float* %37 to <4 x float>*
%39 = load <4 x float>, <4 x float>* %38
%40 = call <4 x float> @llvm.round.v4f32(<4 x float> %39)
%41 = getelementptr inbounds float, float* %0, i64 20
%42 = bitcast float* %41 to <4 x float>*
store <4 x float> %40, <4 x float>* %42
%43 = getelementptr inbounds float, float* %1, i64 24
%44 = bitcast float* %43 to <4 x float>*
%45 = load <4 x float>, <4 x float>* %44
%46 = call <4 x float> @llvm.round.v4f32(<4 x float> %45)
%47 = getelementptr inbounds float, float* %0, i64 24
%48 = bitcast float* %47 to <4 x float>*
store <4 x float> %46, <4 x float>* %48
%49 = getelementptr inbounds float, float* %1, i64 28
%50 = bitcast float* %49 to <4 x float>*
%51 = load <4 x float>, <4 x float>* %50
%52 = call <4 x float> @llvm.round.v4f32(<4 x float> %51)
%53 = getelementptr inbounds float, float* %0, i64 28
%54 = bitcast float* %53 to <4 x float>*
store <4 x float> %52, <4 x float>* %54
br label %78
55: ; preds = %2, %55
%56 = phi i64 [ %76, %55 ], [ 0, %2 ]
%57 = getelementptr inbounds float, float* %1, i64 %56
%58 = load float, float* %57
%59 = tail call float @llvm.round.f32(float %58)
%60 = getelementptr inbounds float, float* %0, i64 %56
store float %59, float* %60
%61 = or i64 %56, 1
%62 = getelementptr inbounds float, float* %1, i64 %61
%63 = load float, float* %62
%64 = tail call float @llvm.round.f32(float %63)
%65 = getelementptr inbounds float, float* %0, i64 %61
store float %64, float* %65
%66 = or i64 %56, 2
%67 = getelementptr inbounds float, float* %1, i64 %66
%68 = load float, float* %67
%69 = tail call float @llvm.round.f32(float %68)
%70 = getelementptr inbounds float, float* %0, i64 %66
store float %69, float* %70
%71 = or i64 %56, 3
%72 = getelementptr inbounds float, float* %1, i64 %71
%73 = load float, float* %72
%74 = tail call float @llvm.round.f32(float %73)
%75 = getelementptr inbounds float, float* %0, i64 %71
store float %74, float* %75
%76 = add nuw nsw i64 %56, 4
%77 = icmp eq i64 %76, 32
br i1 %77, label %78, label %55
78: ; preds = %55, %8
ret void
}