<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 - vectorization differences"
   href="https://bugs.llvm.org/show_bug.cgi?id=39597">39597</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>vectorization differences
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>trass3r@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>void foo(unsigned* x)
{
    for (int i = 0; i < 8; ++i)
            x[i] = (x[i] % 3 == 0) ? 0 : x[i];
}

void bar(unsigned* x)
{
    for (int i = 0; i < 8; ++i)
        if (x[i] % 3 == 0)
            x[i] = 0;
}

$ clang -O3 -march=haswell -Rpass="loop|vect" -Rpass-missed="loop|vect"
-Rpass-analysis="loop|vect"

<source>:3:5: remark: completely unrolled loop with 8 iterations
[-Rpass=loop-unroll]
<source>:9:5: remark: completely unrolled loop with 8 iterations
[-Rpass=loop-unroll]
<source>:4:18: remark: Stores SLP vectorized with cost -17 and with tree size 8
[-Rpass=slp-vectorizer]

$ clang -O3 -fno-unroll-loops -march=haswell -Rpass="loop|vect"
-Rpass-missed="loop|vect" -Rpass-analysis="loop|vect"

<source>:3:5: remark: vectorized loop (vectorization width: 8, interleaved
count: 1) [-Rpass=loop-vectorize]
<source>:9:5: remark: vectorized loop (vectorization width: 8, interleaved
count: 1) [-Rpass=loop-vectorize]


The generated code is different in all 4 cases:
<a href="https://godbolt.org/z/7EaJfc">https://godbolt.org/z/7EaJfc</a></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>