1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 @global = addrspace(1) constant i32 1 ; OpenCL global memory
5 @constant = addrspace(2) constant i32 2 ; OpenCL constant memory
6 @local = addrspace(3) constant i32 3 ; OpenCL local memory
8 define i32 @getGlobal1() {
9 %g = load i32, i32 addrspace(1)* @global
13 define i32 @getGlobal2() {
14 %g = load i32, i32 addrspace(2)* @constant
18 define i32 @getGlobal3() {
19 %g = load i32, i32 addrspace(3)* @local
23 ; CHECK: [[INT:%.+]] = OpTypeInt 32
25 ; CHECK-DAG: [[PTR_TO_INT_AS1:%.+]] = OpTypePointer CrossWorkgroup [[INT]]
26 ; CHECK-DAG: [[PTR_TO_INT_AS2:%.+]] = OpTypePointer UniformConstant [[INT]]
27 ; CHECK-DAG: [[PTR_TO_INT_AS3:%.+]] = OpTypePointer Workgroup [[INT]]
29 ; CHECK-DAG: [[CST_AS1:%.+]] = OpConstant [[INT]] 1
30 ; CHECK-DAG: [[CST_AS2:%.+]] = OpConstant [[INT]] 2
31 ; CHECK-DAG: [[CST_AS3:%.+]] = OpConstant [[INT]] 3
33 ; CHECK-DAG: [[GV1:%.+]] = OpVariable [[PTR_TO_INT_AS1]] CrossWorkgroup [[CST_AS1]]
34 ; CHECK-DAG: [[GV2:%.+]] = OpVariable [[PTR_TO_INT_AS2]] UniformConstant [[CST_AS2]]
35 ; CHECK-DAG: [[GV3:%.+]] = OpVariable [[PTR_TO_INT_AS3]] Workgroup [[CST_AS3]]
37 ; CHECK: OpLoad [[INT]] [[GV1]]
38 ; CHECK: OpLoad [[INT]] [[GV2]]
39 ; CHECK: OpLoad [[INT]] [[GV3]]