[clang] [CUDA][Win32] Add `fma(long double,..)` to math forward declares. (PR #73756)

Evgeny Mankov via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 11:58:32 PST 2023


================
@@ -70,6 +70,9 @@ __DEVICE__ double floor(double);
 __DEVICE__ float floor(float);
 __DEVICE__ double fma(double, double, double);
 __DEVICE__ float fma(float, float, float);
+#ifdef _MSC_VER
+__DEVICE__ long double fma(long double, long double, long double);
----------------
emankov wrote:

That's right, CUDA has provided `long double fma` since 10.2 but for `HOST` only:

```cpp
inline _LIBCUDACXX_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
```

If a declaration of `device long double fma` is needed in order to parse it only and with disallowing its usage on GPU, then it is better to add it to `clang/lib/Headers/cuda_wrappers/cmath` under `_LIBCPP_STD_VER` and `_LIBCPP_HIDE_FROM_ABI`; and it would need a corresponding `GPU` test, of course.

https://github.com/llvm/llvm-project/pull/73756


More information about the cfe-commits mailing list