[Openmp-commits] [PATCH] D93328: [libomptarget][nfc] Replace static const with enum
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Dec 15 12:04:44 PST 2020
JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, ABataev, grokos, tianshilei1992.
Herald added a subscriber: jvesely.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
[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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93328
Files:
openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -91,8 +91,9 @@
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;
Index: openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
@@ -74,8 +74,9 @@
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93328.311985.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201215/3dcdc83f/attachment.bin>
More information about the Openmp-commits
mailing list