[clang] 12c5a46 - [Clang] Fix incorrect condition on ballot
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 17:15:30 PST 2025
Author: Joseph Huber
Date: 2025-03-05T19:15:23-06:00
New Revision: 12c5a46c300eedb6cafc68b987abb9c1fa913e96
URL: https://github.com/llvm/llvm-project/commit/12c5a46c300eedb6cafc68b987abb9c1fa913e96
DIFF: https://github.com/llvm/llvm-project/commit/12c5a46c300eedb6cafc68b987abb9c1fa913e96.diff
LOG: [Clang] Fix incorrect condition on ballot
Summary:
Somehow these got the `!` dropped and it wasn't tested because the
existing test only used the 32-bit variant.
Added:
Modified:
clang/lib/Headers/amdgpuintrin.h
clang/lib/Headers/nvptxintrin.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/amdgpuintrin.h b/clang/lib/Headers/amdgpuintrin.h
index 6ad8e54f4aadd..15409eacf7716 100644
--- a/clang/lib/Headers/amdgpuintrin.h
+++ b/clang/lib/Headers/amdgpuintrin.h
@@ -187,7 +187,7 @@ __gpu_match_any_u64(uint64_t __lane_mask, uint64_t __x) {
uint64_t __match_mask = 0;
bool __done = 0;
- while (__gpu_ballot(__lane_mask, __done)) {
+ while (__gpu_ballot(__lane_mask, !__done)) {
if (!__done) {
uint64_t __first = __gpu_read_first_lane_u64(__lane_mask, __x);
if (__first == __x) {
diff --git a/clang/lib/Headers/nvptxintrin.h b/clang/lib/Headers/nvptxintrin.h
index 03594dd9bd6cb..7af22baccb511 100644
--- a/clang/lib/Headers/nvptxintrin.h
+++ b/clang/lib/Headers/nvptxintrin.h
@@ -207,7 +207,7 @@ __gpu_match_any_u64(uint64_t __lane_mask, uint64_t __x) {
uint64_t __match_mask = 0;
bool __done = 0;
- while (__gpu_ballot(__lane_mask, __done)) {
+ while (__gpu_ballot(__lane_mask, !__done)) {
if (!__done) {
uint64_t __first = __gpu_read_first_lane_u64(__lane_mask, __x);
if (__first == __x) {
More information about the cfe-commits
mailing list