111
|
1 module &module:1:0:$full:$large:$default;
|
|
2
|
|
3 /* Test for atomic instructions. */
|
|
4
|
|
5 /* { dg-do compile } */
|
|
6 /* { dg-options "-fdump-tree-original" } */
|
|
7
|
|
8 prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
|
|
9 {
|
|
10 ld_kernarg_u64 $d0, [%input_ptr];
|
|
11
|
|
12 atomic_ld_global_rlx_system_b32 $s0, [$d0];
|
|
13 atomic_add_global_rlx_system_u32 $s1, [$d0 + 4], $s0;
|
|
14
|
|
15 ld_kernarg_u64 $d0, [%output_ptr];
|
|
16 atomicnoret_st_global_rlx_system_b32 [$d0], $s2;
|
|
17
|
|
18 atomicnoret_min_global_rlx_system_u32 [$d0 + 4], $s1;
|
|
19
|
|
20 ret;
|
|
21 };
|
|
22
|
|
23 /* The atomic loads are implemented by casting to an atomic pointer. */
|
|
24 /* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR<unsigned int>\\\(\\\*\\\(atomic unsigned int \\\*\\\)" "original"} } */
|
|
25
|
|
26 /* The atomic add should call a gcc builtin. */
|
|
27 /* { dg-final { scan-tree-dump "= __sync_fetch_and_add_4 \\\(" "original"} } */
|
|
28
|
|
29 /* The atomic stores are implemented by casting to an atomic pointer. */
|
|
30 /* { dg-final { scan-tree-dump "\\\*\\\(atomic unsigned int \\\*\\\) d0 = s2;" "original"} } */
|
|
31
|
|
32 /* The atomic min is implemented by a custom builtin. */
|
|
33 /* { dg-final { scan-tree-dump "builtin_out.\[0-9\]+ = __builtin___hsail_atomic_min_u32 \\\(" "original"} } */
|