Go to the documentation of this file.
10 #ifndef vtk_m_internal_Assume_h
11 #define vtk_m_internal_Assume_h
27 #define VTKM_ASSUME(cond) \
28 VTKM_SWALLOW_SEMICOLON_PRE_BLOCK \
30 const bool c = cond; \
31 VTKM_ASSERT("Bad assumption in VTKM_ASSUME: " #cond&& c); \
32 VTKM_ASSUME_IMPL(c); \
35 VTKM_SWALLOW_SEMICOLON_POST_BLOCK
38 #if defined(VTKM_CUDA_DEVICE_PASS)
41 #define VTKM_ASSUME_IMPL(cond) (void)0
44 #if defined(VTKM_MSVC)
45 #define VTKM_ASSUME_IMPL(cond) __assume(cond)
46 #elif defined(VTKM_ICC) && !defined(__GNUC__)
47 #define VTKM_ASSUME_IMPL(cond) __assume(cond)
48 #elif (defined(VTKM_GCC) || defined(VTKM_ICC)) && \
49 (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
51 #define VTKM_ASSUME_IMPL(cond) \
53 __builtin_unreachable()
54 #elif defined(VTKM_CLANG)
55 #define VTKM_ASSUME_IMPL(cond) \
57 __builtin_unreachable()
59 #define VTKM_ASSUME_IMPL(cond) (void)0
64 #endif // vtk_m_internal_Assume_h