1; RUN: llc -O0 -opaque-pointers=0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s 2 3; CHECK: OpEntryPoint Kernel %[[#test_func:]] "test" 4; CHECK: OpName %[[#outOffsets:]] "outOffsets" 5; CHECK: OpName %[[#test_func]] "test" 6; CHECK: OpName %[[#f2_decl:]] "BuiltInGlobalOffset" 7; CHECK: OpDecorate %[[#f2_decl]] LinkageAttributes "BuiltInGlobalOffset" Import 8; CHECK: %[[#int_ty:]] = OpTypeInt 32 0 9; CHECK: %[[#iptr_ty:]] = OpTypePointer CrossWorkgroup %[[#int_ty]] 10; CHECK: %[[#void_ty:]] = OpTypeVoid 11; CHECK: %[[#func_ty:]] = OpTypeFunction %[[#void_ty]] %[[#iptr_ty]] 12; CHECK: %[[#int64_ty:]] = OpTypeInt 64 0 13; CHECK: %[[#vec_ty:]] = OpTypeVector %[[#int64_ty]] 3 14; CHECK: %[[#func2_ty:]] = OpTypeFunction %[[#vec_ty]] 15;; TODO: add 64-bit constant defs 16; CHECK: %[[#f2_decl]] = OpFunction %[[#vec_ty]] Pure %[[#func2_ty]] 17; CHECK: OpFunctionEnd 18;; Check that the function register name does not match other registers 19; CHECK-NOT: %[[#int_ty]] = OpFunction 20; CHECK-NOT: %[[#iptr_ty]] = OpFunction 21; CHECK-NOT: %[[#void_ty]] = OpFunction 22; CHECK-NOT: %[[#func_ty]] = OpFunction 23; CHECK-NOT: %[[#int64_ty]] = OpFunction 24; CHECK-NOT: %[[#vec_ty]] = OpFunction 25; CHECK-NOT: %[[#func2_ty]] = OpFunction 26; CHECK-NOT: %[[#f2_decl]] = OpFunction 27; CHECK: %[[#outOffsets]] = OpFunctionParameter %[[#iptr_ty]] 28 29define spir_kernel void @test(i32 addrspace(1)* %outOffsets) { 30entry: 31 %0 = call spir_func <3 x i64> @BuiltInGlobalOffset() #1 32 %call = extractelement <3 x i64> %0, i32 0 33 %conv = trunc i64 %call to i32 34; CHECK: %[[#i1:]] = OpInBoundsPtrAccessChain %[[#iptr_ty]] %[[#outOffsets]] 35; CHECK: OpStore %[[#i1:]] %[[#]] Aligned 4 36 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %outOffsets, i64 0 37 store i32 %conv, i32 addrspace(1)* %arrayidx, align 4 38 %1 = call spir_func <3 x i64> @BuiltInGlobalOffset() #1 39 %call1 = extractelement <3 x i64> %1, i32 1 40 %conv2 = trunc i64 %call1 to i32 41; CHECK: %[[#i2:]] = OpInBoundsPtrAccessChain %[[#iptr_ty]] %[[#outOffsets]] 42; CHECK: OpStore %[[#i2:]] %[[#]] Aligned 4 43 %arrayidx3 = getelementptr inbounds i32, i32 addrspace(1)* %outOffsets, i64 1 44 store i32 %conv2, i32 addrspace(1)* %arrayidx3, align 4 45 %2 = call spir_func <3 x i64> @BuiltInGlobalOffset() #1 46 %call4 = extractelement <3 x i64> %2, i32 2 47 %conv5 = trunc i64 %call4 to i32 48; CHECK: %[[#i3:]] = OpInBoundsPtrAccessChain %[[#iptr_ty]] %[[#outOffsets]] 49; CHECK: OpStore %[[#i3:]] %[[#]] Aligned 4 50 %arrayidx6 = getelementptr inbounds i32, i32 addrspace(1)* %outOffsets, i64 2 51 store i32 %conv5, i32 addrspace(1)* %arrayidx6, align 4 52 ret void 53} 54 55declare spir_func <3 x i64> @BuiltInGlobalOffset() #1 56 57attributes #1 = { nounwind readnone } 58