void vsubrarithimm_0point5_float(float *dst, int count) {
  for (int i = 0; i < count; ++i)
    dst[i] = (float)0.5 - dst[i];
}


x86 assembly (clang, -O0):
<vsubrarithimm_0point5_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    114e <vsubrarithimm_0point5_float+0x4e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  0xed2(%rip),%xmm0
subss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <vsubrarithimm_0point5_float+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsubrarithimm_0point5_float>:
test   %esi,%esi
jle    11e6 <vsubrarithimm_0point5_float+0xe6>
mov    %esi,%eax
cmp    $0x8,%esi
jae    1116 <vsubrarithimm_0point5_float+0x16>
xor    %ecx,%ecx
jmp    11c5 <vsubrarithimm_0point5_float+0xc5>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rdx
mov    %rdx,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rdx,%rdx
je     11e7 <vsubrarithimm_0point5_float+0xe7>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
movaps 0xebd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups (%rdi,%rdx,4),%xmm1
movups 0x10(%rdi,%rdx,4),%xmm2
movups 0x20(%rdi,%rdx,4),%xmm3
movups 0x30(%rdi,%rdx,4),%xmm4
movaps %xmm0,%xmm5
subps  %xmm1,%xmm5
movaps %xmm0,%xmm1
subps  %xmm2,%xmm1
movups %xmm5,(%rdi,%rdx,4)
movups %xmm1,0x10(%rdi,%rdx,4)
movaps %xmm0,%xmm1
subps  %xmm3,%xmm1
movaps %xmm0,%xmm2
subps  %xmm4,%xmm2
movups %xmm1,0x20(%rdi,%rdx,4)
movups %xmm2,0x30(%rdi,%rdx,4)
add    $0x10,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1150 <vsubrarithimm_0point5_float+0x50>
test   $0x1,%r8b
je     11c0 <vsubrarithimm_0point5_float+0xc0>
movups (%rdi,%rdx,4),%xmm0
movups 0x10(%rdi,%rdx,4),%xmm1
movaps 0xe52(%rip),%xmm2
movaps %xmm2,%xmm3
subps  %xmm0,%xmm3
subps  %xmm1,%xmm2
movups %xmm3,(%rdi,%rdx,4)
movups %xmm2,0x10(%rdi,%rdx,4)
cmp    %rax,%rcx
je     11e6 <vsubrarithimm_0point5_float+0xe6>
movss  0xe43(%rip),%xmm0
nopl   (%rax)
movaps %xmm0,%xmm1
subss  (%rdi,%rcx,4),%xmm1
movss  %xmm1,(%rdi,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11d0 <vsubrarithimm_0point5_float+0xd0>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    119e <vsubrarithimm_0point5_float+0x9e>
jmp    11c0 <vsubrarithimm_0point5_float+0xc0>

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

LLVM IR (-O2):
define void @vsubrarithimm_0point5_float(float* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %61
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = icmp ult i32 %1, 8
br i1 %6, label %59, label %7
7: ; preds = %4
%8 = and i64 %5, 4294967288
%9 = add nsw i64 %8, -8
%10 = lshr exact i64 %9, 3
%11 = add nuw nsw i64 %10, 1
%12 = and i64 %11, 1
%13 = icmp eq i64 %9, 0
br i1 %13, label %43, label %14
14: ; preds = %7
%15 = and i64 %11, 4611686018427387902
br label %16
16: ; preds = %16, %14
%17 = phi i64 [ 0, %14 ], [ %40, %16 ]
%18 = phi i64 [ 0, %14 ], [ %41, %16 ]
%19 = getelementptr inbounds float, float* %0, i64 %17
%20 = bitcast float* %19 to <4 x float>*
%21 = load <4 x float>, <4 x float>* %20
%22 = getelementptr inbounds float, float* %19, i64 4
%23 = bitcast float* %22 to <4 x float>*
%24 = load <4 x float>, <4 x float>* %23
%25 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %21
%26 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %24
%27 = bitcast float* %19 to <4 x float>*
store <4 x float> %25, <4 x float>* %27
%28 = bitcast float* %22 to <4 x float>*
store <4 x float> %26, <4 x float>* %28
%29 = or i64 %17, 8
%30 = getelementptr inbounds float, float* %0, i64 %29
%31 = bitcast float* %30 to <4 x float>*
%32 = load <4 x float>, <4 x float>* %31
%33 = getelementptr inbounds float, float* %30, i64 4
%34 = bitcast float* %33 to <4 x float>*
%35 = load <4 x float>, <4 x float>* %34
%36 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %32
%37 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %35
%38 = bitcast float* %30 to <4 x float>*
store <4 x float> %36, <4 x float>* %38
%39 = bitcast float* %33 to <4 x float>*
store <4 x float> %37, <4 x float>* %39
%40 = add nuw i64 %17, 16
%41 = add i64 %18, 2
%42 = icmp eq i64 %41, %15
br i1 %42, label %43, label %16
43: ; preds = %16, %7
%44 = phi i64 [ 0, %7 ], [ %40, %16 ]
%45 = icmp eq i64 %12, 0
br i1 %45, label %57, label %46
46: ; preds = %43
%47 = getelementptr inbounds float, float* %0, i64 %44
%48 = bitcast float* %47 to <4 x float>*
%49 = load <4 x float>, <4 x float>* %48
%50 = getelementptr inbounds float, float* %47, i64 4
%51 = bitcast float* %50 to <4 x float>*
%52 = load <4 x float>, <4 x float>* %51
%53 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %49
%54 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %52
%55 = bitcast float* %47 to <4 x float>*
store <4 x float> %53, <4 x float>* %55
%56 = bitcast float* %50 to <4 x float>*
store <4 x float> %54, <4 x float>* %56
br label %57
57: ; preds = %43, %46
%58 = icmp eq i64 %8, %5
br i1 %58, label %61, label %59
59: ; preds = %4, %57
%60 = phi i64 [ 0, %4 ], [ %8, %57 ]
br label %62
61: ; preds = %62, %57, %2
ret void
62: ; preds = %59, %62
%63 = phi i64 [ %67, %62 ], [ %60, %59 ]
%64 = getelementptr inbounds float, float* %0, i64 %63
%65 = load float, float* %64
%66 = fsub float 5.000000e-01, %65
store float %66, float* %64
%67 = add nuw nsw i64 %63, 1
%68 = icmp eq i64 %67, %5
br i1 %68, label %61, label %62
}