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
4 define 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
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
16 define 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
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
28 define 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
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
40 define 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
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
52 declare i1 @llvm.amdgcn.is.shared(i8* nocapture) #0
53 declare i1 @llvm.amdgcn.is.private(i8* nocapture) #0
55 attributes #0 = { nounwind readnone speculatable }