1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs -o - %s | FileCheck %s
6 tracksRegLiveness: true
9 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
10 ; CHECK-LABEL: name: test_sdiv_srem
11 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
13 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
14 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
15 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
16 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
17 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
18 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
19 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
20 %src1:_(s32) = COPY $vgpr0
21 %src2:_(s32) = COPY $vgpr1
22 %ptr1:_(p1) = COPY $vgpr2_vgpr3
23 %ptr2:_(p1) = COPY $vgpr4_vgpr5
24 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
25 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
26 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
27 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
30 name: test_sdiv_srem_v2
31 tracksRegLiveness: true
34 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
35 ; CHECK-LABEL: name: test_sdiv_srem_v2
36 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
38 ; CHECK-NEXT: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
39 ; CHECK-NEXT: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
40 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr4_vgpr5
41 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr6_vgpr7
42 ; CHECK-NEXT: %div:_(<2 x s32>), %rem:_ = G_SDIVREM %src1, %src2
43 ; CHECK-NEXT: G_STORE %div(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
44 ; CHECK-NEXT: G_STORE %rem(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
45 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
46 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
47 %ptr1:_(p1) = COPY $vgpr4_vgpr5
48 %ptr2:_(p1) = COPY $vgpr6_vgpr7
49 %div:_(<2 x s32>) = G_SDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
50 G_STORE %div:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
51 %rem:_(<2 x s32>) = G_SREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
52 G_STORE %rem:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
55 name: test_sdiv_srem_v4
56 tracksRegLiveness: true
59 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
60 ; CHECK-LABEL: name: test_sdiv_srem_v4
61 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
63 ; CHECK-NEXT: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
64 ; CHECK-NEXT: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
65 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr8_vgpr9
66 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr10_vgpr11
67 ; CHECK-NEXT: %div:_(<4 x s32>), %rem:_ = G_SDIVREM %src1, %src2
68 ; CHECK-NEXT: G_STORE %div(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
69 ; CHECK-NEXT: G_STORE %rem(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
70 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
71 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
72 %ptr1:_(p1) = COPY $vgpr8_vgpr9
73 %ptr2:_(p1) = COPY $vgpr10_vgpr11
74 %div:_(<4 x s32>) = G_SDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
75 G_STORE %div:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
76 %rem:_(<4 x s32>) = G_SREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
77 G_STORE %rem:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
81 tracksRegLiveness: true
84 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
85 ; CHECK-LABEL: name: test_srem_sdiv
86 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
88 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
89 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
90 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
91 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
92 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
93 ; CHECK-NEXT: G_STORE %rem(s32), %ptr1(p1) :: (store (s32), addrspace 1)
94 ; CHECK-NEXT: G_STORE %div(s32), %ptr2(p1) :: (store (s32), addrspace 1)
95 %src1:_(s32) = COPY $vgpr0
96 %src2:_(s32) = COPY $vgpr1
97 %ptr1:_(p1) = COPY $vgpr2_vgpr3
98 %ptr2:_(p1) = COPY $vgpr4_vgpr5
99 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
100 G_STORE %rem:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
101 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
102 G_STORE %div:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
105 name: test_srem_sdiv_v2
106 tracksRegLiveness: true
109 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
110 ; CHECK-LABEL: name: test_srem_sdiv_v2
111 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
113 ; CHECK-NEXT: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
114 ; CHECK-NEXT: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
115 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr4_vgpr5
116 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr6_vgpr7
117 ; CHECK-NEXT: %div:_(<2 x s32>), %rem:_ = G_SDIVREM %src1, %src2
118 ; CHECK-NEXT: G_STORE %rem(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
119 ; CHECK-NEXT: G_STORE %div(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
120 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
121 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
122 %ptr1:_(p1) = COPY $vgpr4_vgpr5
123 %ptr2:_(p1) = COPY $vgpr6_vgpr7
124 %rem:_(<2 x s32>) = G_SREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
125 G_STORE %rem:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
126 %div:_(<2 x s32>) = G_SDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
127 G_STORE %div:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
130 name: test_srem_sdiv_v4
131 tracksRegLiveness: true
134 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
135 ; CHECK-LABEL: name: test_srem_sdiv_v4
136 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
138 ; CHECK-NEXT: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
139 ; CHECK-NEXT: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
140 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr8_vgpr9
141 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr10_vgpr11
142 ; CHECK-NEXT: %div:_(<4 x s32>), %rem:_ = G_SDIVREM %src1, %src2
143 ; CHECK-NEXT: G_STORE %rem(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
144 ; CHECK-NEXT: G_STORE %div(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
145 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
146 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
147 %ptr1:_(p1) = COPY $vgpr8_vgpr9
148 %ptr2:_(p1) = COPY $vgpr10_vgpr11
149 %rem:_(<4 x s32>) = G_SREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
150 G_STORE %rem:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
151 %div:_(<4 x s32>) = G_SDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
152 G_STORE %div:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
156 tracksRegLiveness: true
159 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
160 ; CHECK-LABEL: name: test_udiv_urem
161 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
163 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
164 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
165 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
166 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
167 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_UDIVREM %src1, %src2
168 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
169 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
170 %src1:_(s32) = COPY $vgpr0
171 %src2:_(s32) = COPY $vgpr1
172 %ptr1:_(p1) = COPY $vgpr2_vgpr3
173 %ptr2:_(p1) = COPY $vgpr4_vgpr5
174 %div:_(s32) = G_UDIV %src1:_(s32), %src2:_(s32)
175 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
176 %rem:_(s32) = G_UREM %src1:_(s32), %src2:_(s32)
177 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
180 name: test_udiv_urem_v2
181 tracksRegLiveness: true
184 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
185 ; CHECK-LABEL: name: test_udiv_urem_v2
186 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
188 ; CHECK-NEXT: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
189 ; CHECK-NEXT: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
190 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr4_vgpr5
191 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr6_vgpr7
192 ; CHECK-NEXT: %div:_(<2 x s32>), %rem:_ = G_UDIVREM %src1, %src2
193 ; CHECK-NEXT: G_STORE %div(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
194 ; CHECK-NEXT: G_STORE %rem(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
195 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
196 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
197 %ptr1:_(p1) = COPY $vgpr4_vgpr5
198 %ptr2:_(p1) = COPY $vgpr6_vgpr7
199 %div:_(<2 x s32>) = G_UDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
200 G_STORE %div:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
201 %rem:_(<2 x s32>) = G_UREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
202 G_STORE %rem:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
205 name: test_udiv_urem_v4
206 tracksRegLiveness: true
209 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
210 ; CHECK-LABEL: name: test_udiv_urem_v4
211 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
213 ; CHECK-NEXT: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
214 ; CHECK-NEXT: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
215 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr8_vgpr9
216 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr10_vgpr11
217 ; CHECK-NEXT: %div:_(<4 x s32>), %rem:_ = G_UDIVREM %src1, %src2
218 ; CHECK-NEXT: G_STORE %div(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
219 ; CHECK-NEXT: G_STORE %rem(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
220 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
221 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
222 %ptr1:_(p1) = COPY $vgpr8_vgpr9
223 %ptr2:_(p1) = COPY $vgpr10_vgpr11
224 %div:_(<4 x s32>) = G_UDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
225 G_STORE %div:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
226 %rem:_(<4 x s32>) = G_UREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
227 G_STORE %rem:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
231 tracksRegLiveness: true
234 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
235 ; CHECK-LABEL: name: test_urem_udiv
236 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
238 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
239 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
240 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
241 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
242 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_UDIVREM %src1, %src2
243 ; CHECK-NEXT: G_STORE %rem(s32), %ptr1(p1) :: (store (s32), addrspace 1)
244 ; CHECK-NEXT: G_STORE %div(s32), %ptr2(p1) :: (store (s32), addrspace 1)
245 %src1:_(s32) = COPY $vgpr0
246 %src2:_(s32) = COPY $vgpr1
247 %ptr1:_(p1) = COPY $vgpr2_vgpr3
248 %ptr2:_(p1) = COPY $vgpr4_vgpr5
249 %rem:_(s32) = G_UREM %src1:_(s32), %src2:_(s32)
250 G_STORE %rem:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
251 %div:_(s32) = G_UDIV %src1:_(s32), %src2:_(s32)
252 G_STORE %div:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
255 name: test_urem_udiv_v2
256 tracksRegLiveness: true
259 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
260 ; CHECK-LABEL: name: test_urem_udiv_v2
261 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
263 ; CHECK-NEXT: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
264 ; CHECK-NEXT: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
265 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr4_vgpr5
266 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr6_vgpr7
267 ; CHECK-NEXT: %div:_(<2 x s32>), %rem:_ = G_UDIVREM %src1, %src2
268 ; CHECK-NEXT: G_STORE %rem(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
269 ; CHECK-NEXT: G_STORE %div(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
270 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
271 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
272 %ptr1:_(p1) = COPY $vgpr4_vgpr5
273 %ptr2:_(p1) = COPY $vgpr6_vgpr7
274 %rem:_(<2 x s32>) = G_UREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
275 G_STORE %rem:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
276 %div:_(<2 x s32>) = G_UDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
277 G_STORE %div:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
280 name: test_urem_udiv_v4
281 tracksRegLiveness: true
284 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
285 ; CHECK-LABEL: name: test_urem_udiv_v4
286 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
288 ; CHECK-NEXT: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
289 ; CHECK-NEXT: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
290 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr8_vgpr9
291 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr10_vgpr11
292 ; CHECK-NEXT: %div:_(<4 x s32>), %rem:_ = G_UDIVREM %src1, %src2
293 ; CHECK-NEXT: G_STORE %rem(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
294 ; CHECK-NEXT: G_STORE %div(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
295 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
296 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
297 %ptr1:_(p1) = COPY $vgpr8_vgpr9
298 %ptr2:_(p1) = COPY $vgpr10_vgpr11
299 %rem:_(<4 x s32>) = G_UREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
300 G_STORE %rem:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
301 %div:_(<4 x s32>) = G_UDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
302 G_STORE %div:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
305 name: test_sdiv_srem_extra_use
306 tracksRegLiveness: true
309 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
310 ; CHECK-LABEL: name: test_sdiv_srem_extra_use
311 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
313 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
314 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
315 ; CHECK-NEXT: %ptr1:_(p1) = G_IMPLICIT_DEF
316 ; CHECK-NEXT: %ptr2:_(p1) = G_IMPLICIT_DEF
317 ; CHECK-NEXT: %ptr3:_(p1) = COPY $vgpr2_vgpr3
318 ; CHECK-NEXT: %ptr4:_(p1) = COPY $vgpr4_vgpr5
319 ; CHECK-NEXT: G_STORE %src1(s32), %ptr1(p1) :: (volatile store (s32) into `ptr addrspace(1) undef`, addrspace 1)
320 ; CHECK-NEXT: G_STORE %src2(s32), %ptr2(p1) :: (volatile store (s32) into `ptr addrspace(1) undef`, addrspace 1)
321 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
322 ; CHECK-NEXT: G_STORE %div(s32), %ptr3(p1) :: (store (s32), addrspace 1)
323 ; CHECK-NEXT: G_STORE %rem(s32), %ptr4(p1) :: (store (s32), addrspace 1)
324 %src1:_(s32) = COPY $vgpr0
325 %src2:_(s32) = COPY $vgpr1
326 %ptr1:_(p1) = G_IMPLICIT_DEF
327 %ptr2:_(p1) = G_IMPLICIT_DEF
328 %ptr3:_(p1) = COPY $vgpr2_vgpr3
329 %ptr4:_(p1) = COPY $vgpr4_vgpr5
330 G_STORE %src1:_(s32), %ptr1:_(p1) :: (volatile store (s32) into `ptr addrspace(1) undef`, addrspace 1)
331 G_STORE %src2:_(s32), %ptr2:_(p1) :: (volatile store (s32) into `ptr addrspace(1) undef`, addrspace 1)
332 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
333 G_STORE %div:_(s32), %ptr3:_(p1) :: (store (s32), addrspace 1, align 4)
334 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
335 G_STORE %rem:_(s32), %ptr4:_(p1) :: (store (s32), addrspace 1, align 4)
338 name: test_sdiv_srem_extra_sdiv
339 tracksRegLiveness: true
342 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
343 ; Combine the first sdiv/srem pair into sdivrem and retain the extra
345 ; CHECK-LABEL: name: test_sdiv_srem_extra_sdiv
346 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
348 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
349 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
350 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
351 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
352 ; CHECK-NEXT: %ptr3:_(p1) = COPY $vgpr6_vgpr7
353 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
354 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
355 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
356 ; CHECK-NEXT: %div2:_(s32) = G_SDIV %src1, %src2
357 ; CHECK-NEXT: G_STORE %div2(s32), %ptr3(p1) :: (store (s32), addrspace 1)
358 %src1:_(s32) = COPY $vgpr0
359 %src2:_(s32) = COPY $vgpr1
360 %ptr1:_(p1) = COPY $vgpr2_vgpr3
361 %ptr2:_(p1) = COPY $vgpr4_vgpr5
362 %ptr3:_(p1) = COPY $vgpr6_vgpr7
363 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
364 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
365 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
366 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
367 %div2:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
368 G_STORE %div2:_(s32), %ptr3:_(p1) :: (store (s32), addrspace 1, align 4)
371 name: test_sdiv_srem_extra_srem
372 tracksRegLiveness: true
375 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
376 ; Combine the first sdiv/srem pair into sdivrem and retain the extra
378 ; CHECK-LABEL: name: test_sdiv_srem_extra_srem
379 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
381 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
382 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
383 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
384 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
385 ; CHECK-NEXT: %ptr3:_(p1) = COPY $vgpr6_vgpr7
386 ; CHECK-NEXT: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
387 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
388 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
389 ; CHECK-NEXT: %rem2:_(s32) = G_SREM %src1, %src2
390 ; CHECK-NEXT: G_STORE %rem2(s32), %ptr3(p1) :: (store (s32), addrspace 1)
391 %src1:_(s32) = COPY $vgpr0
392 %src2:_(s32) = COPY $vgpr1
393 %ptr1:_(p1) = COPY $vgpr2_vgpr3
394 %ptr2:_(p1) = COPY $vgpr4_vgpr5
395 %ptr3:_(p1) = COPY $vgpr6_vgpr7
396 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
397 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
398 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
399 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
400 %rem2:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
401 G_STORE %rem2:_(s32), %ptr3:_(p1) :: (store (s32), addrspace 1, align 4)
403 # Some negative tests.
405 name: test_sdiv_srem_different_src_opnd2
406 tracksRegLiveness: true
409 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3_vgpr4, $vgpr5_vgpr6
410 ; CHECK-LABEL: name: test_sdiv_srem_different_src_opnd2
411 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3_vgpr4, $vgpr5_vgpr6
413 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
414 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
415 ; CHECK-NEXT: %src3:_(s32) = COPY $vgpr2
416 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr3_vgpr4
417 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr5_vgpr6
418 ; CHECK-NEXT: %div:_(s32) = G_SDIV %src1, %src2
419 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
420 ; CHECK-NEXT: %rem:_(s32) = G_SREM %src1, %src3
421 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
422 %src1:_(s32) = COPY $vgpr0
423 %src2:_(s32) = COPY $vgpr1
424 %src3:_(s32) = COPY $vgpr2
425 %ptr1:_(p1) = COPY $vgpr3_vgpr4
426 %ptr2:_(p1) = COPY $vgpr5_vgpr6
427 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
428 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
429 %rem:_(s32) = G_SREM %src1:_(s32), %src3:_(s32)
430 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
433 name: test_sdiv_srem_src_opnds_swapped
434 tracksRegLiveness: true
437 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
438 ; CHECK-LABEL: name: test_sdiv_srem_src_opnds_swapped
439 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
441 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
442 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
443 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
444 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
445 ; CHECK-NEXT: %div:_(s32) = G_SDIV %src1, %src2
446 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
447 ; CHECK-NEXT: %rem:_(s32) = G_SREM %src2, %src1
448 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
449 %src1:_(s32) = COPY $vgpr0
450 %src2:_(s32) = COPY $vgpr1
451 %ptr1:_(p1) = COPY $vgpr2_vgpr3
452 %ptr2:_(p1) = COPY $vgpr4_vgpr5
453 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
454 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
455 %rem:_(s32) = G_SREM %src2:_(s32), %src1:_(s32)
456 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
460 tracksRegLiveness: true
463 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
464 ; CHECK-LABEL: name: test_sdiv_urem
465 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
467 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
468 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
469 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
470 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
471 ; CHECK-NEXT: %div:_(s32) = G_SDIV %src1, %src2
472 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
473 ; CHECK-NEXT: %rem:_(s32) = G_UREM %src1, %src2
474 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
475 %src1:_(s32) = COPY $vgpr0
476 %src2:_(s32) = COPY $vgpr1
477 %ptr1:_(p1) = COPY $vgpr2_vgpr3
478 %ptr2:_(p1) = COPY $vgpr4_vgpr5
479 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
480 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
481 %rem:_(s32) = G_UREM %src1:_(s32), %src2:_(s32)
482 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
486 tracksRegLiveness: true
489 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
490 ; CHECK-LABEL: name: test_udiv_srem
491 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
493 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
494 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
495 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
496 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
497 ; CHECK-NEXT: %div:_(s32) = G_UDIV %src1, %src2
498 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
499 ; CHECK-NEXT: %rem:_(s32) = G_SREM %src1, %src2
500 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
501 %src1:_(s32) = COPY $vgpr0
502 %src2:_(s32) = COPY $vgpr1
503 %ptr1:_(p1) = COPY $vgpr2_vgpr3
504 %ptr2:_(p1) = COPY $vgpr4_vgpr5
505 %div:_(s32) = G_UDIV %src1:_(s32), %src2:_(s32)
506 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
507 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
508 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
511 name: test_sdiv_srem_different_blocks
512 tracksRegLiveness: true
514 ; CHECK-LABEL: name: test_sdiv_srem_different_blocks
516 ; CHECK-NEXT: successors: %bb.1(0x80000000)
517 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
519 ; CHECK-NEXT: %src1:_(s32) = COPY $vgpr0
520 ; CHECK-NEXT: %src2:_(s32) = COPY $vgpr1
521 ; CHECK-NEXT: %ptr1:_(p1) = COPY $vgpr2_vgpr3
522 ; CHECK-NEXT: %div:_(s32) = G_SDIV %src1, %src2
523 ; CHECK-NEXT: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
524 ; CHECK-NEXT: S_BRANCH %bb.1
527 ; CHECK-NEXT: liveins: $vgpr4_vgpr5
529 ; CHECK-NEXT: %ptr2:_(p1) = COPY $vgpr4_vgpr5
530 ; CHECK-NEXT: %rem:_(s32) = G_SREM %src1, %src2
531 ; CHECK-NEXT: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
533 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
534 %src1:_(s32) = COPY $vgpr0
535 %src2:_(s32) = COPY $vgpr1
536 %ptr1:_(p1) = COPY $vgpr2_vgpr3
537 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
538 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
541 liveins: $vgpr4_vgpr5
542 %ptr2:_(p1) = COPY $vgpr4_vgpr5
543 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
544 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)