llvm-runtime-resources-darwin 22.1.8 → 23.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/include/__clang_cuda_complex_builtins.h +10 -3
  2. package/include/__clang_cuda_intrinsics.h +207 -226
  3. package/include/__clang_cuda_math_forward_declares.h +5 -0
  4. package/include/__clang_cuda_runtime_wrapper.h +9 -5
  5. package/include/__clang_gpu_builtin_vars.h +71 -0
  6. package/include/__clang_gpu_device_functions.h +411 -0
  7. package/include/__clang_gpu_intrinsics.h +242 -0
  8. package/include/__clang_hip_libdevice_declares.h +0 -102
  9. package/include/__clang_hip_math.h +3 -3
  10. package/include/__clang_hip_runtime_wrapper.h +6 -1
  11. package/include/__clang_spirv_libdevice_declares.h +170 -0
  12. package/include/__clang_spirv_math.h +719 -0
  13. package/include/altivec.h +79 -9
  14. package/include/amdgpuintrin.h +2 -29
  15. package/include/amdhsa_abi.h +83 -0
  16. package/include/amo.h +89 -0
  17. package/include/andes_vector.h +5 -0
  18. package/include/arm64_neon.h +21 -0
  19. package/include/arm64intr.h +10 -0
  20. package/include/arm_acle.h +1 -0
  21. package/include/arm_neon.h +3922 -3754
  22. package/include/arm_sme.h +12 -0
  23. package/include/arm_sve.h +420 -0
  24. package/include/avx2intrin.h +4 -5
  25. package/include/avx512bmmintrin.h +174 -0
  26. package/include/avx512bmmvlintrin.h +245 -0
  27. package/include/avx512bwintrin.h +19 -29
  28. package/include/avx512fintrin.h +62 -89
  29. package/include/avx512fp16intrin.h +12 -18
  30. package/include/avx512vbmi2intrin.h +12 -16
  31. package/include/avx512vlbwintrin.h +24 -36
  32. package/include/avx512vlintrin.h +80 -96
  33. package/include/avx512vlvbmi2intrin.h +24 -32
  34. package/include/avx512vlvnniintrin.h +29 -34
  35. package/include/avx512vnniintrin.h +32 -35
  36. package/include/avx512vp2intersectintrin.h +1 -1
  37. package/include/avxvnniintrin.h +23 -18
  38. package/include/crc32intrin.h +10 -8
  39. package/include/emmintrin.h +8 -8
  40. package/include/endian.h +91 -0
  41. package/include/fuzzer/FuzzedDataProvider.h +3 -3
  42. package/include/gpuintrin.h +123 -105
  43. package/include/hlsl_alias_intrinsics_gen.inc +3869 -0
  44. package/include/hlsl_inline_intrinsics_gen.inc +546 -0
  45. package/include/hvx_hexagon_protos.h +102 -80
  46. package/include/immintrin.h +4 -2
  47. package/include/intrin.h +20 -10
  48. package/include/larchintrin.h +2 -0
  49. package/include/llvm_libc_wrappers/ctype.h +3 -2
  50. package/include/llvm_libc_wrappers/string.h +3 -2
  51. package/include/module.modulemap +16 -1
  52. package/include/nvptxintrin.h +15 -26
  53. package/include/opencl-c-base.h +7 -0
  54. package/include/opencl-c.h +163 -102
  55. package/include/openmp_wrappers/__clang_openmp_device_functions.h +14 -0
  56. package/include/openmp_wrappers/complex +7 -1
  57. package/include/openmp_wrappers/complex.h +6 -0
  58. package/include/openmp_wrappers/math.h +10 -0
  59. package/include/profile/InstrProfData.inc +65 -3
  60. package/include/ptrauth.h +90 -12
  61. package/include/riscv_bitmanip.h +7 -0
  62. package/include/riscv_corev_alu.h +2 -0
  63. package/include/riscv_crypto.h +8 -0
  64. package/include/riscv_mips.h +2 -0
  65. package/include/riscv_nds.h +3 -0
  66. package/include/riscv_ntlh.h +2 -0
  67. package/include/riscv_packed_simd.h +644 -0
  68. package/include/riscv_vector.h +43 -0
  69. package/include/sanitizer/asan_interface.h +51 -1
  70. package/include/sanitizer/common_interface_defs.h +12 -49
  71. package/include/sanitizer/safestack_interface.h +50 -0
  72. package/include/sanitizer/tysan_interface.h +36 -0
  73. package/include/sanitizer/ubsan_interface.h +30 -0
  74. package/include/sifive_vector.h +18 -0
  75. package/include/spirvintrin.h +2 -29
  76. package/include/stdint.h +5 -14
  77. package/include/vecintrin.h +1 -1
  78. package/include/wasm_simd128.h +17 -0
  79. package/include/xmmintrin.h +8 -7
  80. package/include/zos_wrappers/grp.h +19 -0
  81. package/include/zos_wrappers/locale.h +19 -0
  82. package/include/zos_wrappers/math.h +31 -0
  83. package/include/zos_wrappers/poll.h +19 -0
  84. package/include/zos_wrappers/stdlib.h +20 -0
  85. package/include/zos_wrappers/string.h +19 -0
  86. package/include/zos_wrappers/time.h +19 -0
  87. package/include/zos_wrappers/variant.h +19 -0
  88. package/lib/darwin/libclang_rt.asan_abi_ios.a +0 -0
  89. package/lib/darwin/libclang_rt.asan_abi_iossim.a +0 -0
  90. package/lib/darwin/libclang_rt.asan_abi_osx.a +0 -0
  91. package/lib/darwin/libclang_rt.asan_ios_dynamic.dylib +0 -0
  92. package/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib +0 -0
  93. package/lib/darwin/libclang_rt.asan_osx_dynamic.dylib +0 -0
  94. package/lib/darwin/libclang_rt.cc_kext.a +0 -0
  95. package/lib/darwin/libclang_rt.cc_kext_ios.a +0 -0
  96. package/lib/darwin/libclang_rt.fuzzer_ios.a +0 -0
  97. package/lib/darwin/libclang_rt.fuzzer_iossim.a +0 -0
  98. package/lib/darwin/libclang_rt.fuzzer_no_main_ios.a +0 -0
  99. package/lib/darwin/libclang_rt.fuzzer_no_main_iossim.a +0 -0
  100. package/lib/darwin/libclang_rt.fuzzer_no_main_osx.a +0 -0
  101. package/lib/darwin/libclang_rt.fuzzer_osx.a +0 -0
  102. package/lib/darwin/libclang_rt.ios.a +0 -0
  103. package/lib/darwin/libclang_rt.iossim.a +0 -0
  104. package/lib/darwin/libclang_rt.lsan_ios_dynamic.dylib +0 -0
  105. package/lib/darwin/libclang_rt.lsan_iossim_dynamic.dylib +0 -0
  106. package/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib +0 -0
  107. package/lib/darwin/libclang_rt.osx.a +0 -0
  108. package/lib/darwin/libclang_rt.profile_ios.a +0 -0
  109. package/lib/darwin/libclang_rt.profile_iossim.a +0 -0
  110. package/lib/darwin/libclang_rt.profile_osx.a +0 -0
  111. package/lib/darwin/libclang_rt.rtsan_ios_dynamic.dylib +0 -0
  112. package/lib/darwin/libclang_rt.rtsan_iossim_dynamic.dylib +0 -0
  113. package/lib/darwin/libclang_rt.rtsan_osx_dynamic.dylib +0 -0
  114. package/lib/darwin/libclang_rt.stats_client_ios.a +0 -0
  115. package/lib/darwin/libclang_rt.stats_client_iossim.a +0 -0
  116. package/lib/darwin/libclang_rt.stats_client_osx.a +0 -0
  117. package/lib/darwin/libclang_rt.stats_ios_dynamic.dylib +0 -0
  118. package/lib/darwin/libclang_rt.stats_iossim_dynamic.dylib +0 -0
  119. package/lib/darwin/libclang_rt.stats_osx_dynamic.dylib +0 -0
  120. package/lib/darwin/libclang_rt.tsan_ios_dynamic.dylib +0 -0
  121. package/lib/darwin/libclang_rt.tsan_iossim_dynamic.dylib +0 -0
  122. package/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib +0 -0
  123. package/lib/darwin/libclang_rt.tysan_ios_dynamic.dylib +0 -0
  124. package/lib/darwin/libclang_rt.tysan_iossim_dynamic.dylib +0 -0
  125. package/lib/darwin/libclang_rt.tysan_osx_dynamic.dylib +0 -0
  126. package/lib/darwin/libclang_rt.ubsan_ios_dynamic.dylib +0 -0
  127. package/lib/darwin/libclang_rt.ubsan_iossim_dynamic.dylib +0 -0
  128. package/lib/darwin/libclang_rt.ubsan_minimal_ios.a +0 -0
  129. package/lib/darwin/libclang_rt.ubsan_minimal_ios_dynamic.dylib +0 -0
  130. package/lib/darwin/libclang_rt.ubsan_minimal_iossim.a +0 -0
  131. package/lib/darwin/libclang_rt.ubsan_minimal_iossim_dynamic.dylib +0 -0
  132. package/lib/darwin/libclang_rt.ubsan_minimal_osx.a +0 -0
  133. package/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib +0 -0
  134. package/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib +0 -0
  135. package/package.json +1 -1
  136. package/include/amxtf32intrin.h +0 -108
