Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/SpecConstants/OpSpecConstantComposite.spvasm

raw
1 ; REQUIRES: spirv-as
2 ; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
3 ; RUN: spirv-val %t.spv
4
5 ; RUN: llvm-spirv -spec-const-info %t.spv | FileCheck %s --check-prefix=CHECK-INFO
6 ; CHECK-INFO: Number of scalar specialization constants in the module = 6
7 ; CHECK-INFO: Spec const id = 3, size in bytes = 4
8 ; CHECK-INFO: Spec const id = 6, size in bytes = 4
9 ; CHECK-INFO: Spec const id = 10, size in bytes = 4
10 ; CHECK-INFO: Spec const id = 11, size in bytes = 4
11 ; CHECK-INFO: Spec const id = 4, size in bytes = 4
12 ; CHECK-INFO: Spec const id = 7, size in bytes = 4
13
14 ; RUN: llvm-spirv -r -emit-opaque-pointers -o - %t.spv | llvm-dis -o %t.default.ll
15 ; RUN: FileCheck < %t.default.ll %s --check-prefixes=CHECK-COMMON,CHECK-DEFAULT
16 ; RUN: llvm-spirv -r -emit-opaque-pointers -spec-const "3:i32:42 4:f32:2.71 6:i32:43 7:f32:3.14 10:i32:44 11:i32:55" -o - %t.spv | llvm-dis -o %t.spec.ll
17 ; RUN: FileCheck < %t.spec.ll %s --check-prefixes=CHECK-COMMON,CHECK-SPEC
18
19
20 ; CHECK-COMMON: %struct._ZTS3POD.POD = type { [2 x %struct._ZTS1A.A], %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" }
21 ; CHECK-COMMON: %struct._ZTS1A.A = type { i32, float }
22 ; CHECK-COMMON: %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" = type { <2 x i32> }
23
24 ; CHECK-DEFAULT: store %struct._ZTS3POD.POD { [2 x %struct._ZTS1A.A] [%struct._ZTS1A.A { i32 1, float 0.000000e+00 }, %struct._ZTS1A.A { i32 35, float 0.000000e+00 }], %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" { <2 x i32> <i32 45, i32 55> } }, ptr addrspace(4) %[[#]]
25
26 ; CHECK-SPEC: store %struct._ZTS3POD.POD { [2 x %struct._ZTS1A.A] [%struct._ZTS1A.A { i32 42, float 0x4005AE1480000000 }, %struct._ZTS1A.A { i32 43, float 0x40091EB860000000 }], %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" { <2 x i32> <i32 44, i32 55> } }, ptr addrspace(4) %3
27
28 ; SPIR-V
29 ; Version: 1.1
30 ; Generator: Khronos LLVM/SPIR-V Translator; 14
31 ; Bound: 57
32 ; Schema: 0
33 OpCapability Addresses
34 OpCapability Kernel
35 OpCapability Int64
36 OpCapability GenericPointer
37 OpCapability Int8
38 %1 = OpExtInstImport "OpenCL.std"
39 OpMemoryModel Physical64 OpenCL
40 OpEntryPoint Kernel %21 "_ZTS4Test"
41 OpSource OpenCL_CPP 100000
42 OpName %struct__ZTS3POD_POD "struct._ZTS3POD.POD"
43 OpName %struct__ZTS1A_A "struct._ZTS1A.A"
44 OpName %class__ZTSN2cl4sycl3vecIiLi2EEE_cl__sycl__vec "class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec"
45 OpName %class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range "class._ZTSN2cl4sycl5rangeILi1EEE.cl::sycl::range"
46 OpName %class__ZTSN2cl4sycl6detail5arrayILi1EEE_cl__sycl__detail__array "class._ZTSN2cl4sycl6detail5arrayILi1EEE.cl::sycl::detail::array"
47 OpName %class__ZTSN2cl4sycl2idILi1EEE_cl__sycl__id "class._ZTSN2cl4sycl2idILi1EEE.cl::sycl::id"
48 OpName %_arg_ "_arg_"
49 OpName %_arg_1 "_arg_1"
50 OpName %_arg_2 "_arg_2"
51 OpName %_arg_3 "_arg_3"
52 OpName %entry "entry"
53 OpName %ref_tmp_i "ref.tmp.i"
54 OpName %add_ptr_i "add.ptr.i"
55 OpDecorate %40 SpecId 3
56 OpDecorate %41 SpecId 4
57 OpDecorate %43 SpecId 6
58 OpDecorate %44 SpecId 7
59 OpDecorate %47 SpecId 10
60 OpDecorate %48 SpecId 11
61 OpDecorate %_arg_1 FuncParamAttr ByVal
62 OpDecorate %_arg_2 FuncParamAttr ByVal
63 OpDecorate %_arg_3 FuncParamAttr ByVal
64 OpDecorate %ref_tmp_i Alignment 8
65 %uint = OpTypeInt 32 0
66 %ulong = OpTypeInt 64 0
67 %uchar = OpTypeInt 8 0
68 %ulong_2 = OpConstant %ulong 2
69 %ulong_1 = OpConstant %ulong 1
70 %ulong_0 = OpConstant %ulong 0
71 %uint_0 = OpConstant %uint 0
72 %40 = OpSpecConstant %uint 1
73 %43 = OpSpecConstant %uint 35
74 %47 = OpSpecConstant %uint 45
75 %48 = OpSpecConstant %uint 55
76 %ulong_24 = OpConstant %ulong 24
77 %void = OpTypeVoid
78 %float = OpTypeFloat 32
79 %struct__ZTS1A_A = OpTypeStruct %uint %float
80 %_arr_struct__ZTS1A_A_ulong_2 = OpTypeArray %struct__ZTS1A_A %ulong_2
81 %v2uint = OpTypeVector %uint 2
82 %class__ZTSN2cl4sycl3vecIiLi2EEE_cl__sycl__vec = OpTypeStruct %v2uint
83 %struct__ZTS3POD_POD = OpTypeStruct %_arr_struct__ZTS1A_A_ulong_2 %class__ZTSN2cl4sycl3vecIiLi2EEE_cl__sycl__vec
84 %_ptr_CrossWorkgroup_struct__ZTS3POD_POD = OpTypePointer CrossWorkgroup %struct__ZTS3POD_POD
85 %_arr_ulong_ulong_1 = OpTypeArray %ulong %ulong_1
86 %class__ZTSN2cl4sycl6detail5arrayILi1EEE_cl__sycl__detail__array = OpTypeStruct %_arr_ulong_ulong_1
87 %class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range = OpTypeStruct %class__ZTSN2cl4sycl6detail5arrayILi1EEE_cl__sycl__detail__array
88 %_ptr_Function_class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range = OpTypePointer Function %class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range
89 %class__ZTSN2cl4sycl2idILi1EEE_cl__sycl__id = OpTypeStruct %class__ZTSN2cl4sycl6detail5arrayILi1EEE_cl__sycl__detail__array
90 %_ptr_Function_class__ZTSN2cl4sycl2idILi1EEE_cl__sycl__id = OpTypePointer Function %class__ZTSN2cl4sycl2idILi1EEE_cl__sycl__id
91 %20 = OpTypeFunction %void %_ptr_CrossWorkgroup_struct__ZTS3POD_POD %_ptr_Function_class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range %_ptr_Function_class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range %_ptr_Function_class__ZTSN2cl4sycl2idILi1EEE_cl__sycl__id
92 %_ptr_Function_struct__ZTS3POD_POD = OpTypePointer Function %struct__ZTS3POD_POD
93 %_ptr_Function_ulong = OpTypePointer Function %ulong
94 %_ptr_Function_uchar = OpTypePointer Function %uchar
95 %_ptr_Generic_struct__ZTS3POD_POD = OpTypePointer Generic %struct__ZTS3POD_POD
96 %_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar
97 %_ptr_Generic_uchar = OpTypePointer Generic %uchar
98 %41 = OpSpecConstant %float 0
99 %42 = OpSpecConstantComposite %struct__ZTS1A_A %40 %41
100 %44 = OpSpecConstant %float 0
101 %45 = OpSpecConstantComposite %struct__ZTS1A_A %43 %44
102 %46 = OpSpecConstantComposite %_arr_struct__ZTS1A_A_ulong_2 %42 %45
103 %49 = OpSpecConstantComposite %v2uint %47 %48
104 %50 = OpSpecConstantComposite %class__ZTSN2cl4sycl3vecIiLi2EEE_cl__sycl__vec %49
105 %51 = OpSpecConstantComposite %struct__ZTS3POD_POD %46 %50
106 %21 = OpFunction %void None %20
107 %_arg_ = OpFunctionParameter %_ptr_CrossWorkgroup_struct__ZTS3POD_POD
108 %_arg_1 = OpFunctionParameter %_ptr_Function_class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range
109 %_arg_2 = OpFunctionParameter %_ptr_Function_class__ZTSN2cl4sycl5rangeILi1EEE_cl__sycl__range
110 %_arg_3 = OpFunctionParameter %_ptr_Function_class__ZTSN2cl4sycl2idILi1EEE_cl__sycl__id
111 %entry = OpLabel
112 %ref_tmp_i = OpVariable %_ptr_Function_struct__ZTS3POD_POD Function
113 %32 = OpInBoundsPtrAccessChain %_ptr_Function_ulong %_arg_3 %ulong_0 %uint_0 %uint_0 %ulong_0
114 %33 = OpLoad %ulong %32 Aligned 8
115 %add_ptr_i = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_struct__ZTS3POD_POD %_arg_ %33
116 %37 = OpBitcast %_ptr_Function_uchar %ref_tmp_i
117 OpLifetimeStart %37 24
118 %39 = OpPtrCastToGeneric %_ptr_Generic_struct__ZTS3POD_POD %ref_tmp_i
119 OpStore %39 %51 Aligned 8
120 %53 = OpBitcast %_ptr_CrossWorkgroup_uchar %add_ptr_i
121 %55 = OpPtrCastToGeneric %_ptr_Generic_uchar %53
122 OpCopyMemorySized %55 %37 %ulong_24 Aligned 8
123 OpLifetimeStop %37 24
124 OpReturn
125 OpFunctionEnd