[OpenMP][CUDA][FIX] Use the new `remquo` overload only for OpenMP
authorJohannes Doerfert <johannes@jdoerfert.de>
Wed, 28 Oct 2020 04:50:00 +0000 (23:50 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Wed, 28 Oct 2020 04:52:59 +0000 (23:52 -0500)
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.

clang/lib/Headers/__clang_cuda_cmath.h

index 92f3011..5bbb59a 100644 (file)
@@ -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