Debian Codegraph @

llvm/test/CodeGen/SPIRV/array_type.ll

raw
1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64v1.2-unknown-unknown %s -o - -filetype=obj | spirv-val --target-env opencl2.2 %}
3
4 ; CHECK: OpCapability Kernel
5 ; CHECK-NOT: OpCapability Shader
6 ; CHECK-DAG: %[[#float16:]] = OpTypeFloat 16
7 ; CHECK-DAG: %[[#SyclHalfTy:]] = OpTypeStruct %[[#float16]]
8 ; CHECK-DAG: %[[#i16:]] = OpTypeInt 16
9 ; CHECK-DAG: %[[#i32:]] = OpTypeInt 32
10 ; CHECK-DAG: %[[#i64:]] = OpTypeInt 64
11 ; CHECK-DAG: %[[#ConstNull:]] = OpConstantNull %[[#i64]]
12 ; CHECK-DAG: %[[#ConstOne:]] = OpConstant %[[#i64]] 1
13 ; CHECK-DAG: %[[#ConstFive:]] = OpConstant %[[#i16]] 5
14 ; CHECK-DAG: %[[#SyclHalfTyPtr:]] = OpTypePointer Function %[[#SyclHalfTy]]
15 ; CHECK-DAG: %[[#i32Ptr:]] = OpTypePointer Function %[[#i32]]
16 ; CHECK-DAG: %[[#StorePtrTy:]] = OpTypePointer Function %[[#i16]]
17
18 %"class.sycl::_V1::detail::half_impl::half" = type { half }
19
20 ; Function Attrs: mustprogress norecurse nounwind
21 define spir_kernel void @foo(ptr %p){
22 ; CHECK: OpFunction
23 ; CHECK: %[[#Ptr:]] = OpFunctionParameter
24 ; CHECK: OpLabel
25 ; CHECK: %[[#BitcastOp:]] = OpInBoundsPtrAccessChain %[[#SyclHalfTyPtr]] %[[#Ptr]] %[[#ConstNull]] %[[#ConstNull]]
26 ; CHECK: %[[#StorePtr:]] = OpBitcast %[[#StorePtrTy]] %[[#BitcastOp]]
27 ; CHECK: OpStore %[[#StorePtr]] %[[#ConstFive]]
28 ; CHECK: OpReturn
29 entry:
30 %0 = getelementptr inbounds [0 x [32 x %"class.sycl::_V1::detail::half_impl::half"]], ptr %p, i64 0, i64 0, i64 0
31 store i16 5, ptr %0
32 ret void
33 }
34
35 ; Function Attrs: mustprogress norecurse nounwind
36 define spir_kernel void @foo2(ptr %p){
37 ; CHECK: OpFunction
38 ; CHECK: %[[#Ptr:]] = OpFunctionParameter
39 ; CHECK: OpLabel
40 ; CHECK: %[[#BitcastOp:]] = OpInBoundsPtrAccessChain %[[#SyclHalfTyPtr]] %[[#Ptr]] %[[#ConstOne]] %[[#ConstOne]]
41 ; CHECK: %[[#StorePtr:]] = OpBitcast %[[#StorePtrTy]] %[[#BitcastOp]]
42 ; CHECK: OpStore %[[#StorePtr]] %[[#ConstFive]]
43 ; CHECK: OpReturn
44 entry:
45 %0 = getelementptr inbounds [0 x [32 x %"class.sycl::_V1::detail::half_impl::half"]], ptr %p, i64 0, i64 1, i64 1
46 store i16 5, ptr %0
47 ret void
48 }
49
50 ; Function Attrs: mustprogress norecurse nounwind
51 define spir_kernel void @foo3(ptr %p){
52 ; CHECK: OpFunction
53 ; CHECK: %[[#Ptr:]] = OpFunctionParameter
54 ; CHECK: OpLabel
55 ; CHECK: %[[#BitcastOp:]] = OpInBoundsPtrAccessChain %[[#i32Ptr]] %[[#Ptr]] %[[#ConstNull]] %[[#ConstNull]]
56 ; CHECK: %[[#StorePtr:]] = OpBitcast %[[#StorePtrTy]] %[[#BitcastOp]]
57 ; CHECK: OpStore %[[#StorePtr]] %[[#ConstFive]]
58 ; CHECK: OpReturn
59 entry:
60 %0 = getelementptr inbounds [0 x [32 x i32]], ptr %p, i64 0, i64 0, i64 0
61 store i16 5, ptr %0
62 ret void
63 }
64
65 ; Function Attrs: mustprogress norecurse nounwind
66 define spir_kernel void @foo4(ptr %p){
67 ; CHECK: OpFunction
68 ; CHECK: %[[#Ptr:]] = OpFunctionParameter
69 ; CHECK: OpLabel
70 ; CHECK: %[[#BitcastOp:]] = OpInBoundsPtrAccessChain %[[#i32Ptr]] %[[#Ptr]] %[[#ConstOne]] %[[#ConstOne]]
71 ; CHECK: %[[#StorePtr:]] = OpBitcast %[[#StorePtrTy]] %[[#BitcastOp]]
72 ; CHECK: OpStore %[[#StorePtr]] %[[#ConstFive]]
73 ; CHECK: OpReturn
74 entry:
75 %0 = getelementptr inbounds [0 x [32 x i32]], ptr %p, i64 0, i64 1, i64 1
76 store i16 5, ptr %0
77 ret void
78 }