Author: Artem Belevich Date: 2025-05-12T12:50:47-07:00 New Revision: 8d7b35eeffa4ce6b8781eac4012ead7d5422264a
URL: https://github.com/llvm/llvm-project/commit/8d7b35eeffa4ce6b8781eac4012ead7d5422264a DIFF: https://github.com/llvm/llvm-project/commit/8d7b35eeffa4ce6b8781eac4012ead7d5422264a.diff LOG: [CUDA] Remove obsolete GPU-side __constexpr_* wrappers. (#139164) Added: Modified: clang/lib/Headers/cuda_wrappers/cmath Removed: ################################################################################ diff --git a/clang/lib/Headers/cuda_wrappers/cmath b/clang/lib/Headers/cuda_wrappers/cmath index 7deca678bf252..8e9ee34791965 100644 --- a/clang/lib/Headers/cuda_wrappers/cmath +++ b/clang/lib/Headers/cuda_wrappers/cmath @@ -39,56 +39,6 @@ __attribute__((device)) long double logb(long double); __attribute__((device)) long double scalbn(long double, int); -namespace std { - -// For __constexpr_fmin/fmax we only need device-side overloads before c++14 -// where they are not constexpr. -#if _LIBCPP_STD_VER < 14 - -__attribute__((device)) -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 float __constexpr_fmax(float __x, float __y) _NOEXCEPT { - return __builtin_fmaxf(__x, __y); -} - -__attribute__((device)) -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 double __constexpr_fmax(double __x, double __y) _NOEXCEPT { - return __builtin_fmax(__x, __y); -} - -__attribute__((device)) -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 long double -__constexpr_fmax(long double __x, long double __y) _NOEXCEPT { - return __builtin_fmaxl(__x, __y); -} - -template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value && is_arithmetic<_Up>::value, int> = 0> -__attribute__((device)) -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __promote<_Tp, _Up>::type -__constexpr_fmax(_Tp __x, _Up __y) _NOEXCEPT { - using __result_type = typename __promote<_Tp, _Up>::type; - return std::__constexpr_fmax(static_cast<__result_type>(__x), static_cast<__result_type>(__y)); -} -#endif // _LIBCPP_STD_VER < 14 - -// For logb/scalbn templates we must always provide device overloads because -// libc++ implementation uses __builtin_XXX which gets translated into a libcall -// which we can't handle on GPU. We need to forward those to CUDA-provided -// implementations. - -template <class _Tp> -__attribute__((device)) -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __constexpr_logb(_Tp __x) { - return ::logb(__x); -} - -template <class _Tp> -__attribute__((device)) -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp __constexpr_scalbn(_Tp __x, int __exp) { - return ::scalbn(__x, __exp); -} - -} // namespace std// - #endif // _LIBCPP_STD_VER #endif // include guard _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits