[libomptarget][nfc] Replace static const with enum
authorJon Chesterfield <jonathanchesterfield@gmail.com>
Wed, 16 Dec 2020 16:40:21 +0000 (16:40 +0000)
committerJon Chesterfield <jonathanchesterfield@gmail.com>
Wed, 16 Dec 2020 16:40:37 +0000 (16:40 +0000)
[libomptarget][nfc] Replace static const with enum

Semantically identical. Replaces 0xff... with ~0 to spare counting the f.
Has the advantage that the compiler doesn't need to prove the 4/8 byte
value dead before discarding it, and sidesteps the compilation question
associated with what static means for a single source language.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D93328

openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h

index 34794587e0fe7dcc6ba3a4d5ddcaadd0e2f9fab5..d25ea8559c05d8f346f199995542b2799a41dcbb 100644 (file)
@@ -74,8 +74,9 @@ INLINE uint64_t __kmpc_impl_pack(uint32_t lo, uint32_t hi) {
   return (((uint64_t)hi) << 32) | (uint64_t)lo;
 }
 
-static const __kmpc_impl_lanemask_t __kmpc_impl_all_lanes =
-    UINT64_C(0xffffffffffffffff);
+enum : __kmpc_impl_lanemask_t {
+  __kmpc_impl_all_lanes = ~(__kmpc_impl_lanemask_t)0
+};
 
 DEVICE __kmpc_impl_lanemask_t __kmpc_impl_lanemask_lt();
 
index 46ce751c44c4dc343f7052c5a1db85287471272e..411e1676b7c7da52cb1827d21c1563507550ad71 100644 (file)
@@ -91,8 +91,9 @@ INLINE uint64_t __kmpc_impl_pack(uint32_t lo, uint32_t hi) {
   return val;
 }
 
-static const __kmpc_impl_lanemask_t __kmpc_impl_all_lanes =
-    UINT32_C(0xffffffff);
+enum : __kmpc_impl_lanemask_t {
+  __kmpc_impl_all_lanes = ~(__kmpc_impl_lanemask_t)0
+};
 
 INLINE __kmpc_impl_lanemask_t __kmpc_impl_lanemask_lt() {
   __kmpc_impl_lanemask_t res;