@@ -32,30 +32,6 @@ _Pragma("push_macro(\"bool\")");
32
32
  #define bool _Bool
33
33
  #endif
34
34
 
35
- _Pragma("omp begin declare target device_type(nohost)");
36
- _Pragma("omp begin declare variant match(device = {kind(gpu)})");
37
-
38
- // Forward declare a few functions for the implementation header.
39
-
40
- // Returns a bitmask marking all lanes that have the same value of __x.
41
- _DEFAULT_FN_ATTRS static __inline__ uint64_t
42
- __gpu_match_any_u32_impl(uint64_t __lane_mask, uint32_t __x);
43
-
44
- // Returns a bitmask marking all lanes that have the same value of __x.
45
- _DEFAULT_FN_ATTRS static __inline__ uint64_t
46
- __gpu_match_any_u64_impl(uint64_t __lane_mask, uint64_t __x);
47
-
48
- // Returns the current lane mask if every lane contains __x.
49
- _DEFAULT_FN_ATTRS static __inline__ uint64_t
50
- __gpu_match_all_u32_impl(uint64_t __lane_mask, uint32_t __x);
51
-
52
- // Returns the current lane mask if every lane contains __x.
53
- _DEFAULT_FN_ATTRS static __inline__ uint64_t
54
- __gpu_match_all_u64_impl(uint64_t __lane_mask, uint64_t __x);
55
-
56
- _Pragma("omp end declare variant");
57
- _Pragma("omp end declare target");
58
-
59
35
  #if defined(__NVPTX__)
