111
|
1 module &module:1:0:$full:$large:$default;
|
|
2
|
|
3 /* Tests for fbarrier. */
|
|
4
|
|
5 /* { dg-do compile } */
|
|
6 /* { dg-options "-fdump-tree-gimple" } */
|
|
7
|
|
8 fbarrier &fb_module_scope;
|
|
9
|
|
10 prog function &subfunction(arg_u32 %return_value)() {
|
|
11
|
|
12 workitemflatabsid_u32 $s3;
|
|
13 cvt_b1_u32 $c1, $s3;
|
|
14 cbr_width(all)_b1 $c1, @skip_fbar;
|
|
15 waitfbar &fb_module_scope;
|
|
16 @skip_fbar:
|
|
17
|
|
18 st_arg_u32 $s3, [%return_value];
|
|
19 ret;
|
|
20 };
|
|
21
|
|
22 prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
|
|
23 {
|
|
24 fbarrier %fb_func_scope;
|
|
25
|
|
26 ld_kernarg_u64 $d0, [%input_ptr];
|
|
27 ld_global_u32 $s0, [$d0];
|
|
28
|
|
29 workitemflatabsid_u32 $s1;
|
|
30 cvt_b1_u32 $c1, $s1;
|
|
31 cbr_width(all)_b1 $c1, @skip_init;
|
|
32
|
|
33 initfbar &fb_module_scope;
|
|
34 initfbar %fb_func_scope;
|
|
35
|
|
36 joinfbar &fb_module_scope;
|
|
37
|
|
38 @skip_init:
|
|
39 barrier_width(all);
|
|
40
|
|
41 joinfbar %fb_func_scope;
|
|
42
|
|
43 {
|
|
44 arg_u32 %return_value;
|
|
45 call &subfunction(%return_value)();
|
|
46 ld_arg_u32 $s1, [%return_value];
|
|
47 }
|
|
48 arrivefbar %fb_func_scope;
|
|
49
|
|
50 ld_kernarg_u64 $d1, [%output_ptr];
|
|
51 st_global_u32 $s1, [$d0];
|
|
52
|
|
53 workitemflatabsid_u32 $s1;
|
|
54 cvt_b1_u32 $c0, $s1;
|
|
55 cbr_width(all)_b1 $c0, @skip_fini;
|
|
56
|
|
57 releasefbar &fb_module_scope;
|
|
58 releasefbar %fb_func_scope;
|
|
59
|
|
60 @skip_fini:
|
|
61
|
|
62 };
|
|
63 /* fbarriers are allocated from the group memory in the order of
|
|
64 appearance. The current implementation allocates 32B per fbarrier. */
|
|
65
|
|
66 /* { dg-final { scan-tree-dump "__hsail_waitfbar \\\(0, __context\\\);" "gimple"} } */
|
|
67 /* { dg-final { scan-tree-dump "__hsail_initfbar \\\(0, __context\\\);" "gimple"} } */
|
|
68 /* { dg-final { scan-tree-dump "__hsail_initfbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
|
|
69 /* { dg-final { scan-tree-dump "__hsail_joinfbar \\\(0, __context\\\);" "gimple"} } */
|
|
70 /* { dg-final { scan-tree-dump "@skip_init:\[\n ]+__builtin___hsail_barrier \\\(__context\\\);\[\n ]+__builtin___hsail_joinfbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
|
|
71
|
|
72 /* { dg-final { scan-tree-dump "__hsail_arrivefbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
|
|
73
|
|
74 /* { dg-final { scan-tree-dump "__hsail_releasefbar \\\(0, __context\\\);\[\n ]+__builtin___hsail_releasefbar \\\(__group_local_offset, __context\\\);" "gimple"} } */
|