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 define amdgpu_kernel void @is_local_true(ptr addrspace(3) %lptr) {
5 ; CHECK-LABEL: @is_local_true(
6 ; CHECK-NEXT: store i32 1, ptr addrspace(1) undef
9 %cast = addrspacecast ptr addrspace(3) %lptr to ptr
10 %is.shared = call i1 @llvm.amdgcn.is.shared(ptr %cast)
11 %ext = zext i1 %is.shared to i32
12 store i32 %ext, ptr addrspace(1) undef
16 define amdgpu_kernel void @is_local_false(ptr addrspace(1) %gptr) {
17 ; CHECK-LABEL: @is_local_false(
18 ; CHECK-NEXT: store i32 0, ptr addrspace(1) undef
19 ; CHECK-NEXT: ret void
21 %cast = addrspacecast ptr addrspace(1) %gptr to ptr
22 %is.shared = call i1 @llvm.amdgcn.is.shared(ptr %cast)
23 %ext = zext i1 %is.shared to i32
24 store i32 %ext, ptr addrspace(1) undef
28 define void @is_private_true(ptr addrspace(5) %lptr) {
29 ; CHECK-LABEL: @is_private_true(
30 ; CHECK-NEXT: store i32 1, ptr addrspace(1) undef
31 ; CHECK-NEXT: ret void
33 %cast = addrspacecast ptr addrspace(5) %lptr to ptr
34 %is.private = call i1 @llvm.amdgcn.is.private(ptr %cast)
35 %ext = zext i1 %is.private to i32
36 store i32 %ext, ptr addrspace(1) undef
40 define void @is_private_false(ptr addrspace(1) %gptr) {
41 ; CHECK-LABEL: @is_private_false(
42 ; CHECK-NEXT: store i32 0, ptr addrspace(1) undef
43 ; CHECK-NEXT: ret void
45 %cast = addrspacecast ptr addrspace(1) %gptr to ptr
46 %is.private = call i1 @llvm.amdgcn.is.private(ptr %cast)
47 %ext = zext i1 %is.private to i32
48 store i32 %ext, ptr addrspace(1) undef
52 declare i1 @llvm.amdgcn.is.shared(ptr nocapture) #0
53 declare i1 @llvm.amdgcn.is.private(ptr nocapture) #0
55 attributes #0 = { nounwind readnone speculatable }