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