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