jlebar created this revision.
jlebar added a reviewer: rsmith.
jlebar added a subscriber: cfe-commits.

The CUDA headers look for __USE_FAST_MATH__.

http://reviews.llvm.org/D20481

Files:
  lib/Headers/__clang_cuda_runtime_wrapper.h

Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -42,6 +42,13 @@
 
 #if defined(__CUDA__) && defined(__clang__)
 
+// The CUDA headers use the __USE_FAST_MATH__ macro to determine whether we get
+// the slow-but-accurate or fast-but-inaccurate versions of functions like sin
+// and exp, but -ffast-math defines only __FAST_MATH__.
+#if defined(__FAST_MATH__) && !defined(__USE_FAST_MATH__)
+#define __USE_FAST_MATH__
+#endif
+
 // Include some forward declares that must come before cmath.
 #include <__clang_cuda_math_forward_declares.h>
 


Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -42,6 +42,13 @@
 
 #if defined(__CUDA__) && defined(__clang__)
 
+// The CUDA headers use the __USE_FAST_MATH__ macro to determine whether we get
+// the slow-but-accurate or fast-but-inaccurate versions of functions like sin
+// and exp, but -ffast-math defines only __FAST_MATH__.
+#if defined(__FAST_MATH__) && !defined(__USE_FAST_MATH__)
+#define __USE_FAST_MATH__
+#endif
+
 // Include some forward declares that must come before cmath.
 #include <__clang_cuda_math_forward_declares.h>
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to