[PATCH] D47849: [OpenMP][Clang][NVPTX] Enable math functions called in an OpenMP NVPTX target device region to be resolved as device-native function calls

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 8 07:44:09 PDT 2018


Hahnfeld added a comment.

In https://reviews.llvm.org/D47849#1192321, @gtbercea wrote:

> > IIRC you started to work on this to fix the problem with inline assembly (see https://reviews.llvm.org/D47849#1125019). AFAICS this patch fixes declarations of math functions but you still cannot include `math.h` which most "correct" codes do.
>
> I'm not sure what you mean by this. This patch enables me to include math.h.


`math.c`:

  #include <math.h>

executed commands:

   $ clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -c math.c -O2
  In file included from math.c:1:
  In file included from /usr/include/math.h:413:
  /usr/include/bits/mathinline.h:131:43: error: invalid input constraint 'x' in asm
    __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
                                            ^
  /usr/include/bits/mathinline.h:143:43: error: invalid input constraint 'x' in asm
    __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
                                            ^
  2 errors generated.


Repository:
  rC Clang

https://reviews.llvm.org/D47849





More information about the cfe-commits mailing list