1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=infer-address-spaces,instsimplify %s | FileCheck %s
4 target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
6 define i8 @ptrmask_cast_local_to_flat(ptr addrspace(3) %src.ptr, i64 %mask) {
7 ; CHECK-LABEL: @ptrmask_cast_local_to_flat(
8 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(3) [[SRC_PTR:%.*]] to ptr
9 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 [[MASK:%.*]])
10 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[MASKED]], align 1
11 ; CHECK-NEXT: ret i8 [[LOAD]]
13 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
14 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
15 %load = load i8, ptr %masked
19 define i8 @ptrmask_cast_private_to_flat(ptr addrspace(5) %src.ptr, i64 %mask) {
20 ; CHECK-LABEL: @ptrmask_cast_private_to_flat(
21 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(5) [[SRC_PTR:%.*]] to ptr
22 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 [[MASK:%.*]])
23 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[MASKED]], align 1
24 ; CHECK-NEXT: ret i8 [[LOAD]]
26 %cast = addrspacecast ptr addrspace(5) %src.ptr to ptr
27 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
28 %load = load i8, ptr %masked
32 define i8 @ptrmask_cast_region_to_flat(ptr addrspace(2) %src.ptr, i64 %mask) {
33 ; CHECK-LABEL: @ptrmask_cast_region_to_flat(
34 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(2) [[SRC_PTR:%.*]] to ptr
35 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 [[MASK:%.*]])
36 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[MASKED]], align 1
37 ; CHECK-NEXT: ret i8 [[LOAD]]
39 %cast = addrspacecast ptr addrspace(2) %src.ptr to ptr
40 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
41 %load = load i8, ptr %masked
45 define i8 @ptrmask_cast_global_to_flat(ptr addrspace(1) %src.ptr, i64 %mask) {
46 ; CHECK-LABEL: @ptrmask_cast_global_to_flat(
47 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(1) @llvm.ptrmask.p1.i64(ptr addrspace(1) [[SRC_PTR:%.*]], i64 [[MASK:%.*]])
48 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(1) [[TMP1]], align 1
49 ; CHECK-NEXT: ret i8 [[LOAD]]
51 %cast = addrspacecast ptr addrspace(1) %src.ptr to ptr
52 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
53 %load = load i8, ptr %masked
57 define i8 @ptrmask_cast_999_to_flat(ptr addrspace(999) %src.ptr, i64 %mask) {
58 ; CHECK-LABEL: @ptrmask_cast_999_to_flat(
59 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(999) @llvm.ptrmask.p999.i64(ptr addrspace(999) [[SRC_PTR:%.*]], i64 [[MASK:%.*]])
60 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(999) [[TMP1]], align 1
61 ; CHECK-NEXT: ret i8 [[LOAD]]
63 %cast = addrspacecast ptr addrspace(999) %src.ptr to ptr
64 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
65 %load = load i8, ptr %masked
69 define i8 @ptrmask_cast_flat_to_local(ptr %ptr, i64 %mask) {
70 ; CHECK-LABEL: @ptrmask_cast_flat_to_local(
71 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[PTR:%.*]], i64 [[MASK:%.*]])
72 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr [[MASKED]] to ptr addrspace(3)
73 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[CAST]], align 1
74 ; CHECK-NEXT: ret i8 [[LOAD]]
76 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %ptr, i64 %mask)
77 %cast = addrspacecast ptr %masked to ptr addrspace(3)
78 %load = load i8, ptr addrspace(3) %cast
82 define i8 @ptrmask_cast_flat_to_private(ptr %ptr, i64 %mask) {
83 ; CHECK-LABEL: @ptrmask_cast_flat_to_private(
84 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[PTR:%.*]], i64 [[MASK:%.*]])
85 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr [[MASKED]] to ptr addrspace(5)
86 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(5) [[CAST]], align 1
87 ; CHECK-NEXT: ret i8 [[LOAD]]
89 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %ptr, i64 %mask)
90 %cast = addrspacecast ptr %masked to ptr addrspace(5)
91 %load = load i8, ptr addrspace(5) %cast
95 define i8 @ptrmask_cast_flat_to_global(ptr %ptr, i64 %mask) {
96 ; CHECK-LABEL: @ptrmask_cast_flat_to_global(
97 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[PTR:%.*]], i64 [[MASK:%.*]])
98 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr [[MASKED]] to ptr addrspace(1)
99 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(1) [[CAST]], align 1
100 ; CHECK-NEXT: ret i8 [[LOAD]]
102 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %ptr, i64 %mask)
103 %cast = addrspacecast ptr %masked to ptr addrspace(1)
104 %load = load i8, ptr addrspace(1) %cast
108 @lds0 = internal addrspace(3) global i8 123, align 4
109 @gv = internal addrspace(1) global i8 123, align 4
111 define i8 @ptrmask_cast_local_to_flat_global(i64 %mask) {
112 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_global(
113 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), i64 [[MASK:%.*]])
114 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[MASKED]], align 1
115 ; CHECK-NEXT: ret i8 [[LOAD]]
117 %masked = call ptr @llvm.ptrmask.p0.i64(ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), i64 %mask)
118 %load = load i8, ptr %masked, align 1
122 define i8 @ptrmask_cast_global_to_flat_global(i64 %mask) {
123 ; CHECK-LABEL: @ptrmask_cast_global_to_flat_global(
124 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(1) @llvm.ptrmask.p1.i64(ptr addrspace(1) @gv, i64 [[MASK:%.*]])
125 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(1) [[TMP1]], align 1
126 ; CHECK-NEXT: ret i8 [[LOAD]]
128 %masked = call ptr @llvm.ptrmask.p0.i64(ptr addrspacecast (ptr addrspace(1) @gv to ptr), i64 %mask)
129 %load = load i8, ptr %masked, align 1
133 define i8 @multi_ptrmask_cast_global_to_flat(ptr addrspace(1) %src.ptr, i64 %mask) {
134 ; CHECK-LABEL: @multi_ptrmask_cast_global_to_flat(
135 ; CHECK-NEXT: [[LOAD0:%.*]] = load i8, ptr addrspace(1) [[SRC_PTR:%.*]], align 1
136 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(1) @llvm.ptrmask.p1.i64(ptr addrspace(1) [[SRC_PTR]], i64 [[MASK:%.*]])
137 ; CHECK-NEXT: [[LOAD1:%.*]] = load i8, ptr addrspace(1) [[TMP1]], align 1
138 ; CHECK-NEXT: [[ADD:%.*]] = add i8 [[LOAD0]], [[LOAD1]]
139 ; CHECK-NEXT: ret i8 [[ADD]]
141 %cast = addrspacecast ptr addrspace(1) %src.ptr to ptr
142 %load0 = load i8, ptr %cast
143 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
144 %load1 = load i8, ptr %masked
145 %add = add i8 %load0, %load1
149 ; Can't rewrite the ptrmask, but can rewrite other use instructions
150 define i8 @multi_ptrmask_cast_local_to_flat(ptr addrspace(3) %src.ptr, i64 %mask) {
151 ; CHECK-LABEL: @multi_ptrmask_cast_local_to_flat(
152 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(3) [[SRC_PTR:%.*]] to ptr
153 ; CHECK-NEXT: [[LOAD0:%.*]] = load i8, ptr addrspace(3) [[SRC_PTR]], align 1
154 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 [[MASK:%.*]])
155 ; CHECK-NEXT: [[LOAD1:%.*]] = load i8, ptr [[MASKED]], align 1
156 ; CHECK-NEXT: [[ADD:%.*]] = add i8 [[LOAD0]], [[LOAD1]]
157 ; CHECK-NEXT: ret i8 [[ADD]]
159 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
160 %load0 = load i8, ptr %cast
161 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
162 %load1 = load i8, ptr %masked
163 %add = add i8 %load0, %load1
167 define i8 @multi_ptrmask_cast_region_to_flat(ptr addrspace(2) %src.ptr, i64 %mask) {
168 ; CHECK-LABEL: @multi_ptrmask_cast_region_to_flat(
169 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(2) [[SRC_PTR:%.*]] to ptr
170 ; CHECK-NEXT: [[LOAD0:%.*]] = load i8, ptr addrspace(2) [[SRC_PTR]], align 1
171 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 [[MASK:%.*]])
172 ; CHECK-NEXT: [[LOAD1:%.*]] = load i8, ptr [[MASKED]], align 1
173 ; CHECK-NEXT: [[ADD:%.*]] = add i8 [[LOAD0]], [[LOAD1]]
174 ; CHECK-NEXT: ret i8 [[ADD]]
176 %cast = addrspacecast ptr addrspace(2) %src.ptr to ptr
177 %load0 = load i8, ptr %cast
178 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %mask)
179 %load1 = load i8, ptr %masked
180 %add = add i8 %load0, %load1
184 ; Do not fold this since it clears a single high bit.
185 define i8 @ptrmask_cast_local_to_flat_const_mask_fffffffeffffffff(ptr addrspace(3) %src.ptr) {
186 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_fffffffeffffffff(
187 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(3) [[SRC_PTR:%.*]] to ptr
188 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 -4294967297)
189 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[MASKED]], align 1
190 ; CHECK-NEXT: ret i8 [[LOAD]]
192 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
193 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -4294967297)
194 %load = load i8, ptr %masked
198 ; Do not fold this since it clears a single high bit.
199 define i8 @ptrmask_cast_local_to_flat_const_mask_7fffffffffffffff(ptr addrspace(3) %src.ptr) {
200 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_7fffffffffffffff(
201 ; CHECK-NEXT: [[CAST:%.*]] = addrspacecast ptr addrspace(3) [[SRC_PTR:%.*]] to ptr
202 ; CHECK-NEXT: [[MASKED:%.*]] = call ptr @llvm.ptrmask.p0.i64(ptr [[CAST]], i64 9223372036854775807)
203 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[MASKED]], align 1
204 ; CHECK-NEXT: ret i8 [[LOAD]]
206 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
207 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 9223372036854775807)
208 %load = load i8, ptr %masked
212 define i8 @ptrmask_cast_local_to_flat_const_mask_ffffffff00000000(ptr addrspace(3) %src.ptr) {
213 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_ffffffff00000000(
214 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 0)
215 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
216 ; CHECK-NEXT: ret i8 [[LOAD]]
218 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
219 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -4294967296)
220 %load = load i8, ptr %masked
224 define i8 @ptrmask_cast_local_to_flat_const_mask_ffffffff80000000(ptr addrspace(3) %src.ptr) {
225 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_ffffffff80000000(
226 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -2147483648)
227 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
228 ; CHECK-NEXT: ret i8 [[LOAD]]
230 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
231 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -2147483648)
232 %load = load i8, ptr %masked
236 ; Test some align-down patterns. These only touch the low bits, which are preserved through the cast.
237 define i8 @ptrmask_cast_local_to_flat_const_mask_ffffffffffff0000(ptr addrspace(3) %src.ptr) {
238 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_ffffffffffff0000(
239 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -65536)
240 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
241 ; CHECK-NEXT: ret i8 [[LOAD]]
243 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
244 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -65536)
245 %load = load i8, ptr %masked
249 define i8 @ptrmask_cast_local_to_flat_const_mask_ffffffffffffff00(ptr addrspace(3) %src.ptr) {
250 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_ffffffffffffff00(
251 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -256)
252 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
253 ; CHECK-NEXT: ret i8 [[LOAD]]
255 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
256 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -256)
257 %load = load i8, ptr %masked
261 define i8 @ptrmask_cast_local_to_flat_const_mask_ffffffffffffffe0(ptr addrspace(3) %src.ptr) {
262 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_ffffffffffffffe0(
263 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -32)
264 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
265 ; CHECK-NEXT: ret i8 [[LOAD]]
267 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
268 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -32)
269 %load = load i8, ptr %masked
273 define i8 @ptrmask_cast_local_to_flat_const_mask_fffffffffffffff0(ptr addrspace(3) %src.ptr) {
274 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_fffffffffffffff0(
275 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -16)
276 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
277 ; CHECK-NEXT: ret i8 [[LOAD]]
279 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
280 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -16)
281 %load = load i8, ptr %masked
285 define i8 @ptrmask_cast_local_to_flat_const_mask_fffffffffffffff8(ptr addrspace(3) %src.ptr) {
286 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_fffffffffffffff8(
287 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -8)
288 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
289 ; CHECK-NEXT: ret i8 [[LOAD]]
291 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
292 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -8)
293 %load = load i8, ptr %masked
297 define i8 @ptrmask_cast_local_to_flat_const_mask_fffffffffffffffc(ptr addrspace(3) %src.ptr) {
298 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_fffffffffffffffc(
299 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -4)
300 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
301 ; CHECK-NEXT: ret i8 [[LOAD]]
303 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
304 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -4)
305 %load = load i8, ptr %masked
309 define i8 @ptrmask_cast_local_to_flat_const_mask_fffffffffffffffe(ptr addrspace(3) %src.ptr) {
310 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_fffffffffffffffe(
311 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 -2)
312 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP1]], align 1
313 ; CHECK-NEXT: ret i8 [[LOAD]]
315 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
316 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -2)
317 %load = load i8, ptr %masked
321 define i8 @ptrmask_cast_local_to_flat_const_mask_ffffffffffffffff(ptr addrspace(3) %src.ptr) {
322 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_const_mask_ffffffffffffffff(
323 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[SRC_PTR:%.*]], align 1
324 ; CHECK-NEXT: ret i8 [[LOAD]]
326 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
327 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 -1)
328 %load = load i8, ptr %masked
332 ; Make sure non-constant masks can also be handled.
333 define i8 @ptrmask_cast_local_to_flat_load_range_mask(ptr addrspace(3) %src.ptr, ptr addrspace(1) %mask.ptr) {
334 ; CHECK-LABEL: @ptrmask_cast_local_to_flat_load_range_mask(
335 ; CHECK-NEXT: [[LOAD_MASK:%.*]] = load i64, ptr addrspace(1) [[MASK_PTR:%.*]], align 8, !range [[RNG0:![0-9]+]]
336 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[LOAD_MASK]] to i32
337 ; CHECK-NEXT: [[TMP2:%.*]] = call ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3) [[SRC_PTR:%.*]], i32 [[TMP1]])
338 ; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr addrspace(3) [[TMP2]], align 1
339 ; CHECK-NEXT: ret i8 [[LOAD]]
341 %load.mask = load i64, ptr addrspace(1) %mask.ptr, align 8, !range !0
342 %cast = addrspacecast ptr addrspace(3) %src.ptr to ptr
343 %masked = call ptr @llvm.ptrmask.p0.i64(ptr %cast, i64 %load.mask)
344 %load = load i8, ptr %masked
348 declare ptr @llvm.ptrmask.p0.i64(ptr, i64) #0
349 declare ptr addrspace(5) @llvm.ptrmask.p5.i32(ptr addrspace(5), i32) #0
350 declare ptr addrspace(3) @llvm.ptrmask.p3.i32(ptr addrspace(3), i32) #0
351 declare ptr addrspace(1) @llvm.ptrmask.p1.i64(ptr addrspace(1), i64) #0
353 attributes #0 = { nounwind readnone speculatable willreturn }
355 !0 = !{i64 -64, i64 -1}