1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; CHECK-SPIRV-DAG: %[[#Char:]] = OpTypeInt 8 0
5 ; CHECK-SPIRV-DAG: %[[#GlobalCharPtr:]] = OpTypePointer CrossWorkgroup %[[#Char]]
6 ; CHECK-SPIRV-DAG: %[[#LocalCharPtr:]] = OpTypePointer Workgroup %[[#Char]]
7 ; CHECK-SPIRV-DAG: %[[#GenericCharPtr:]] = OpTypePointer Generic %[[#Char]]
8 ; CHECK-SPIRV: OpFunction
9 ; CHECK-SPIRV: %[[#Arg1:]] = OpFunctionParameter %[[#GlobalCharPtr]]
10 ; CHECK-SPIRV: %[[#Ptr1:]] = OpPtrCastToGeneric %[[#GenericCharPtr]] %[[#Arg1]]
11 ; CHECK-SPIRV: OpGenericCastToPtr %[[#LocalCharPtr]] %[[#Ptr1]]
12 ; CHECK-SPIRV: OpFunctionEnd
13 ; CHECK-SPIRV: OpFunction
14 ; CHECK-SPIRV: %[[#Arg2:]] = OpFunctionParameter %[[#GlobalCharPtr]]
15 ; CHECK-SPIRV: %[[#Ptr2:]] = OpPtrCastToGeneric %[[#GenericCharPtr]] %[[#Arg2]]
16 ; CHECK-SPIRV: OpGenericCastToPtr %[[#LocalCharPtr]] %[[#Ptr2]]
17 ; CHECK-SPIRV: OpFunctionEnd
19 define spir_kernel void @foo(ptr addrspace(1) %arg) {
21 %p = addrspacecast ptr addrspace(1) %arg to ptr addrspace(3)
25 define spir_kernel void @bar(ptr addrspace(1) %arg) {
27 %p1 = addrspacecast ptr addrspace(1) %arg to ptr addrspace(4)
28 %p2 = addrspacecast ptr addrspace(4) %p1 to ptr addrspace(3)