void test_v4df(double *__restrict__ p, double *__restrict q) {
  p[0] = p[0] - q[0];
  p[1] = p[1] + q[1];
  p[2] = p[2] - q[2];
  p[3] = p[3] + q[3];
}


x86 assembly (clang, -O0):
<test_v4df>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_v4df>:
movupd (%rsi),%xmm0
movupd (%rdi),%xmm1
movupd 0x10(%rdi),%xmm2
movapd %xmm1,%xmm3
subpd  %xmm0,%xmm3
addpd  %xmm0,%xmm1
movsd  %xmm3,%xmm1
movupd %xmm1,(%rdi)
movupd 0x10(%rsi),%xmm0
movapd %xmm2,%xmm1
subpd  %xmm0,%xmm1
addpd  %xmm0,%xmm2
movsd  %xmm1,%xmm2
movupd %xmm2,0x10(%rdi)
ret

LLVM IR (-O0):
define void @test_v4df(double* noalias %0, double* noalias %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 0
store double %11, double* %13
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fadd double %16, %19
%21 = load double*, double** %3
%22 = getelementptr inbounds double, double* %21, i64 1
store double %20, double* %22
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = fsub double %25, %28
%30 = load double*, double** %3
%31 = getelementptr inbounds double, double* %30, i64 2
store double %29, double* %31
%32 = load double*, double** %3
%33 = getelementptr inbounds double, double* %32, i64 3
%34 = load double, double* %33
%35 = load double*, double** %4
%36 = getelementptr inbounds double, double* %35, i64 3
%37 = load double, double* %36
%38 = fadd double %34, %37
%39 = load double*, double** %3
%40 = getelementptr inbounds double, double* %39, i64 3
store double %38, double* %40
ret void
}

LLVM IR (-O2):
define void @test_v4df(double* noalias nocapture %0, double* noalias nocapture %1) {
%3 = bitcast double* %0 to <2 x double>*
%4 = load <2 x double>, <2 x double>* %3
%5 = bitcast double* %1 to <2 x double>*
%6 = load <2 x double>, <2 x double>* %5
%7 = fsub <2 x double> %4, %6
%8 = fadd <2 x double> %4, %6
%9 = shufflevector <2 x double> %7, <2 x double> %8, <2 x i32> <i32 0, i32 3>
%10 = bitcast double* %0 to <2 x double>*
store <2 x double> %9, <2 x double>* %10
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = getelementptr inbounds double, double* %1, i64 2
%13 = bitcast double* %11 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = bitcast double* %12 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = fsub <2 x double> %14, %16
%18 = fadd <2 x double> %14, %16
%19 = shufflevector <2 x double> %17, <2 x double> %18, <2 x i32> <i32 0, i32 3>
%20 = bitcast double* %11 to <2 x double>*
store <2 x double> %19, <2 x double>* %20
ret void
}