1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s
3
4---
5name: ptrmask_p1_s16
6body: |
7  bb.0:
8    liveins: $vgpr0_vgpr1, $vgpr2
9
10    ; CHECK-LABEL: name: ptrmask_p1_s16
11    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
12    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
13    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
14    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY1]](s32)
15    ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
16    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[AND]](s64)
17    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
18    %0:_(p1) = COPY $vgpr0_vgpr1
19    %1:_(s32) = COPY $vgpr2
20    %2:_(s16) = G_TRUNC %1
21    %3:_(p1) = G_PTRMASK %0, %2
22    $vgpr0_vgpr1 = COPY %3
23...
24
25---
26name: ptrmask_p1_s32
27body: |
28  bb.0:
29    liveins: $vgpr0_vgpr1, $vgpr2
30
31    ; CHECK-LABEL: name: ptrmask_p1_s32
32    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
33    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
34    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
35    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[ZEXT]](s64)
36    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
37    %0:_(p1) = COPY $vgpr0_vgpr1
38    %1:_(s32) = COPY $vgpr2
39    %2:_(p1) = G_PTRMASK %0, %1
40    $vgpr0_vgpr1 = COPY %2
41...
42
43---
44name: ptrmask_p1_s64
45body: |
46  bb.0:
47    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
48
49    ; CHECK-LABEL: name: ptrmask_p1_s64
50    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
51    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
52    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[COPY1]](s64)
53    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
54    %0:_(p1) = COPY $vgpr0_vgpr1
55    %1:_(s64) = COPY $vgpr2_vgpr3
56    %2:_(p1) = G_PTRMASK %0, %1
57    $vgpr0_vgpr1 = COPY %2
58...
59
60---
61name: ptrmask_p1_s96
62body: |
63  bb.0:
64    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3_vgpr4
65
66    ; CHECK-LABEL: name: ptrmask_p1_s96
67    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
68    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr2_vgpr3_vgpr4
69    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s96)
70    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[TRUNC]](s64)
71    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
72    %0:_(p1) = COPY $vgpr0_vgpr1
73    %1:_(s96) = COPY $vgpr2_vgpr3_vgpr4
74    %2:_(p1) = G_PTRMASK %0, %1
75    $vgpr0_vgpr1 = COPY %2
76...
77
78---
79name: ptrmask_p0_s16
80body: |
81  bb.0:
82    liveins: $vgpr0_vgpr1, $vgpr2
83
84    ; CHECK-LABEL: name: ptrmask_p0_s16
85    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
86    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
87    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
88    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY1]](s32)
89    ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
90    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[AND]](s64)
91    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
92    %0:_(p0) = COPY $vgpr0_vgpr1
93    %1:_(s32) = COPY $vgpr2
94    %2:_(s16) = G_TRUNC %1
95    %3:_(p0) = G_PTRMASK %0, %2
96    $vgpr0_vgpr1 = COPY %3
97...
98
99---
100name: ptrmask_p0_s32
101body: |
102  bb.0:
103    liveins: $vgpr0_vgpr1, $vgpr2
104
105    ; CHECK-LABEL: name: ptrmask_p0_s32
106    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
107    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
108    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
109    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[ZEXT]](s64)
110    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
111    %0:_(p0) = COPY $vgpr0_vgpr1
112    %1:_(s32) = COPY $vgpr2
113    %2:_(p0) = G_PTRMASK %0, %1
114    $vgpr0_vgpr1 = COPY %2
115...
116
117---
118name: ptrmask_p0_s64
119body: |
120  bb.0:
121    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
122
123    ; CHECK-LABEL: name: ptrmask_p0_s64
124    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
125    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
126    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[COPY1]](s64)
127    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
128    %0:_(p0) = COPY $vgpr0_vgpr1
129    %1:_(s64) = COPY $vgpr2_vgpr3
130    %2:_(p0) = G_PTRMASK %0, %1
131    $vgpr0_vgpr1 = COPY %2
132...
133
134---
135name: ptrmask_p0_s96
136body: |
137  bb.0:
138    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3_vgpr4
139
140    ; CHECK-LABEL: name: ptrmask_p0_s96
141    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
142    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr2_vgpr3_vgpr4
143    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s96)
144    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[TRUNC]](s64)
145    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
146    %0:_(p0) = COPY $vgpr0_vgpr1
147    %1:_(s96) = COPY $vgpr2_vgpr3_vgpr4
148    %2:_(p0) = G_PTRMASK %0, %1
149    $vgpr0_vgpr1 = COPY %2
150...
151
152---
153name: ptrmask_p3_s16
154body: |
155  bb.0:
156    liveins: $vgpr0, $vgpr1
157
158    ; CHECK-LABEL: name: ptrmask_p3_s16
159    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
160    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
161    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
162    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
163    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
164    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[AND]](s32)
165    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
166    %0:_(p3) = COPY $vgpr0
167    %1:_(s32) = COPY $vgpr1
168    %2:_(s16) = G_TRUNC %1
169    %3:_(p3) = G_PTRMASK %0, %2
170    $vgpr0 = COPY %3
171...
172
173---
174name: ptrmask_p3_s32
175body: |
176  bb.0:
177    liveins: $vgpr0, $vgpr1
178
179    ; CHECK-LABEL: name: ptrmask_p3_s32
180    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
181    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
182    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[COPY1]](s32)
183    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
184    %0:_(p3) = COPY $vgpr0
185    %1:_(s32) = COPY $vgpr1
186    %2:_(p3) = G_PTRMASK %0, %1
187    $vgpr0 = COPY %2
188...
189
190---
191name: ptrmask_p3_s64
192body: |
193  bb.0:
194    liveins: $vgpr0, $vgpr1_vgpr2
195
196    ; CHECK-LABEL: name: ptrmask_p3_s64
197    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
198    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr1_vgpr2
199    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
200    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[TRUNC]](s32)
201    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
202    %0:_(p3) = COPY $vgpr0
203    %1:_(s64) = COPY $vgpr1_vgpr2
204    %2:_(p3) = G_PTRMASK %0, %1
205    $vgpr0 = COPY %2
206...
207
208---
209name: ptrmask_p3_s96
210body: |
211  bb.0:
212    liveins: $vgpr0, $vgpr1_vgpr2_vgpr3
213
214    ; CHECK-LABEL: name: ptrmask_p3_s96
215    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
216    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr1_vgpr2_vgpr3
217    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s96)
218    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[TRUNC]](s32)
219    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
220    %0:_(p3) = COPY $vgpr0
221    %1:_(s96) = COPY $vgpr1_vgpr2_vgpr3
222    %2:_(p3) = G_PTRMASK %0, %1
223    $vgpr0 = COPY %2
224...
225