void helper_float_4(float *buf) {
  for (int j = 0; j < 16; j += 16) {
    for (int k = 0; k < 8; k += 8) {
      __asm__ volatile("vmovups (%0), %%ymm0\n"
                       "vmovups (%1), %%ymm1\n"
                       "vpermilps $160, %%ymm0, %%ymm8\n"
                       "vpermilps $245, %%ymm0, %%ymm9\n"
                       "vxorps %%ymm10, %%ymm10, %%ymm10\n"
                       "vsubps %%ymm9, %%ymm10, %%ymm11\n"
                       "vaddsubps %%ymm11, %%ymm8, %%ymm0\n"
                       "vpermilps $160, %%ymm1, %%ymm8\n"
                       "vpermilps $245, %%ymm1, %%ymm9\n"
                       "vxorps %%ymm10, %%ymm10, %%ymm10\n"
                       "vsubps %%ymm9, %%ymm10, %%ymm11\n"
                       "vaddsubps %%ymm11, %%ymm8, %%ymm1\n"
                       "vpermilps $68, %%ymm0, %%ymm8\n"
                       "vpermilps $238, %%ymm0, %%ymm9\n"
                       "vxorps %%ymm10, %%ymm10, %%ymm10\n"
                       "vsubps %%ymm9, %%ymm10, %%ymm11\n"
                       "vblendps $204, %%ymm11, %%ymm9, %%ymm12\n"
                       "vaddps %%ymm8, %%ymm12, %%ymm0\n"
                       "vpermilps $68, %%ymm1, %%ymm8\n"
                       "vpermilps $238, %%ymm1, %%ymm9\n"
                       "vxorps %%ymm10, %%ymm10, %%ymm10\n"
                       "vsubps %%ymm9, %%ymm10, %%ymm11\n"
                       "vblendps $204, %%ymm11, %%ymm9, %%ymm12\n"
                       "vaddps %%ymm8, %%ymm12, %%ymm1\n"
                       "vxorps %%ymm8, %%ymm8, %%ymm8\n"
                       "vsubps %%ymm0, %%ymm8, %%ymm9\n"
                       "vperm2f128 $0, %%ymm0, %%ymm0, %%ymm10\n"
                       "vperm2f128 $49, %%ymm9, %%ymm0, %%ymm11\n"
                       "vaddps %%ymm10, %%ymm11, %%ymm0\n"
                       "vxorps %%ymm8, %%ymm8, %%ymm8\n"
                       "vsubps %%ymm1, %%ymm8, %%ymm9\n"
                       "vperm2f128 $0, %%ymm1, %%ymm1, %%ymm10\n"
                       "vperm2f128 $49, %%ymm9, %%ymm1, %%ymm11\n"
                       "vaddps %%ymm10, %%ymm11, %%ymm1\n"
                       "vaddps %%ymm1, %%ymm0, %%ymm8\n"
                       "vsubps %%ymm1, %%ymm0, %%ymm9\n"
                       "vmovups %%ymm8, (%0)\n"
                       "vmovups %%ymm9, (%1)\n" ::"r"(buf + j + k + 0),
                       "r"(buf + j + k + 8)
                       : "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5",
                         "%ymm6", "%ymm7", "%ymm8", "%ymm9", "%ymm10", "%ymm11",
                         "%ymm12", "%ymm13", "%ymm14", "%ymm15", "memory");
    }
  }
}


