[llvm-bugs] [Bug 28457] New: 256bit AVX vectorization sometimes forgets about 128bit packed instructions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 7 09:44:13 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28457

            Bug ID: 28457
           Summary: 256bit AVX vectorization sometimes forgets about
                    128bit packed instructions
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nowak-llvm at tepeserwery.pl
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Compiled with: -O3 -ffast-math -Rpass=loop- -fslp-vectorize-aggressive -msse
-msse2 -msse3 -mssse3 -msse4 -msse4.1 -mavx

f1 is correctly vectorized with both 256 and 128 bit packed instructions.
f2 is correctly vectorized with 256 bit packed instructions but remaining 4
iterations are handled with scalar instructions instead of 128 bit packed.

void f1(float *__restrict__ q __attribute__((align_value(32))), float
*__restrict__ p __attribute__((align_value(32)))) {
  for (unsigned int i = 0; i < (8 * 1 + 4); ++i) {
// remark: completely unrolled loop with 12 iterations
    q[i] = p[i] + 1.0f;
  }
}
void f2(float *__restrict__ q __attribute__((align_value(32))), float
*__restrict__ p __attribute__((align_value(32)))) {
  for (unsigned int i = 0; i < (8 * 5 + 4); ++i) {
// remark: vectorized loop (vectorization width: 8, interleaved count: 1)
// remark: completely unrolled loop with 5 iterations
// remark: completely unrolled loop with 4 iterations
    q[i] = p[i] + 1.0f;
  }
}

f1(float*, float*):                              # @f1(float*, float*)
        vmovaps (%rsi), %ymm0
        vaddps  .LCPI0_0(%rip), %ymm0, %ymm0
        vmovaps %ymm0, (%rdi)
        vmovaps 32(%rsi), %xmm0
        vaddps  .LCPI0_1(%rip), %xmm0, %xmm0
        vmovaps %xmm0, 32(%rdi)
        vzeroupper
        retq

f2(float*, float*):                              # @f2(float*, float*)
        vmovaps .LCPI1_0(%rip), %ymm0   # ymm0 =
[1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
        vaddps  (%rsi), %ymm0, %ymm1
        vmovaps %ymm1, (%rdi)
        vaddps  32(%rsi), %ymm0, %ymm1
        vmovaps %ymm1, 32(%rdi)
        vaddps  64(%rsi), %ymm0, %ymm1
        vmovaps %ymm1, 64(%rdi)
        vaddps  96(%rsi), %ymm0, %ymm1
        vmovaps %ymm1, 96(%rdi)
        vaddps  128(%rsi), %ymm0, %ymm0
        vmovaps %ymm0, 128(%rdi)
        vmovss  .LCPI1_1(%rip), %xmm0   # xmm0 = mem[0],zero,zero,zero
        vaddss  160(%rsi), %xmm0, %xmm1
        vmovss  %xmm1, 160(%rdi)
        vaddss  164(%rsi), %xmm0, %xmm1
        vmovss  %xmm1, 164(%rdi)
        vaddss  168(%rsi), %xmm0, %xmm1
        vmovss  %xmm1, 168(%rdi)
        vaddss  172(%rsi), %xmm0, %xmm0
        vmovss  %xmm0, 172(%rdi)
        vzeroupper

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160707/222b3ded/attachment-0001.html>


More information about the llvm-bugs mailing list