[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / CodeGen / AMDGPU / lds-branch-vmem-hazard.mir
blob566b1c06fb125e05eff49f70a6d0ffaf0a2ce93b
1 # RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefix=GCN %s
3 # GCN-LABEL: name: hazard_lds_branch_buf
4 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
5 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
6 ---
7 name:            hazard_lds_branch_buf
8 body:            |
9   bb.0:
10     successors: %bb.1
11     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
12     S_BRANCH %bb.1
14   bb.1:
15     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
16     S_ENDPGM 0
17 ...
19 # GCN-LABEL: name: hazard_buf_branch_lds
20 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
21 # GCN-NEXT: DS_READ_B32
22 ---
23 name:            hazard_buf_branch_lds
24 body:            |
25   bb.0:
26     successors: %bb.1
27     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
28     S_BRANCH %bb.1
30   bb.1:
31     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
32     S_ENDPGM 0
33 ...
35 # GCN-LABEL: name: no_hazard_lds_branch_lds
36 # GCN:       bb.1:
37 # GCN-NEXT:  DS_READ_B32
38 ---
39 name:            no_hazard_lds_branch_lds
40 body:            |
41   bb.0:
42     successors: %bb.1
43     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
44     S_BRANCH %bb.1
46   bb.1:
47     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
48     S_ENDPGM 0
49 ...
51 # GCN-LABEL: name: no_hazard_buf_branch_buf
52 # GCN:      bb.1:
53 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
54 ---
55 name:            no_hazard_buf_branch_buf
56 body:            |
57   bb.0:
58     successors: %bb.1
59     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
60     S_BRANCH %bb.1
62   bb.1:
63     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
64     S_ENDPGM 0
65 ...
67 # GCN-LABEL: name: no_hazard_lds_branch_buf_fallthrough
68 # GCN:      bb.1:
69 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
70 ---
71 name:            no_hazard_lds_branch_buf_fallthrough
72 body:            |
73   bb.0:
74     successors: %bb.1
75     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
77   bb.1:
78     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
79     S_ENDPGM 0
80 ...
82 # GCN-LABEL: name: no_hazard_lds_branch_buf_samebb
83 # GCN:      DS_READ_B32
84 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
85 ---
86 name:            no_hazard_lds_branch_buf_samebb
87 body:            |
88   bb.0:
89     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
90     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
91     S_ENDPGM 0
92 ...
94 # GCN-LABEL: name: hazard_lds_branch_buf_loop
95 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
96 # GCN-NEXT: DS_READ_B32
97 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
98 ---
99 name:            hazard_lds_branch_buf_loop
100 body:            |
101   bb.0:
102     successors: %bb.0
103     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
104     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
105     S_BRANCH %bb.0
108 # GCN-LABEL: name: single_hazard_lds_branch_buf
109 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
110 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
111 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
113 name:            single_hazard_lds_branch_buf
114 body:            |
115   bb.0:
116     successors: %bb.1
117     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
118     S_BRANCH %bb.1
120   bb.1:
121     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
122     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
123     S_ENDPGM 0
126 # GCN-LABEL: name: no_hazard_lds_branch_lds_buf
127 # GCN:      bb.1:
128 # GCN-NEXT: DS_READ_B32
129 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
131 name:            no_hazard_lds_branch_lds_buf
132 body:            |
133   bb.0:
134     successors: %bb.1
135     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
136     S_BRANCH %bb.1
138   bb.1:
139     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
140     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
141     S_ENDPGM 0
144 # GCN-LABEL: name: no_hazard_lds_buf_branch_buf
145 # GCN:      bb.1:
146 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
148 name:            no_hazard_lds_buf_branch_buf
149 body:            |
150   bb.0:
151     successors: %bb.1
152     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
153     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
154     S_BRANCH %bb.1
156   bb.1:
157     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
158     S_ENDPGM 0
161 # GCN-LABEL: name: hazard_lds_branch_vscnt_1_buf
162 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
163 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
165 name:            hazard_lds_branch_vscnt_1_buf
166 body:            |
167   bb.0:
168     successors: %bb.1
169     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
170     S_BRANCH %bb.1
172   bb.1:
173     S_WAITCNT_VSCNT undef $sgpr_null, 1
174     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
175     S_ENDPGM 0
178 # GCN-LABEL: name: no_hazard_lds_branch_vscnt_0_buf
179 # GCN:      bb.1:
180 # GCN-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
181 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
183 name:            no_hazard_lds_branch_vscnt_0_buf
184 body:            |
185   bb.0:
186     successors: %bb.1
187     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
188     S_BRANCH %bb.1
190   bb.1:
191     S_WAITCNT_VSCNT undef $sgpr_null, 0
192     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
193     S_ENDPGM 0
196 # GCN-LABEL: name: hazard_lds_branch_vscnt_s0_buf
197 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
198 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
200 name:            hazard_lds_branch_vscnt_s0_buf
201 body:            |
202   bb.0:
203     successors: %bb.1
204     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
205     S_BRANCH %bb.1
207   bb.1:
208     S_WAITCNT_VSCNT undef $sgpr0, 0
209     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
210     S_ENDPGM 0
213 # GCN-LABEL: name: no_hazard_lds_vscnt_0_branch_buf
214 # GCN:      bb.1:
215 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
217 name:            no_hazard_lds_vscnt_0_branch_buf
218 body:            |
219   bb.0:
220     successors: %bb.1
221     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
222     S_WAITCNT_VSCNT undef $sgpr_null, 0
223     S_BRANCH %bb.1
225   bb.1:
226     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec
227     S_ENDPGM 0
230 # GCN-LABEL: name: hazard_lds_branch_global
231 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
232 # GCN-NEXT: GLOBAL_LOAD_DWORD
234 name:            hazard_lds_branch_global
235 body:            |
236   bb.0:
237     successors: %bb.1
238     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
239     S_BRANCH %bb.1
241   bb.1:
242     $vgpr1 = GLOBAL_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, 0, 0, implicit $exec
243     S_ENDPGM 0
246 # GCN-LABEL: name: hazard_lds_branch_scratch
247 # GCN:      S_WAITCNT_VSCNT undef $sgpr_null, 0
248 # GCN-NEXT: SCRATCH_LOAD_DWORD
250 name:            hazard_lds_branch_scratch
251 body:            |
252   bb.0:
253     successors: %bb.1
254     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
255     S_BRANCH %bb.1
257   bb.1:
258     $vgpr1 = SCRATCH_LOAD_DWORD undef $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
259     S_ENDPGM 0
262 # GCN-LABEL: name: no_hazard_lds_branch_flat
263 # GCN:      bb.1:
264 # GCN-NEXT: FLAT_LOAD_DWORD
266 name:            no_hazard_lds_branch_flat
267 body:            |
268   bb.0:
269     successors: %bb.1
270     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
271     S_BRANCH %bb.1
273   bb.1:
274     $vgpr1 = FLAT_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
275     S_ENDPGM 0