<html>
    <head>
      <base href="http://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 --- - -freciprocal-math flag doesn't generate 'arcp' in LLVM IR"
   href="http://llvm.org/bugs/show_bug.cgi?id=20912">20912</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-freciprocal-math flag doesn't generate 'arcp' in LLVM IR
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm filing this purely as a clang bug to generate the 'arcp' fast math flag
when -freciprocal-math is specified as a parameter. More changes are needed to
produce the correct machine code.

Reference: The addition of fast-math flags to LLVM IR happened in 2012:
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-October/054999.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-October/054999.html</a>

...but there appears to have been very little follow-up in making those flags
actually do anything (see also <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - no-signed-zero optimization flag isn't honored for an fneg operation"
   href="show_bug.cgi?id=20870">bug 20870</a>).

$ ./clang -v
clang version 3.6.0 (217587)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

$ cat reciprocal.c
float reciprocal(float x) {
    return 1.0f / x;
}

$ ./clang -O1 -freciprocal-math reciprocal.c -emit-llvm -S -o -
...
  %div = fdiv float 1.000000e+00, %x ; "arcp" ???</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>