60
36
  #include <nvptxintrin.h>
61
37
  #elif defined(__AMDGPU__)
@@ -69,6 +45,9 @@ _Pragma("omp end declare target");
69
45
  _Pragma("omp begin declare target device_type(nohost)");
70
46
  _Pragma("omp begin declare variant match(device = {kind(gpu)})");
71
47
 
48
+ // Attribute to declare a function as a kernel.
49
+ #define __gpu_kernel __attribute__((device_kernel, visibility("protected")))
50
+
72
51
  #define __GPU_X_DIM 0
73
52
  #define __GPU_Y_DIM 1
74
53
  #define __GPU_Z_DIM 2
@@ -144,11 +123,10 @@ __gpu_is_first_in_lane(uint64_t __lane_mask) {
144
123
  // Copies the value from the first active thread to the rest.
145
124
  _DEFAULT_FN_ATTRS static __inline__ uint64_t
146
125
  __gpu_read_first_lane_u64(uint64_t __lane_mask, uint64_t __x) {
147
- uint32_t __hi = (uint32_t)(__x >> 32ull);
148
- uint32_t __lo = (uint32_t)(__x & 0xFFFFFFFFull);
149
- return ((uint64_t)__gpu_read_first_lane_u32(__lane_mask, __hi) << 32ull) |
150
- ((uint64_t)__gpu_read_first_lane_u32(__lane_mask, __lo) &
151
- 0xFFFFFFFFull);
126
+ uint32_t __hi = (uint32_t)(__x >> 32);
127
+ uint32_t __lo = (uint32_t)(__x & 0xFFFFFFFF);
128
+ return ((uint64_t)__gpu_read_first_lane_u32(__lane_mask, __hi) << 32) |
129
+ ((uint64_t)__gpu_read_first_lane_u32(__lane_mask, __lo) & 0xFFFFFFFF);
152
130
  }
153
131
 
154
132
  // Gets the first floating point value from the active lanes.
@@ -171,11 +149,10 @@ __gpu_read_first_lane_f64(uint64_t __lane_mask, double __x) {
171
149
  _DEFAULT_FN_ATTRS static __inline__ uint64_t
172
150
  __gpu_shuffle_idx_u64(uint64_t __lane_mask, uint32_t __idx, uint64_t __x,
173
151
  uint32_t __width) {
174
- uint32_t __hi = (uint32_t)(__x >> 32ull);
152
+ uint32_t __hi = (uint32_t)(__x >> 32);
175
153
  uint32_t __lo = (uint32_t)(__x & 0xFFFFFFFF);
176
154
  uint32_t __mask = (uint32_t)__lane_mask;
177
- return ((uint64_t)__gpu_shuffle_idx_u32(__mask, __idx, __hi, __width)
178
- << 32ull) |
155
+ return ((uint64_t)__gpu_shuffle_idx_u32(__mask, __idx, __hi, __width) << 32) |
179
156
  ((uint64_t)__gpu_shuffle_idx_u32(__mask, __idx, __lo, __width));
180
157
  }
181
158
 
@@ -198,125 +175,166 @@ __gpu_shuffle_idx_f64(uint64_t __lane_mask, uint32_t __idx, double __x,
198
175
  __builtin_bit_cast(uint64_t, __x), __width));
199
176
  }
