1# RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx803 -run-pass=simple-register-coalescing -o - %s | FileCheck -check-prefix=GCN %s
2
3# GCN: {{^body}}
4
5---
6name: foo
7tracksRegLiveness: true
8body: |
9  bb.0:
10    successors: %bb.2
11    %0:sreg_32_xm0 = S_MOV_B32 1
12    %1:vgpr_32 = COPY %0
13    INLINEASM &"; %1", 1, 327690, def %1, 2147483657, %1(tied-def 3)
14    %2:sreg_64 = V_CMP_NE_U32_e64 0, %1, implicit $exec
15    undef %3.sub0:sgpr_128 = COPY %0
16    %3.sub1:sgpr_128 = COPY %0
17    %3.sub2:sgpr_128 = COPY %0
18    %4:sgpr_128 = COPY %3
19    %5:vgpr_32 = V_MOV_B32_e32 -64, implicit $exec
20    %6:vreg_128 = COPY %4
21    %7:sreg_32_xm0 = S_AND_B32 target-flags(amdgpu-gotprel) 1, %2.sub0, implicit-def dead $scc
22    %8:sreg_32_xm0 = S_MOV_B32 0
23    %9:vgpr_32 = COPY %5
24    %10:vreg_128 = COPY %6
25    S_BRANCH %bb.2
26
27  bb.1:
28    %11:vgpr_32 = V_OR_B32_e32 %12.sub0, %12.sub1, implicit $exec
29    %13:vgpr_32 = V_OR_B32_e32 %11, %12.sub2, implicit $exec
30    %14:vgpr_32 = V_AND_B32_e32 1, %13, implicit $exec
31    %15:sreg_64_xexec = V_CMP_EQ_U32_e64 0, %14, implicit $exec
32    %16:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %15, implicit $exec
33    BUFFER_STORE_DWORD_OFFEN_exact %16, undef %17:vgpr_32, undef %18:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable store 4 into constant-pool, align 1, addrspace 4)
34    S_ENDPGM 0
35
36  bb.2:
37    successors: %bb.3, %bb.4
38    %19:sreg_64 = V_CMP_EQ_U32_e64 1, %7, implicit $exec
39    %20:sreg_64 = COPY $exec, implicit-def $exec
40    %21:sreg_64 = S_AND_B64 %20, %19, implicit-def dead $scc
41    $exec = S_MOV_B64_term %21
42    SI_MASK_BRANCH %bb.4, implicit $exec
43    S_BRANCH %bb.3
44
45  bb.3:
46    successors: %bb.4
47    undef %22.sub0:sgpr_128 = COPY %8
48    %22.sub1:sgpr_128 = COPY %8
49    %22.sub2:sgpr_128 = COPY %8
50    %23:sgpr_128 = COPY %22
51    %24:vreg_128 = COPY %23
52    %10:vreg_128 = COPY %24
53
54  bb.4:
55    successors: %bb.5
56    $exec = S_OR_B64 $exec, %20, implicit-def $scc
57
58  bb.5:
59    successors: %bb.7, %bb.6
60    S_CBRANCH_SCC0 %bb.7, implicit undef $scc
61
62  bb.6:
63    successors: %bb.9
64    %12:vreg_128 = COPY %10
65    S_BRANCH %bb.9
66
67  bb.7:
68    successors: %bb.8, %bb.10
69    %25:vgpr_32 = V_AND_B32_e32 target-flags(amdgpu-gotprel32-hi) 1, %10.sub2, implicit $exec
70    %26:sreg_64 = V_CMP_EQ_U32_e64 1, %25, implicit $exec
71    %27:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
72    %28:vgpr_32 = COPY %27
73    %29:sreg_64 = COPY $exec, implicit-def $exec
74    %30:sreg_64 = S_AND_B64 %29, %26, implicit-def dead $scc
75    $exec = S_MOV_B64_term %30
76    SI_MASK_BRANCH %bb.10, implicit $exec
77    S_BRANCH %bb.8
78
79  bb.8:
80    successors: %bb.10
81    %31:vgpr_32 = BUFFER_LOAD_DWORD_OFFEN undef %32:vgpr_32, undef %33:sgpr_128, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable load 4 from constant-pool, align 1, addrspace 4)
82    %34:sreg_64_xexec = V_CMP_NE_U32_e64 0, %31, implicit $exec
83    %35:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, -1, %34, implicit $exec
84    %28:vgpr_32 = COPY %35
85    S_BRANCH %bb.10
86
87  bb.9:
88    successors: %bb.11
89    S_BRANCH %bb.11
90
91  bb.10:
92    successors: %bb.9
93    $exec = S_OR_B64 $exec, %29, implicit-def $scc
94    %36:vgpr_32 = COPY %28
95    %37:sreg_64_xexec = V_CMP_NE_U32_e64 0, %36, implicit $exec
96    %38:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %37, implicit $exec
97    %39:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
98    undef %40.sub0:vreg_128 = COPY %39
99    %40.sub1:vreg_128 = COPY %39
100    %40.sub2:vreg_128 = COPY %38
101    %41:vreg_128 = COPY %40
102    %12:vreg_128 = COPY %41
103    S_BRANCH %bb.9
104
105  bb.11:
106    successors: %bb.2, %bb.1
107    %42:vgpr_32 = V_ADD_CO_U32_e32 32, %9, implicit-def dead $vcc, implicit $exec
108    V_CMP_EQ_U32_e32 0, %42, implicit-def $vcc, implicit $exec
109    %43:vgpr_32 = COPY %42
110    $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
111    %44:vreg_128 = COPY %12
112    %9:vgpr_32 = COPY %43
113    %10:vreg_128 = COPY %44
114    S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
115    S_BRANCH %bb.2
116...
117