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
12 ; CHECK: %src1:_(s32) = COPY $vgpr0
13 ; CHECK: %src2:_(s32) = COPY $vgpr1
14 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
15 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
16 ; CHECK: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
17 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
18 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
19 %src1:_(s32) = COPY $vgpr0
20 %src2:_(s32) = COPY $vgpr1
21 %ptr1:_(p1) = COPY $vgpr2_vgpr3
22 %ptr2:_(p1) = COPY $vgpr4_vgpr5
23 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
24 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
25 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
26 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
29 name: test_sdiv_srem_v2
30 tracksRegLiveness: true
33 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
34 ; CHECK-LABEL: name: test_sdiv_srem_v2
35 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
36 ; CHECK: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
37 ; CHECK: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
38 ; CHECK: %ptr1:_(p1) = COPY $vgpr4_vgpr5
39 ; CHECK: %ptr2:_(p1) = COPY $vgpr6_vgpr7
40 ; CHECK: %div:_(<2 x s32>), %rem:_ = G_SDIVREM %src1, %src2
41 ; CHECK: G_STORE %div(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
42 ; CHECK: G_STORE %rem(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
43 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
44 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
45 %ptr1:_(p1) = COPY $vgpr4_vgpr5
46 %ptr2:_(p1) = COPY $vgpr6_vgpr7
47 %div:_(<2 x s32>) = G_SDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
48 G_STORE %div:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
49 %rem:_(<2 x s32>) = G_SREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
50 G_STORE %rem:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
53 name: test_sdiv_srem_v4
54 tracksRegLiveness: true
57 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
58 ; CHECK-LABEL: name: test_sdiv_srem_v4
59 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
60 ; CHECK: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
61 ; CHECK: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
62 ; CHECK: %ptr1:_(p1) = COPY $vgpr8_vgpr9
63 ; CHECK: %ptr2:_(p1) = COPY $vgpr10_vgpr11
64 ; CHECK: %div:_(<4 x s32>), %rem:_ = G_SDIVREM %src1, %src2
65 ; CHECK: G_STORE %div(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
66 ; CHECK: G_STORE %rem(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
67 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
68 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
69 %ptr1:_(p1) = COPY $vgpr8_vgpr9
70 %ptr2:_(p1) = COPY $vgpr10_vgpr11
71 %div:_(<4 x s32>) = G_SDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
72 G_STORE %div:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
73 %rem:_(<4 x s32>) = G_SREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
74 G_STORE %rem:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
78 tracksRegLiveness: true
81 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
82 ; CHECK-LABEL: name: test_srem_sdiv
83 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
84 ; CHECK: %src1:_(s32) = COPY $vgpr0
85 ; CHECK: %src2:_(s32) = COPY $vgpr1
86 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
87 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
88 ; CHECK: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
89 ; CHECK: G_STORE %rem(s32), %ptr1(p1) :: (store (s32), addrspace 1)
90 ; CHECK: G_STORE %div(s32), %ptr2(p1) :: (store (s32), addrspace 1)
91 %src1:_(s32) = COPY $vgpr0
92 %src2:_(s32) = COPY $vgpr1
93 %ptr1:_(p1) = COPY $vgpr2_vgpr3
94 %ptr2:_(p1) = COPY $vgpr4_vgpr5
95 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
96 G_STORE %rem:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
97 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
98 G_STORE %div:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
101 name: test_srem_sdiv_v2
102 tracksRegLiveness: true
105 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
106 ; CHECK-LABEL: name: test_srem_sdiv_v2
107 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
108 ; CHECK: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
109 ; CHECK: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
110 ; CHECK: %ptr1:_(p1) = COPY $vgpr4_vgpr5
111 ; CHECK: %ptr2:_(p1) = COPY $vgpr6_vgpr7
112 ; CHECK: %div:_(<2 x s32>), %rem:_ = G_SDIVREM %src1, %src2
113 ; CHECK: G_STORE %rem(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
114 ; CHECK: G_STORE %div(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
115 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
116 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
117 %ptr1:_(p1) = COPY $vgpr4_vgpr5
118 %ptr2:_(p1) = COPY $vgpr6_vgpr7
119 %rem:_(<2 x s32>) = G_SREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
120 G_STORE %rem:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
121 %div:_(<2 x s32>) = G_SDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
122 G_STORE %div:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
125 name: test_srem_sdiv_v4
126 tracksRegLiveness: true
129 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
130 ; CHECK-LABEL: name: test_srem_sdiv_v4
131 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
132 ; CHECK: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
133 ; CHECK: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
134 ; CHECK: %ptr1:_(p1) = COPY $vgpr8_vgpr9
135 ; CHECK: %ptr2:_(p1) = COPY $vgpr10_vgpr11
136 ; CHECK: %div:_(<4 x s32>), %rem:_ = G_SDIVREM %src1, %src2
137 ; CHECK: G_STORE %rem(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
138 ; CHECK: G_STORE %div(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
139 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
140 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
141 %ptr1:_(p1) = COPY $vgpr8_vgpr9
142 %ptr2:_(p1) = COPY $vgpr10_vgpr11
143 %rem:_(<4 x s32>) = G_SREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
144 G_STORE %rem:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
145 %div:_(<4 x s32>) = G_SDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
146 G_STORE %div:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
150 tracksRegLiveness: true
153 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
154 ; CHECK-LABEL: name: test_udiv_urem
155 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
156 ; CHECK: %src1:_(s32) = COPY $vgpr0
157 ; CHECK: %src2:_(s32) = COPY $vgpr1
158 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
159 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
160 ; CHECK: %div:_(s32), %rem:_ = G_UDIVREM %src1, %src2
161 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
162 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
163 %src1:_(s32) = COPY $vgpr0
164 %src2:_(s32) = COPY $vgpr1
165 %ptr1:_(p1) = COPY $vgpr2_vgpr3
166 %ptr2:_(p1) = COPY $vgpr4_vgpr5
167 %div:_(s32) = G_UDIV %src1:_(s32), %src2:_(s32)
168 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
169 %rem:_(s32) = G_UREM %src1:_(s32), %src2:_(s32)
170 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
173 name: test_udiv_urem_v2
174 tracksRegLiveness: true
177 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
178 ; CHECK-LABEL: name: test_udiv_urem_v2
179 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
180 ; CHECK: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
181 ; CHECK: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
182 ; CHECK: %ptr1:_(p1) = COPY $vgpr4_vgpr5
183 ; CHECK: %ptr2:_(p1) = COPY $vgpr6_vgpr7
184 ; CHECK: %div:_(<2 x s32>), %rem:_ = G_UDIVREM %src1, %src2
185 ; CHECK: G_STORE %div(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
186 ; CHECK: G_STORE %rem(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
187 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
188 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
189 %ptr1:_(p1) = COPY $vgpr4_vgpr5
190 %ptr2:_(p1) = COPY $vgpr6_vgpr7
191 %div:_(<2 x s32>) = G_UDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
192 G_STORE %div:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
193 %rem:_(<2 x s32>) = G_UREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
194 G_STORE %rem:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
197 name: test_udiv_urem_v4
198 tracksRegLiveness: true
201 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
202 ; CHECK-LABEL: name: test_udiv_urem_v4
203 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
204 ; CHECK: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
205 ; CHECK: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
206 ; CHECK: %ptr1:_(p1) = COPY $vgpr8_vgpr9
207 ; CHECK: %ptr2:_(p1) = COPY $vgpr10_vgpr11
208 ; CHECK: %div:_(<4 x s32>), %rem:_ = G_UDIVREM %src1, %src2
209 ; CHECK: G_STORE %div(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
210 ; CHECK: G_STORE %rem(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
211 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
212 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
213 %ptr1:_(p1) = COPY $vgpr8_vgpr9
214 %ptr2:_(p1) = COPY $vgpr10_vgpr11
215 %div:_(<4 x s32>) = G_UDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
216 G_STORE %div:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
217 %rem:_(<4 x s32>) = G_UREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
218 G_STORE %rem:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
222 tracksRegLiveness: true
225 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
226 ; CHECK-LABEL: name: test_urem_udiv
227 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
228 ; CHECK: %src1:_(s32) = COPY $vgpr0
229 ; CHECK: %src2:_(s32) = COPY $vgpr1
230 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
231 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
232 ; CHECK: %div:_(s32), %rem:_ = G_UDIVREM %src1, %src2
233 ; CHECK: G_STORE %rem(s32), %ptr1(p1) :: (store (s32), addrspace 1)
234 ; CHECK: G_STORE %div(s32), %ptr2(p1) :: (store (s32), addrspace 1)
235 %src1:_(s32) = COPY $vgpr0
236 %src2:_(s32) = COPY $vgpr1
237 %ptr1:_(p1) = COPY $vgpr2_vgpr3
238 %ptr2:_(p1) = COPY $vgpr4_vgpr5
239 %rem:_(s32) = G_UREM %src1:_(s32), %src2:_(s32)
240 G_STORE %rem:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
241 %div:_(s32) = G_UDIV %src1:_(s32), %src2:_(s32)
242 G_STORE %div:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
245 name: test_urem_udiv_v2
246 tracksRegLiveness: true
249 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
250 ; CHECK-LABEL: name: test_urem_udiv_v2
251 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
252 ; CHECK: %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
253 ; CHECK: %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
254 ; CHECK: %ptr1:_(p1) = COPY $vgpr4_vgpr5
255 ; CHECK: %ptr2:_(p1) = COPY $vgpr6_vgpr7
256 ; CHECK: %div:_(<2 x s32>), %rem:_ = G_UDIVREM %src1, %src2
257 ; CHECK: G_STORE %rem(<2 x s32>), %ptr1(p1) :: (store (<2 x s32>), align 4, addrspace 1)
258 ; CHECK: G_STORE %div(<2 x s32>), %ptr2(p1) :: (store (<2 x s32>), align 4, addrspace 1)
259 %src1:_(<2 x s32>) = COPY $vgpr0_vgpr1
260 %src2:_(<2 x s32>) = COPY $vgpr2_vgpr3
261 %ptr1:_(p1) = COPY $vgpr4_vgpr5
262 %ptr2:_(p1) = COPY $vgpr6_vgpr7
263 %rem:_(<2 x s32>) = G_UREM %src1:_(<2 x s32>), %src2:_(<2 x s32>)
264 G_STORE %rem:_(<2 x s32>), %ptr1:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
265 %div:_(<2 x s32>) = G_UDIV %src1:_(<2 x s32>), %src2:_(<2 x s32>)
266 G_STORE %div:_(<2 x s32>), %ptr2:_(p1) :: (store (<2 x s32>), addrspace 1, align 4)
269 name: test_urem_udiv_v4
270 tracksRegLiveness: true
273 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
274 ; CHECK-LABEL: name: test_urem_udiv_v4
275 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7, $vgpr8_vgpr9, $vgpr10_vgpr11
276 ; CHECK: %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
277 ; CHECK: %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
278 ; CHECK: %ptr1:_(p1) = COPY $vgpr8_vgpr9
279 ; CHECK: %ptr2:_(p1) = COPY $vgpr10_vgpr11
280 ; CHECK: %div:_(<4 x s32>), %rem:_ = G_UDIVREM %src1, %src2
281 ; CHECK: G_STORE %rem(<4 x s32>), %ptr1(p1) :: (store (<4 x s32>), align 4, addrspace 1)
282 ; CHECK: G_STORE %div(<4 x s32>), %ptr2(p1) :: (store (<4 x s32>), align 4, addrspace 1)
283 %src1:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
284 %src2:_(<4 x s32>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
285 %ptr1:_(p1) = COPY $vgpr8_vgpr9
286 %ptr2:_(p1) = COPY $vgpr10_vgpr11
287 %rem:_(<4 x s32>) = G_UREM %src1:_(<4 x s32>), %src2:_(<4 x s32>)
288 G_STORE %rem:_(<4 x s32>), %ptr1:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
289 %div:_(<4 x s32>) = G_UDIV %src1:_(<4 x s32>), %src2:_(<4 x s32>)
290 G_STORE %div:_(<4 x s32>), %ptr2:_(p1) :: (store (<4 x s32>), addrspace 1, align 4)
293 name: test_sdiv_srem_extra_use
294 tracksRegLiveness: true
297 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
298 ; CHECK-LABEL: name: test_sdiv_srem_extra_use
299 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
300 ; CHECK: %src1:_(s32) = COPY $vgpr0
301 ; CHECK: %src2:_(s32) = COPY $vgpr1
302 ; CHECK: %ptr1:_(p1) = G_IMPLICIT_DEF
303 ; CHECK: %ptr2:_(p1) = G_IMPLICIT_DEF
304 ; CHECK: %ptr3:_(p1) = COPY $vgpr2_vgpr3
305 ; CHECK: %ptr4:_(p1) = COPY $vgpr4_vgpr5
306 ; CHECK: G_STORE %src1(s32), %ptr1(p1) :: (volatile store (s32) into `i32 addrspace(1)* undef`, addrspace 1)
307 ; CHECK: G_STORE %src2(s32), %ptr2(p1) :: (volatile store (s32) into `i32 addrspace(1)* undef`, addrspace 1)
308 ; CHECK: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
309 ; CHECK: G_STORE %div(s32), %ptr3(p1) :: (store (s32), addrspace 1)
310 ; CHECK: G_STORE %rem(s32), %ptr4(p1) :: (store (s32), addrspace 1)
311 %src1:_(s32) = COPY $vgpr0
312 %src2:_(s32) = COPY $vgpr1
313 %ptr1:_(p1) = G_IMPLICIT_DEF
314 %ptr2:_(p1) = G_IMPLICIT_DEF
315 %ptr3:_(p1) = COPY $vgpr2_vgpr3
316 %ptr4:_(p1) = COPY $vgpr4_vgpr5
317 G_STORE %src1:_(s32), %ptr1:_(p1) :: (volatile store (s32) into `i32 addrspace(1)* undef`, addrspace 1)
318 G_STORE %src2:_(s32), %ptr2:_(p1) :: (volatile store (s32) into `i32 addrspace(1)* undef`, addrspace 1)
319 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
320 G_STORE %div:_(s32), %ptr3:_(p1) :: (store (s32), addrspace 1, align 4)
321 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
322 G_STORE %rem:_(s32), %ptr4:_(p1) :: (store (s32), addrspace 1, align 4)
325 name: test_sdiv_srem_extra_sdiv
326 tracksRegLiveness: true
329 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
330 ; Combine the first sdiv/srem pair into sdivrem and retain the extra
332 ; CHECK-LABEL: name: test_sdiv_srem_extra_sdiv
333 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
334 ; CHECK: %src1:_(s32) = COPY $vgpr0
335 ; CHECK: %src2:_(s32) = COPY $vgpr1
336 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
337 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
338 ; CHECK: %ptr3:_(p1) = COPY $vgpr6_vgpr7
339 ; CHECK: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
340 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
341 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
342 ; CHECK: %div2:_(s32) = G_SDIV %src1, %src2
343 ; CHECK: G_STORE %div2(s32), %ptr3(p1) :: (store (s32), addrspace 1)
344 %src1:_(s32) = COPY $vgpr0
345 %src2:_(s32) = COPY $vgpr1
346 %ptr1:_(p1) = COPY $vgpr2_vgpr3
347 %ptr2:_(p1) = COPY $vgpr4_vgpr5
348 %ptr3:_(p1) = COPY $vgpr6_vgpr7
349 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
350 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
351 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
352 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
353 %div2:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
354 G_STORE %div2:_(s32), %ptr3:_(p1) :: (store (s32), addrspace 1, align 4)
357 name: test_sdiv_srem_extra_srem
358 tracksRegLiveness: true
361 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
362 ; Combine the first sdiv/srem pair into sdivrem and retain the extra
364 ; CHECK-LABEL: name: test_sdiv_srem_extra_srem
365 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5, $vgpr6_vgpr7
366 ; CHECK: %src1:_(s32) = COPY $vgpr0
367 ; CHECK: %src2:_(s32) = COPY $vgpr1
368 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
369 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
370 ; CHECK: %ptr3:_(p1) = COPY $vgpr6_vgpr7
371 ; CHECK: %div:_(s32), %rem:_ = G_SDIVREM %src1, %src2
372 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
373 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
374 ; CHECK: %rem2:_(s32) = G_SREM %src1, %src2
375 ; CHECK: G_STORE %rem2(s32), %ptr3(p1) :: (store (s32), addrspace 1)
376 %src1:_(s32) = COPY $vgpr0
377 %src2:_(s32) = COPY $vgpr1
378 %ptr1:_(p1) = COPY $vgpr2_vgpr3
379 %ptr2:_(p1) = COPY $vgpr4_vgpr5
380 %ptr3:_(p1) = COPY $vgpr6_vgpr7
381 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
382 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
383 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
384 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
385 %rem2:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
386 G_STORE %rem2:_(s32), %ptr3:_(p1) :: (store (s32), addrspace 1, align 4)
388 # Some negative tests.
390 name: test_sdiv_srem_different_src_opnd2
391 tracksRegLiveness: true
394 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3_vgpr4, $vgpr5_vgpr6
395 ; CHECK-LABEL: name: test_sdiv_srem_different_src_opnd2
396 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3_vgpr4, $vgpr5_vgpr6
397 ; CHECK: %src1:_(s32) = COPY $vgpr0
398 ; CHECK: %src2:_(s32) = COPY $vgpr1
399 ; CHECK: %src3:_(s32) = COPY $vgpr2
400 ; CHECK: %ptr1:_(p1) = COPY $vgpr3_vgpr4
401 ; CHECK: %ptr2:_(p1) = COPY $vgpr5_vgpr6
402 ; CHECK: %div:_(s32) = G_SDIV %src1, %src2
403 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
404 ; CHECK: %rem:_(s32) = G_SREM %src1, %src3
405 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
406 %src1:_(s32) = COPY $vgpr0
407 %src2:_(s32) = COPY $vgpr1
408 %src3:_(s32) = COPY $vgpr2
409 %ptr1:_(p1) = COPY $vgpr3_vgpr4
410 %ptr2:_(p1) = COPY $vgpr5_vgpr6
411 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
412 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
413 %rem:_(s32) = G_SREM %src1:_(s32), %src3:_(s32)
414 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
417 name: test_sdiv_srem_src_opnds_swapped
418 tracksRegLiveness: true
421 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
422 ; CHECK-LABEL: name: test_sdiv_srem_src_opnds_swapped
423 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
424 ; CHECK: %src1:_(s32) = COPY $vgpr0
425 ; CHECK: %src2:_(s32) = COPY $vgpr1
426 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
427 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
428 ; CHECK: %div:_(s32) = G_SDIV %src1, %src2
429 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
430 ; CHECK: %rem:_(s32) = G_SREM %src2, %src1
431 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
432 %src1:_(s32) = COPY $vgpr0
433 %src2:_(s32) = COPY $vgpr1
434 %ptr1:_(p1) = COPY $vgpr2_vgpr3
435 %ptr2:_(p1) = COPY $vgpr4_vgpr5
436 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
437 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
438 %rem:_(s32) = G_SREM %src2:_(s32), %src1:_(s32)
439 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
443 tracksRegLiveness: true
446 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
447 ; CHECK-LABEL: name: test_sdiv_urem
448 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
449 ; CHECK: %src1:_(s32) = COPY $vgpr0
450 ; CHECK: %src2:_(s32) = COPY $vgpr1
451 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
452 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
453 ; CHECK: %div:_(s32) = G_SDIV %src1, %src2
454 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
455 ; CHECK: %rem:_(s32) = G_UREM %src1, %src2
456 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
457 %src1:_(s32) = COPY $vgpr0
458 %src2:_(s32) = COPY $vgpr1
459 %ptr1:_(p1) = COPY $vgpr2_vgpr3
460 %ptr2:_(p1) = COPY $vgpr4_vgpr5
461 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
462 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
463 %rem:_(s32) = G_UREM %src1:_(s32), %src2:_(s32)
464 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
468 tracksRegLiveness: true
471 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
472 ; CHECK-LABEL: name: test_udiv_srem
473 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
474 ; CHECK: %src1:_(s32) = COPY $vgpr0
475 ; CHECK: %src2:_(s32) = COPY $vgpr1
476 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
477 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
478 ; CHECK: %div:_(s32) = G_UDIV %src1, %src2
479 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
480 ; CHECK: %rem:_(s32) = G_SREM %src1, %src2
481 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
482 %src1:_(s32) = COPY $vgpr0
483 %src2:_(s32) = COPY $vgpr1
484 %ptr1:_(p1) = COPY $vgpr2_vgpr3
485 %ptr2:_(p1) = COPY $vgpr4_vgpr5
486 %div:_(s32) = G_UDIV %src1:_(s32), %src2:_(s32)
487 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
488 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
489 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)
492 name: test_sdiv_srem_different_blocks
493 tracksRegLiveness: true
495 ; CHECK-LABEL: name: test_sdiv_srem_different_blocks
497 ; CHECK: successors: %bb.1(0x80000000)
498 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
499 ; CHECK: %src1:_(s32) = COPY $vgpr0
500 ; CHECK: %src2:_(s32) = COPY $vgpr1
501 ; CHECK: %ptr1:_(p1) = COPY $vgpr2_vgpr3
502 ; CHECK: %div:_(s32) = G_SDIV %src1, %src2
503 ; CHECK: G_STORE %div(s32), %ptr1(p1) :: (store (s32), addrspace 1)
504 ; CHECK: S_BRANCH %bb.1
506 ; CHECK: liveins: $vgpr4_vgpr5
507 ; CHECK: %ptr2:_(p1) = COPY $vgpr4_vgpr5
508 ; CHECK: %rem:_(s32) = G_SREM %src1, %src2
509 ; CHECK: G_STORE %rem(s32), %ptr2(p1) :: (store (s32), addrspace 1)
511 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
512 %src1:_(s32) = COPY $vgpr0
513 %src2:_(s32) = COPY $vgpr1
514 %ptr1:_(p1) = COPY $vgpr2_vgpr3
515 %div:_(s32) = G_SDIV %src1:_(s32), %src2:_(s32)
516 G_STORE %div:_(s32), %ptr1:_(p1) :: (store (s32), addrspace 1, align 4)
519 liveins: $vgpr4_vgpr5
520 %ptr2:_(p1) = COPY $vgpr4_vgpr5
521 %rem:_(s32) = G_SREM %src1:_(s32), %src2:_(s32)
522 G_STORE %rem:_(s32), %ptr2:_(p1) :: (store (s32), addrspace 1, align 4)