111
|
1 module &module:1:0:$full:$large:$default;
|
|
2
|
|
3 /* Test different style of branches. */
|
|
4
|
|
5 /* { dg-do compile } */
|
|
6 /* { dg-options "-fdump-tree-gimple" } */
|
|
7
|
|
8 prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
|
|
9 {
|
|
10 ld_kernarg_u64 $d0, [%input_ptr];
|
|
11 ld_global_u64 $d1, [$d0];
|
|
12 ld_global_u64 $d2, [$d0 + 8];
|
|
13
|
|
14 ld_global_u32 $s0, [$d0 + 16];
|
|
15 ld_global_u32 $s1, [$d0 + 20];
|
|
16
|
|
17 sbr_width(all)_u32 $s1 [@case0, @case1, @case2];
|
|
18 @case0:
|
|
19 st_global_u64 0, [$d0];
|
|
20 br @out;
|
|
21 @case1:
|
|
22 st_global_u64 1, [$d0];
|
|
23 br @out;
|
|
24 @case2:
|
|
25 st_global_u64 2, [$d0];
|
|
26 @out:
|
|
27 cmp_eq_u32_u32 $s2, $s1, $s0;
|
|
28 cvt_b1_u32 $c0, $s2;
|
|
29
|
|
30 cbr_width(all)_b1 $c0, @true_branch;
|
|
31 @false_branch:
|
|
32 st_global_u64 $d1, [$d0];
|
|
33
|
|
34 @true_branch:
|
|
35 ld_kernarg_u64 $d0, [%output_ptr];
|
|
36
|
|
37 st_global_u32 $s2, [$d0 + 8];
|
|
38 br @skip;
|
|
39 st_global_u32 $s3, [$d0 + 12];
|
|
40
|
|
41 @skip:
|
|
42 ret;
|
|
43 };
|
|
44
|
|
45 /* sbr is converted to a switch */
|
|
46 /* { dg-final { scan-tree-dump "switch \\\(s1\\\) <default: <D.\[0-9\]+>, case 0: <D.\[0-9\]+>, case 1: <D.\[0-9\]+>, case 2: <D.\[0-9\]+>>" "gimple"} } */
|
|
47
|
|
48 /* br @out converted to gotos */
|
|
49 /* { dg-final { scan-tree-dump-times "goto @out" 2 "gimple"} } */
|
|
50
|
|
51 /* the comparison instruction */
|
|
52 /* { dg-final { scan-tree-dump "c0 = s2 != 0;" "gimple" } } */
|
|
53
|
|
54 /* cbr to an if clause */
|
|
55 /* { dg-final { scan-tree-dump "if \\\(c0 != 0\\\) goto @true_branch; else goto <D.\[0-9\]+>;" "gimple" } } */
|
|
56
|
|
57 /* br @skip converted to a goto */
|
|
58 /* { dg-final { scan-tree-dump "goto @skip" "gimple"} } */
|