[clang] 17c8251 - [OpenMP][CUDA][FIX] Use the new `remquo` overload only for OpenMP

Johannes Doerfert via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 21:53:21 PDT 2020


Author: Johannes Doerfert
Date: 2020-10-27T23:52:59-05:00
New Revision: 17c8251bca83072d2f3e00f936d6ce24500e6b02

URL: https://github.com/llvm/llvm-project/commit/17c8251bca83072d2f3e00f936d6ce24500e6b02
DIFF: https://github.com/llvm/llvm-project/commit/17c8251bca83072d2f3e00f936d6ce24500e6b02.diff

LOG: [OpenMP][CUDA][FIX] Use the new `remquo` overload only for OpenMP

CUDA buildbots complained about a redefinition when I landed D89971.
This is odd and I fail to understand where in the CUDA headers the other
definition is supposed to be. For now, given that CUDA doesn't need the
overload (AFAIKT), we simply restrict it to the OpenMP mode.

Added: 
    

Modified: 
    clang/lib/Headers/__clang_cuda_cmath.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/__clang_cuda_cmath.h b/clang/lib/Headers/__clang_cuda_cmath.h
index 92f3011c18ee..5bbb59a93b9e 100644
--- a/clang/lib/Headers/__clang_cuda_cmath.h
+++ b/clang/lib/Headers/__clang_cuda_cmath.h
@@ -174,9 +174,15 @@ __DEVICE__ float sinh(float __x) { return ::sinhf(__x); }
 __DEVICE__ float sqrt(float __x) { return ::sqrtf(__x); }
 __DEVICE__ float tan(float __x) { return ::tanf(__x); }
 __DEVICE__ float tanh(float __x) { return ::tanhf(__x); }
+
+// There was a redefinition error for this this overload in CUDA mode.
+// We restrict it to OpenMP mode for now, that is where it is actually needed
+// anyway.
+#ifdef __OPENMP_NVPTX__
 __DEVICE__ float remquo(float __n, float __d, int *__q) {
   return ::remquof(__n, __d, __q);
 }
+#endif
 
 // Notably missing above is nexttoward.  We omit it because
 // libdevice doesn't provide an implementation, and we don't want to be in the


        


More information about the cfe-commits mailing list