<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 - Need math function in target region"
   href="https://bugs.llvm.org/show_bug.cgi?id=41090">41090</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Need math function in target region
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Clang Compiler Support
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>xw111luoye@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21605" name="attach_21605" title="cmath_modf.cpp">attachment 21605</a> <a href="attachment.cgi?id=21605&action=edit" title="cmath_modf.cpp">[details]</a></span>
cmath_modf.cpp

I built the llvm+clang+openmp today and realized there is no math function
support in the target region. Math functions are required for dealing with
numerics. I got two type of errors. One case is missing functions at linking.
The one gives the compiler error.

clang++ -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda cmath_modf.cpp 

I got:
nvlink error   : Undefined reference to 'modff' in
'/tmp/cmath_modf-3ac5b8.cubin'
nvlink error   : Undefined reference to 'modf' in
'/tmp/cmath_modf-3ac5b8.cubin'

I also need sin, sinf, cos, cosf, sincos, sincosf.
For sincos and sincosf, I got similar error as above.
For sin, sinf, cos, cosf, I got:
fatal error: error in backend: Cannot select: 0x629cf70: f32 = fsin
ConstantFP:f32<1.100000e+00>
  0x629d588: f32 = ConstantFP<1.100000e+00>
In function: __omp_offloading_805_364255c_main_l6
clang-9: error: clang frontend command failed with exit code 70 (use -v to see
invocation)</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>