200
177
 
201
- // Gets the accumulator scan of the threads in the warp or wavefront.
202
- #define __DO_LANE_SCAN(__type, __bitmask_type, __suffix) \
203
- _DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_lane_scan_##__suffix( \
204
- uint64_t __lane_mask, uint32_t __x) { \
205
- uint64_t __first = __lane_mask >> __builtin_ctzll(__lane_mask); \
206
- bool __divergent = __gpu_read_first_lane_##__suffix( \
207
- __lane_mask, __first & (__first + 1)); \
208
- if (__divergent) { \
209
- __type __accum = 0; \
210
- for (uint64_t __mask = __lane_mask; __mask; __mask &= __mask - 1) { \
211
- __type __index = __builtin_ctzll(__mask); \
212
- __type __tmp = __gpu_shuffle_idx_##__suffix(__lane_mask, __index, __x, \
213
- __gpu_num_lanes()); \
214
- __x = __gpu_lane_id() == __index ? __accum + __tmp : __x; \
215
- __accum += __tmp; \
216
- } \
217
- } else { \
218
- for (uint32_t __step = 1; __step < __gpu_num_lanes(); __step *= 2) { \
219
- uint32_t __index = __gpu_lane_id() - __step; \
220
- __bitmask_type bitmask = __gpu_lane_id() >= __step; \
221
- __x += __builtin_bit_cast( \
222
- __type, \
223
- -bitmask & __builtin_bit_cast(__bitmask_type, \
224
- __gpu_shuffle_idx_##__suffix( \
225
- __lane_mask, __index, __x, \
226
- __gpu_num_lanes()))); \
227
- } \
178
+ // Implements scan and reduction operations across a GPU warp or wavefront.
179
+ //
180
+ // Both scans work by iterating log2(N) steps. The bitmask tracks the currently
181
+ // unprocessed lanes, above or below the current lane in the case of a suffix or
182
+ // prefix scan. Each iteration we shuffle in the unprocessed neighbors and then
183
+ // clear the bits that this operation handled.
184
+ #define __DO_LANE_OPS(__type, __op, __identity, __prefix, __suffix) \
185
+ _DEFAULT_FN_ATTRS static __inline__ __type \
186
+ __gpu_suffix_scan_##__prefix##_##__suffix(uint64_t __lane_mask, \
187
+ __type __x) { \
188
+ uint64_t __above = __lane_mask & -(UINT64_C(2) << __gpu_lane_id()); \
189
+ for (uint32_t __step = 1; __step < __gpu_num_lanes(); __step *= 2) { \
190
+ uint32_t __src = __builtin_ctzg(__above, (int)sizeof(__above) * 8); \
191
+ __type __result = __gpu_shuffle_idx_##__suffix(__lane_mask, __src, __x, \
192
+ __gpu_num_lanes()); \
193
+ __x = __op(__x, __above ? __result : (__type)__identity); \
194
+ for (uint32_t __i = 0; __i < __step; ++__i) \
195
+ __above &= __above - 1; \
228
196
  } \
