1 // RUN: %libomptarget-compilexx-run-and-check-generic
11 #include <type_traits>
13 template <typename T
, std::enable_if_t
<std::is_integral
<T
>::value
, bool> = true>
14 bool equal(T LHS
, T RHS
) {
19 std::enable_if_t
<std::is_floating_point
<T
>::value
, bool> = true>
20 bool equal(T LHS
, T RHS
) {
21 return __builtin_fabs(LHS
- RHS
) < std::numeric_limits
<T
>::epsilon();
24 template <typename T
> void test() {
25 constexpr const int num_blocks
= 1;
26 constexpr const int block_size
= 256;
27 constexpr const int N
= num_blocks
* block_size
;
28 int *res
= new int[N
];
30 #pragma omp target teams ompx_bare num_teams(num_blocks) thread_limit(block_size) \
33 int tid
= ompx_thread_id_x();
34 T val
= ompx::shfl_down_sync(~0U, static_cast<T
>(tid
), 1);
35 #ifdef __AMDGCN_WAVEFRONT_SIZE
36 int warp_size
= __AMDGCN_WAVEFRONT_SIZE
;
40 if ((tid
& (warp_size
- 1)) != warp_size
- 1)
41 res
[tid
] = equal(val
, static_cast<T
>(tid
+ 1));
43 res
[tid
] = equal(val
, static_cast<T
>(tid
));
46 for (int i
= 0; i
< N
; ++i
)
52 int main(int argc
, char *argv
[]) {