1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -infer-address-spaces -instsimplify %s | FileCheck %s 3 4define amdgpu_kernel void @is_local_true(i8 addrspace(3)* %lptr) { 5; CHECK-LABEL: @is_local_true( 6; CHECK-NEXT: store i32 1, i32 addrspace(1)* undef 7; CHECK-NEXT: ret void 8; 9 %cast = addrspacecast i8 addrspace(3)* %lptr to i8* 10 %is.shared = call i1 @llvm.amdgcn.is.shared(i8* %cast) 11 %ext = zext i1 %is.shared to i32 12 store i32 %ext, i32 addrspace(1)* undef 13 ret void 14} 15 16define amdgpu_kernel void @is_local_false(i8 addrspace(1)* %gptr) { 17; CHECK-LABEL: @is_local_false( 18; CHECK-NEXT: store i32 0, i32 addrspace(1)* undef 19; CHECK-NEXT: ret void 20; 21 %cast = addrspacecast i8 addrspace(1)* %gptr to i8* 22 %is.shared = call i1 @llvm.amdgcn.is.shared(i8* %cast) 23 %ext = zext i1 %is.shared to i32 24 store i32 %ext, i32 addrspace(1)* undef 25 ret void 26} 27 28define void @is_private_true(i8 addrspace(5)* %lptr) { 29; CHECK-LABEL: @is_private_true( 30; CHECK-NEXT: store i32 1, i32 addrspace(1)* undef 31; CHECK-NEXT: ret void 32; 33 %cast = addrspacecast i8 addrspace(5)* %lptr to i8* 34 %is.private = call i1 @llvm.amdgcn.is.private(i8* %cast) 35 %ext = zext i1 %is.private to i32 36 store i32 %ext, i32 addrspace(1)* undef 37 ret void 38} 39 40define void @is_private_false(i8 addrspace(1)* %gptr) { 41; CHECK-LABEL: @is_private_false( 42; CHECK-NEXT: store i32 0, i32 addrspace(1)* undef 43; CHECK-NEXT: ret void 44; 45 %cast = addrspacecast i8 addrspace(1)* %gptr to i8* 46 %is.private = call i1 @llvm.amdgcn.is.private(i8* %cast) 47 %ext = zext i1 %is.private to i32 48 store i32 %ext, i32 addrspace(1)* undef 49 ret void 50} 51 52declare i1 @llvm.amdgcn.is.shared(i8* nocapture) #0 53declare i1 @llvm.amdgcn.is.private(i8* nocapture) #0 54 55attributes #0 = { nounwind readnone speculatable } 56