229
197
  return __x; \
230
- }
231
- __DO_LANE_SCAN(uint32_t, uint32_t, u32); // uint32_t __gpu_lane_scan_u32(m, x)
232
- __DO_LANE_SCAN(uint64_t, uint64_t, u64); // uint64_t __gpu_lane_scan_u64(m, x)
233
- __DO_LANE_SCAN(float, uint32_t, f32); // float __gpu_lane_scan_f32(m, x)
234
- __DO_LANE_SCAN(double, uint64_t, f64); // double __gpu_lane_scan_f64(m, x)
235
- #undef __DO_LANE_SCAN
236
-
237
- // Gets the sum of all lanes inside the warp or wavefront.
238
- #define __DO_LANE_SUM(__type, __suffix) \
239
- _DEFAULT_FN_ATTRS static __inline__ __type __gpu_lane_sum_##__suffix( \
240
- uint64_t __lane_mask, __type __x) { \
241
- uint64_t __first = __lane_mask >> __builtin_ctzll(__lane_mask); \
242
- bool __divergent = __gpu_read_first_lane_##__suffix( \
243
- __lane_mask, __first & (__first + 1)); \
244
- if (__divergent) { \
245
- return __gpu_shuffle_idx_##__suffix( \
246
- __lane_mask, 63 - __builtin_clzll(__lane_mask), \
247
- __gpu_lane_scan_##__suffix(__lane_mask, __x), __gpu_num_lanes()); \
248
- } else { \
249
- for (uint32_t __step = 1; __step < __gpu_num_lanes(); __step *= 2) { \
250
- uint32_t __index = __step + __gpu_lane_id(); \
251
- __x += __gpu_shuffle_idx_##__suffix(__lane_mask, __index, __x, \
252
- __gpu_num_lanes()); \
253
- } \
254
- return __gpu_read_first_lane_##__suffix(__lane_mask, __x); \
198
+ } \
199
+ \
200
+ _DEFAULT_FN_ATTRS static __inline__ __type \
201
+ __gpu_prefix_scan_##__prefix##_##__suffix(uint64_t __lane_mask, \
202
+ __type __x) { \
203
+ uint64_t __below = __lane_mask & ((UINT64_C(1) << __gpu_lane_id()) - 1); \
204
+ for (uint32_t __step = 1; __step < __gpu_num_lanes(); __step *= 2) { \
205
+ uint32_t __src = 63 - __builtin_clzg(__below, (int)sizeof(__below) * 8); \
206
+ __type __result = __gpu_shuffle_idx_##__suffix(__lane_mask, __src, __x, \
207
+ __gpu_num_lanes()); \
208
+ __x = __op(__x, __below ? __result : (__type)__identity); \
209
+ for (uint32_t __i = 0; __i < __step; ++__i) \
210
+ __below ^= \
211
+ (UINT64_C(1) << (63 - __builtin_clzg(__below, 0))) & __below; \
255
212
  } \
213
+ return __x; \
214
+ } \
215
+ \
216
+ _DEFAULT_FN_ATTRS static __inline__ __type \
217
+ __gpu_lane_##__prefix##_##__suffix(uint64_t __lane_mask, __type __x) { \
218
+ return __gpu_read_first_lane_##__suffix( \
219
+ __lane_mask, \
220
+ __gpu_suffix_scan_##__prefix##_##__suffix(__lane_mask, __x)); \
256
221
  }
