<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Suboptimal code after vectorization of not unrolled loop with 8 iterations"
   href="https://bugs.llvm.org/show_bug.cgi?id=42411">42411</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Suboptimal code after vectorization of not unrolled loop with 8 iterations
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.bolvansky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Found in PR42410.

void foo (int *__restrict arr1, int *__restrict arr2)
{
  for (int i = 0; i < 8; i++)
    arr1[i] += arr2[i];
}

Clang -O3 -march=skylake -fno-unroll-loops 

foo(int*, int*):                             # @foo(int*, int*)
        xor     eax, eax
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
        vmovdqu ymm0, ymmword ptr [rdi + 4*rax]
        vpaddd  ymm0, ymm0, ymmword ptr [rsi + 4*rax]
        vmovdqu ymmword ptr [rdi + 4*rax], ymm0
        add     rax, 8
        cmp     rax, 8
        jne     .LBB0_1
        vzeroupper
        ret

GCC / ICC produces with same flags:
foo(int*, int*):
        vmovdqu   ymm0, YMMWORD PTR [rdi]                       #6.5
        vpaddd    ymm1, ymm0, YMMWORD PTR [rsi]                 #6.5
        vmovdqu   YMMWORD PTR [rdi], ymm1                       #6.5
        vzeroupper                                              #7.1
        ret</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>