https://bugs.llvm.org/show_bug.cgi?id=48923

            Bug ID: 48923
           Summary: __builtin_fabsl in stdlib.h is not guarded but not
                    available for nvptx (among others)
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Standards Issues
          Assignee: unassignedclangb...@nondot.org
          Reporter: jdoerf...@anl.gov
                CC: a.bat...@hotmail.com, llvm-bugs@lists.llvm.org,
                    mariya.podchishcha...@intel.com,
                    mclow.li...@gmail.com, tianshilei1...@gmail.com

When we compile the OpenMP device (=GPU) runtime, or any OpenMP device code
which includes stdlib from libc++, we are presented with an error:

```
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/common/src/cancel.cu:15:
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/common/debug.h:31:
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/common/device_environment.h:16:
In file included from
/mnt/scratch/elwasif/llvm-git/llvm-project/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h:18:
/mnt/scratch/elwasif/llvm-git/clang-fixed/bin/../include/c++/v1/stdlib.h:128:10:
error: '__builtin_fabsl' requires 128 bit size 'long double' type support, but
device 'nvptx64' does not support it
  return __builtin_fabsl(__lcpp_x);
```

This was probably introduced by https://reviews.llvm.org/D74387 .
It is unclear to me how to handle this. One way would eb to guard the builtin
use. 

FWIW, when we target nvptx from C/C++ code right away clang simply demotes
`long double` into `double` which I find highly questionable and which can
cause all sorts of havock if we talk about memory:
https://clang.godbolt.org/z/eq6dPc

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to