257
- __DO_LANE_SUM(uint32_t, u32); // uint32_t __gpu_lane_sum_u32(m, x)
258
- __DO_LANE_SUM(uint64_t, u64); // uint64_t __gpu_lane_sum_u64(m, x)
259
- __DO_LANE_SUM(float, f32); // float __gpu_lane_sum_f32(m, x)
260
- __DO_LANE_SUM(double, f64); // double __gpu_lane_sum_f64(m, x)
261
- #undef __DO_LANE_SUM
222
+
223
+ #define __GPU_OP(__x, __y) ((__x) + (__y))
224
+ __DO_LANE_OPS(uint32_t, __GPU_OP, 0, add, u32);
225
+ __DO_LANE_OPS(uint64_t, __GPU_OP, 0, add, u64);
226
+ __DO_LANE_OPS(float, __GPU_OP, 0, add, f32);
227
+ __DO_LANE_OPS(double, __GPU_OP, 0, add, f64);
228
+ #undef __GPU_OP
229
+
230
+ #define __GPU_OP(__x, __y) ((__x) & (__y))
231
+ __DO_LANE_OPS(uint32_t, __GPU_OP, UINT32_MAX, and, u32);
232
+ __DO_LANE_OPS(uint64_t, __GPU_OP, UINT64_MAX, and, u64);
233
+ #undef __GPU_OP
234
+
235
+ #define __GPU_OP(__x, __y) ((__x) | (__y))
236
+ __DO_LANE_OPS(uint32_t, __GPU_OP, 0, or, u32);
237
+ __DO_LANE_OPS(uint64_t, __GPU_OP, 0, or, u64);
238
+ #undef __GPU_OP
239
+
240
+ #define __GPU_OP(__x, __y) ((__x) ^ (__y))
241
+ __DO_LANE_OPS(uint32_t, __GPU_OP, 0, xor, u32);
242
+ __DO_LANE_OPS(uint64_t, __GPU_OP, 0, xor, u64);
243
+ #undef __GPU_OP
244
+
245
+ #define __GPU_OP(__x, __y) ((__x) < (__y) ? (__x) : (__y))
246
+ __DO_LANE_OPS(uint32_t, __GPU_OP, UINT32_MAX, min, u32);
247
+ __DO_LANE_OPS(uint64_t, __GPU_OP, UINT64_MAX, min, u64);
248
+ #undef __GPU_OP
249
+
250
+ #define __GPU_OP(__x, __y) ((__x) > (__y) ? (__x) : (__y))
251
+ __DO_LANE_OPS(uint32_t, __GPU_OP, 0, max, u32);
252
+ __DO_LANE_OPS(uint64_t, __GPU_OP, 0, max, u64);
253
+ #undef __GPU_OP
254
+
255
+ #define __GPU_OP(__x, __y) __builtin_elementwise_minnum((__x), (__y))
256
+ __DO_LANE_OPS(float, __GPU_OP, __builtin_inff(), minnum, f32);
257
+ __DO_LANE_OPS(double, __GPU_OP, __builtin_inf(), minnum, f64);
258
+ #undef __GPU_OP
259
+
260
+ #define __GPU_OP(__x, __y) __builtin_elementwise_maxnum((__x), (__y))
261
+ __DO_LANE_OPS(float, __GPU_OP, -__builtin_inff(), maxnum, f32);
262
+ __DO_LANE_OPS(double, __GPU_OP, -__builtin_inf(), maxnum, f64);
263
+ #undef __GPU_OP
264
+
265
+ #undef __DO_LANE_OPS
262
266
 
263
267
  // Returns a bitmask marking all lanes that have the same value of __x.
268
+ #ifndef __gpu_match_any_u32_impl
264
269
  _DEFAULT_FN_ATTRS static __inline__ uint64_t
