[llvm-bugs] [Bug 48923] New: __builtin_fabsl in stdlib.h is not guarded but not available for nvptx (among others)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 28 10:01:51 PST 2021


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: unassignedclangbugs at nondot.org
          Reporter: jdoerfert at anl.gov
                CC: a.bataev at hotmail.com, llvm-bugs at lists.llvm.org,
                    mariya.podchishchaeva at intel.com,
                    mclow.lists at gmail.com, tianshilei1992 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210128/eefd71fc/attachment-0001.html>


More information about the llvm-bugs mailing list