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


x86 assembly (clang, -O0):
<vsubrarithimm_0_double>:
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    1149 <vsubrarithimm_0_double+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
subsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <vsubrarithimm_0_double+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsubrarithimm_0_double>:
test   %esi,%esi
jle    11e7 <vsubrarithimm_0_double+0xe7>
mov    %esi,%eax
cmp    $0x4,%esi
jae    1116 <vsubrarithimm_0_double+0x16>
xor    %ecx,%ecx
jmp    11d0 <vsubrarithimm_0_double+0xd0>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rdx,%rdx
je     11e8 <vsubrarithimm_0_double+0xe8>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
nopl   0x0(%rax)
movupd (%rdi,%rdx,8),%xmm0
movupd 0x10(%rdi,%rdx,8),%xmm1
movupd 0x20(%rdi,%rdx,8),%xmm2
movupd 0x30(%rdi,%rdx,8),%xmm3
xorpd  %xmm4,%xmm4
subpd  %xmm0,%xmm4
xorpd  %xmm0,%xmm0
subpd  %xmm1,%xmm0
movupd %xmm4,(%rdi,%rdx,8)
movupd %xmm0,0x10(%rdi,%rdx,8)
xorpd  %xmm0,%xmm0
subpd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
subpd  %xmm3,%xmm1
movupd %xmm0,0x20(%rdi,%rdx,8)
movupd %xmm1,0x30(%rdi,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1140 <vsubrarithimm_0_double+0x40>
test   $0x1,%r8b
je     11c4 <vsubrarithimm_0_double+0xc4>
movupd (%rdi,%rdx,8),%xmm0
movupd 0x10(%rdi,%rdx,8),%xmm1
xorpd  %xmm2,%xmm2
xorpd  %xmm3,%xmm3
subpd  %xmm0,%xmm3
subpd  %xmm1,%xmm2
movupd %xmm3,(%rdi,%rdx,8)
movupd %xmm2,0x10(%rdi,%rdx,8)
cmp    %rax,%rcx
je     11e7 <vsubrarithimm_0_double+0xe7>
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
subsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%rdi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11d0 <vsubrarithimm_0_double+0xd0>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    119e <vsubrarithimm_0_double+0x9e>
jmp    11c4 <vsubrarithimm_0_double+0xc4>

LLVM IR (-O0):
define void @vsubrarithimm_0_double(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %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 double*, double** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
%15 = load double, double* %14
%16 = fsub double 0.000000e+00, %15
%17 = load double*, double** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
store double %16, double* %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_0_double(double* 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, 4
br i1 %6, label %59, label %7
7: ; preds = %4
%8 = and i64 %5, 4294967292
%9 = add nsw i64 %8, -4
%10 = lshr exact i64 %9, 2
%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, 9223372036854775806
br label %16
16: ; preds = %16, %14
%17 = phi i64 [ 0, %14 ], [ %40, %16 ]
%18 = phi i64 [ 0, %14 ], [ %41, %16 ]
%19 = getelementptr inbounds double, double* %0, i64 %17
%20 = bitcast double* %19 to <2 x double>*
%21 = load <2 x double>, <2 x double>* %20
%22 = getelementptr inbounds double, double* %19, i64 2
%23 = bitcast double* %22 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = fsub <2 x double> zeroinitializer, %21
%26 = fsub <2 x double> zeroinitializer, %24
%27 = bitcast double* %19 to <2 x double>*
store <2 x double> %25, <2 x double>* %27
%28 = bitcast double* %22 to <2 x double>*
store <2 x double> %26, <2 x double>* %28
%29 = or i64 %17, 4
%30 = getelementptr inbounds double, double* %0, i64 %29
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = getelementptr inbounds double, double* %30, i64 2
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = fsub <2 x double> zeroinitializer, %32
%37 = fsub <2 x double> zeroinitializer, %35
%38 = bitcast double* %30 to <2 x double>*
store <2 x double> %36, <2 x double>* %38
%39 = bitcast double* %33 to <2 x double>*
store <2 x double> %37, <2 x double>* %39
%40 = add nuw i64 %17, 8
%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 double, double* %0, i64 %44
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = getelementptr inbounds double, double* %47, i64 2
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = fsub <2 x double> zeroinitializer, %49
%54 = fsub <2 x double> zeroinitializer, %52
%55 = bitcast double* %47 to <2 x double>*
store <2 x double> %53, <2 x double>* %55
%56 = bitcast double* %50 to <2 x double>*
store <2 x double> %54, <2 x double>* %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 double, double* %0, i64 %63
%65 = load double, double* %64
%66 = fsub double 0.000000e+00, %65
store double %66, double* %64
%67 = add nuw nsw i64 %63, 1
%68 = icmp eq i64 %67, %5
br i1 %68, label %61, label %62
}