265
- __gpu_match_any_u32_impl(uint64_t __lane_mask, uint32_t __x) {
270
+ __gpu_match_any_u32(uint64_t __lane_mask, uint32_t __x) {
266
271
  uint64_t __match_mask = 0;
267
272
 
268
273
  bool __done = 0;
269
274
  for (uint64_t __active_mask = __lane_mask; __active_mask;
270
275
  __active_mask = __gpu_ballot(__lane_mask, !__done)) {
271
276
  if (!__done) {
272
- uint32_t __first = __gpu_read_first_lane_u32(__active_mask, __x);
277
+ uint32_t __first = __gpu_shuffle_idx_u32(
278
+ __active_mask, __builtin_ctzg(__active_mask), __x, __gpu_num_lanes());
279
+ uint64_t __ballot = __gpu_ballot(__active_mask, __first == __x);
273
280
  if (__first == __x) {
274
- __match_mask = __gpu_lane_mask();
281
+ __match_mask = __ballot;
275
282
  __done = 1;
276
283
  }
277
284
  }
278
285
  }
279
- __gpu_sync_lane(__lane_mask);
280
286
  return __match_mask;
281
287
  }
288
+ #endif
289
+ #undef __gpu_match_any_u32_impl
282
290
 
283
291
  // Returns a bitmask marking all lanes that have the same value of __x.
292
+ #ifndef __gpu_match_any_u64_impl
284
293
  _DEFAULT_FN_ATTRS static __inline__ uint64_t
285
- __gpu_match_any_u64_impl(uint64_t __lane_mask, uint64_t __x) {
294
+ __gpu_match_any_u64(uint64_t __lane_mask, uint64_t __x) {
286
295
  uint64_t __match_mask = 0;
287
296
 
288
297
  bool __done = 0;
289
298
  for (uint64_t __active_mask = __lane_mask; __active_mask;
290
299
  __active_mask = __gpu_ballot(__lane_mask, !__done)) {
291
300
  if (!__done) {
292
- uint64_t __first = __gpu_read_first_lane_u64(__active_mask, __x);
301
+ uint64_t __first = __gpu_shuffle_idx_u64(
302
+ __active_mask, __builtin_ctzg(__active_mask), __x, __gpu_num_lanes());
303
+ uint64_t __ballot = __gpu_ballot(__active_mask, __first == __x);
293
304
  if (__first == __x) {
294
- __match_mask = __gpu_lane_mask();
305
+ __match_mask = __ballot;
295
306
  __done = 1;
296
307
  }
297
308
  }
298
309
  }
299
- __gpu_sync_lane(__lane_mask);
300
310
  return __match_mask;
301
311
  }
312
+ #endif
313
+ #undef __gpu_match_any_u64_impl
302
314
 
303
315
  // Returns the current lane mask if every lane contains __x.
316
+ #ifndef __gpu_match_all_u32_impl
304
317
  _DEFAULT_FN_ATTRS static __inline__ uint64_t
305
- __gpu_match_all_u32_impl(uint64_t __lane_mask, uint32_t __x) {
306
- uint32_t __first = __gpu_read_first_lane_u32(__lane_mask, __x);
318
+ __gpu_match_all_u32(uint64_t __lane_mask, uint32_t __x) {
319
+ uint32_t __first = __gpu_shuffle_idx_u32(
320
+ __lane_mask, __builtin_ctzg(__lane_mask), __x, __gpu_num_lanes());
307
321
  uint64_t __ballot = __gpu_ballot(__lane_mask, __x == __first);
308
- __gpu_sync_lane(__lane_mask);
309
- return __ballot == __gpu_lane_mask() ? __gpu_lane_mask() : 0ull;
322
+ return __ballot == __lane_mask ? __lane_mask : UINT64_C(0);
310
323
  }
324
+ #endif
325
+ #undef __gpu_match_all_u32_impl
311
326
 
312
327
  // Returns the current lane mask if every lane contains __x.
328
+ #ifndef __gpu_match_all_u64_impl
313
329
  _DEFAULT_FN_ATTRS static __inline__ uint64_t
314
- __gpu_match_all_u64_impl(uint64_t __lane_mask, uint64_t __x) {
315
- uint64_t __first = __gpu_read_first_lane_u64(__lane_mask, __x);
330
+ __gpu_match_all_u64(uint64_t __lane_mask, uint64_t __x) {
331
+ uint64_t __first = __gpu_shuffle_idx_u64(
332
+ __lane_mask, __builtin_ctzg(__lane_mask), __x, __gpu_num_lanes());
316
333
  uint64_t __ballot = __gpu_ballot(__lane_mask, __x == __first);
317
- __gpu_sync_lane(__lane_mask);
318
- return __ballot == __gpu_lane_mask() ? __gpu_lane_mask() : 0ull;
334
+ return __ballot == __lane_mask ? __lane_mask : UINT64_C(0);
319
335
  }
336
+ #endif
337
+ #undef __gpu_match_all_u64_impl
320
338
 
321
339
  _Pragma("omp end declare variant");
322
340
  _Pragma("omp end declare target");