x86 assembly (clang, -O0):
<helper_float_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1247 <helper_float_4+0x147>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    1234 <helper_float_4+0x134>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
movslq -0x10(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
add    $0x20,%rcx
vmovups (%rax),%ymm0
vmovups (%rcx),%ymm1
vpermilps $0xa0,%ymm0,%ymm8
vpermilps $0xf5,%ymm0,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vaddsubps %ymm11,%ymm8,%ymm0
vpermilps $0xa0,%ymm1,%ymm8
vpermilps $0xf5,%ymm1,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vaddsubps %ymm11,%ymm8,%ymm1
vpermilps $0x44,%ymm0,%ymm8
vpermilps $0xee,%ymm0,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vblendps $0xcc,%ymm11,%ymm9,%ymm12
vaddps %ymm8,%ymm12,%ymm0
vpermilps $0x44,%ymm1,%ymm8
vpermilps $0xee,%ymm1,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vblendps $0xcc,%ymm11,%ymm9,%ymm12
vaddps %ymm8,%ymm12,%ymm1
vxorps %ymm8,%ymm8,%ymm8
vsubps %ymm0,%ymm8,%ymm9
vperm2f128 $0x0,%ymm0,%ymm0,%ymm10
vperm2f128 $0x31,%ymm9,%ymm0,%ymm11
vaddps %ymm10,%ymm11,%ymm0
vxorps %ymm8,%ymm8,%ymm8
vsubps %ymm1,%ymm8,%ymm9
vperm2f128 $0x0,%ymm1,%ymm1,%ymm10
vperm2f128 $0x31,%ymm9,%ymm1,%ymm11
vaddps %ymm10,%ymm11,%ymm1
vaddps %ymm1,%ymm0,%ymm8
vsubps %ymm1,%ymm0,%ymm9
vmovups %ymm8,(%rax)
vmovups %ymm9,(%rcx)
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <helper_float_4+0x20>
jmp    1239 <helper_float_4+0x139>
mov    -0xc(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <helper_float_4+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<helper_float_4>:
lea    0x20(%rdi),%rax
vmovups (%rdi),%ymm0
vmovups (%rax),%ymm1
vpermilps $0xa0,%ymm0,%ymm8
vpermilps $0xf5,%ymm0,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vaddsubps %ymm11,%ymm8,%ymm0
vpermilps $0xa0,%ymm1,%ymm8
vpermilps $0xf5,%ymm1,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vaddsubps %ymm11,%ymm8,%ymm1
vpermilps $0x44,%ymm0,%ymm8
vpermilps $0xee,%ymm0,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vblendps $0xcc,%ymm11,%ymm9,%ymm12
vaddps %ymm8,%ymm12,%ymm0
vpermilps $0x44,%ymm1,%ymm8
vpermilps $0xee,%ymm1,%ymm9
vxorps %ymm10,%ymm10,%ymm10
vsubps %ymm9,%ymm10,%ymm11
vblendps $0xcc,%ymm11,%ymm9,%ymm12
vaddps %ymm8,%ymm12,%ymm1
vxorps %ymm8,%ymm8,%ymm8
vsubps %ymm0,%ymm8,%ymm9
vperm2f128 $0x0,%ymm0,%ymm0,%ymm10
vperm2f128 $0x31,%ymm9,%ymm0,%ymm11
vaddps %ymm10,%ymm11,%ymm0
vxorps %ymm8,%ymm8,%ymm8
vsubps %ymm1,%ymm8,%ymm9
vperm2f128 $0x0,%ymm1,%ymm1,%ymm10
vperm2f128 $0x31,%ymm9,%ymm1,%ymm11
vaddps %ymm10,%ymm11,%ymm1
vaddps %ymm1,%ymm0,%ymm8
vsubps %ymm1,%ymm0,%ymm9
vmovups %ymm8,(%rdi)
vmovups %ymm9,(%rax)
ret

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

LLVM IR (-O2):
define void @helper_float_4(float* %0) {
%2 = getelementptr inbounds float, float* %0, i64 8
tail call void asm sideeffect "vmovups ($0), %ymm0\0Avmovups ($1), %ymm1\0Avpermilps $$160, %ymm0, %ymm8\0Avpermilps $$245, %ymm0, %ymm9\0Avxorps %ymm10, %ymm10, %ymm10\0Avsubps %ymm9, %ymm10, %ymm11\0Avaddsubps %ymm11, %ymm8, %ymm0\0Avpermilps $$160, %ymm1, %ymm8\0Avpermilps $$245, %ymm1, %ymm9\0Avxorps %ymm10, %ymm10, %ymm10\0Avsubps %ymm9, %ymm10, %ymm11\0Avaddsubps %ymm11, %ymm8, %ymm1\0Avpermilps $$68, %ymm0, %ymm8\0Avpermilps $$238, %ymm0, %ymm9\0Avxorps %ymm10, %ymm10, %ymm10\0Avsubps %ymm9, %ymm10, %ymm11\0Avblendps $$204, %ymm11, %ymm9, %ymm12\0Avaddps %ymm8, %ymm12, %ymm0\0Avpermilps $$68, %ymm1, %ymm8\0Avpermilps $$238, %ymm1, %ymm9\0Avxorps %ymm10, %ymm10, %ymm10\0Avsubps %ymm9, %ymm10, %ymm11\0Avblendps $$204, %ymm11, %ymm9, %ymm12\0Avaddps %ymm8, %ymm12, %ymm1\0Avxorps %ymm8, %ymm8, %ymm8\0Avsubps %ymm0, %ymm8, %ymm9\0Avperm2f128 $$0, %ymm0, %ymm0, %ymm10\0Avperm2f128 $$49, %ymm9, %ymm0, %ymm11\0Avaddps %ymm10, %ymm11, %ymm0\0Avxorps %ymm8, %ymm8, %ymm8\0Avsubps %ymm1, %ymm8, %ymm9\0Avperm2f128 $$0, %ymm1, %ymm1, %ymm10\0Avperm2f128 $$49, %ymm9, %ymm1, %ymm11\0Avaddps %ymm10, %ymm11, %ymm1\0Avaddps %ymm1, %ymm0, %ymm8\0Avsubps %ymm1, %ymm0, %ymm9\0Avmovups %ymm8, ($0)\0Avmovups %ymm9, ($1)\0A", "r,r,~{ymm0},~{ymm1},~{ymm2},~{ymm3},~{ymm4},~{ymm5},~{ymm6},~{ymm7},~{ymm8},~{ymm9},~{ymm10},~{ymm11},~{ymm12},~{ymm13},~{ymm14},~{ymm15},~{memory},~{dirflag},~{fpsr},~{flags}"(float* %0, float* %2)
ret void
}