[PATCH] D104904: [OpenMP][AMDGCN] Initial math headers support
Jon Chesterfield via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 30 01:59:43 PDT 2021
JonChesterfield added inline comments.
================
Comment at: clang/lib/Headers/__clang_hip_cmath.h:43
+__DEVICE__ __CONSTEXPR__ long abs(long __n) { return ::labs(__n); }
+__DEVICE__ __CONSTEXPR__ float fma(float __x, float __y, float __z) {
return ::fmaf(__x, __y, __z);
----------------
I'm pretty sure it's UB, no diagnostic req to call a non-constexpr function from a constexpr one. Nevertheless, it does presently seem to be working for nvptx clang so will probably work for amdgcn.
Strictly I think we're supposed to detect when called at compile time and call one implementation and otherwise call the library one, where weirdly it's ok for them to return different answers. I think there's a built-in we can call to select between the two.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104904/new/
https://reviews.llvm.org/D104904
More information about the cfe-commits
mailing list