<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - logf function call not auto-vectorizing"
   href="https://llvm.org/bugs/show_bug.cgi?id=30837">30837</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>logf function call not auto-vectorizing
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.9
          </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>eric@ericmart.in
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17513" name="attach_17513" title="C test case, sh command to invoke clang, and example faulty IR">attachment 17513</a> <a href="attachment.cgi?id=17513&action=edit" title="C test case, sh command to invoke clang, and example faulty IR">[details]</a></span>
C test case, sh command to invoke clang, and example faulty IR

I've written 2 test functions in C that take in a float array x of size n and
output float array f(x), where f is either fabsf or logf. The LLVM 3.9
auto-vectorization docs claim that both functions will be vectorized:
<a href="http://llvm.org/releases/3.9.0/docs/Vectorizers.html#vectorization-of-function-calls">http://llvm.org/releases/3.9.0/docs/Vectorizers.html#vectorization-of-function-calls</a>

When running with "clang -O3 -march=x86-64 -mavx2 -ffast-math test.c -S
-emit-llvm", the function calling fabsf is vectorized while the function
calling logf is not.  This is with clang 3.9, but I've also confirmed the bug
exists back to at least clang 3.7. I've also observed that logf calls break
vectorization of more complex loops, and I provide the comparison with fabsf as
a reduced test case.

I've attached the C program, a sh script to invoke clang with correct
arguments, and an example LLVM IR file I produced by running on my system.</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>