Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/SpecConstants/specconstantop-init.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 -r -emit-opaque-pointers %t.spv -o %t.bc
6 ; RUN: llvm-dis %t.bc -o - | FileCheck %s
7
8 ; Verify that OpVariable initializers containing various OpSpecConstantOp
9 ; operations are supported. Also verify that edge cases such as division
10 ; by zero are handled gracefully.
11
12 ; CHECK: @var_sconvert = addrspace(1) global i8 53
13 ; CHECK: @var_uconvert = addrspace(1) global i8 53
14 ; CHECK: @var_snegate = addrspace(1) global i32 -53
15 ; CHECK: @var_not = addrspace(1) global i32 -54
16 ; CHECK: @var_iadd = addrspace(1) global i32 49
17 ; CHECK: @var_isub = addrspace(1) global i32 57
18 ; CHECK: @var_imul = addrspace(1) global i32 -212
19 ; CHECK: @var_udiv = addrspace(1) global i32 81037118
20 ; CHECK: @var_udiv0 = addrspace(1) global i32 poison
21 ; CHECK: @var_sdiv = addrspace(1) global i32 -13
22 ; CHECK: @var_sdiv0 = addrspace(1) global i32 poison
23 ; CHECK: @var_umod = addrspace(1) global i32 1
24 ; CHECK: @var_srem = addrspace(1) global i32 1
25 ; CHECK: @var_smod = addrspace(1) global i32 -3
26 ; CHECK: @var_srl = addrspace(1) global i32 268435455
27 ; CHECK: @var_sra = addrspace(1) global i32 -1
28 ; CHECK: @var_sll = addrspace(1) global i32 848
29 ; CHECK: @var_sll_big = addrspace(1) global i32 poison
30 ; CHECK: @var_bitor = addrspace(1) global i32 -3
31 ; CHECK: @var_bitxor = addrspace(1) global i32 -55
32 ; CHECK: @var_bitand = addrspace(1) global i32 52
33 ; CHECK: @var_vecshuf = addrspace(1) global <2 x i32> <i32 4, i32 53>
34 ; CHECK: @var_compext = addrspace(1) global i32 53
35 ; CHECK: @var_compins = addrspace(1) global <2 x i32> <i32 53, i32 53>
36 ; CHECK: @var_logor = addrspace(1) global i1 true
37 ; CHECK: @var_logand = addrspace(1) global i1 false
38 ; CHECK: @var_lognot = addrspace(1) global i1 false
39 ; CHECK: @var_logeq = addrspace(1) global i1 false
40 ; CHECK: @var_logne = addrspace(1) global i1 true
41 ; CHECK: @var_select = addrspace(1) global i32 53
42 ; CHECK: @var_icmpeq = addrspace(1) global i1 false
43 ; CHECK: @var_icmpne = addrspace(1) global i1 true
44 ; CHECK: @var_icmpult = addrspace(1) global i1 true
45 ; CHECK: @var_icmpslt = addrspace(1) global i1 false
46 ; CHECK: @var_icmpugt = addrspace(1) global i1 false
47 ; CHECK: @var_icmpsgt = addrspace(1) global i1 true
48 ; CHECK: @var_icmpule = addrspace(1) global i1 true
49 ; CHECK: @var_icmpsle = addrspace(1) global i1 false
50 ; CHECK: @var_icmpuge = addrspace(1) global i1 false
51 ; CHECK: @var_icmpsge = addrspace(1) global i1 true
52 ; CHECK: @var_bitcast = addrspace(1) global i32 1065353216
53
54 OpCapability Addresses
55 OpCapability Linkage
56 OpCapability Kernel
57 OpCapability Int8
58 OpMemoryModel Physical32 OpenCL
59 OpEntryPoint Kernel %15 "foo"
60 OpName %entry "entry"
61 OpDecorate %var_sconvert LinkageAttributes "var_sconvert" Export
62 OpDecorate %var_uconvert LinkageAttributes "var_uconvert" Export
63 OpDecorate %var_snegate LinkageAttributes "var_snegate" Export
64 OpDecorate %var_not LinkageAttributes "var_not" Export
65 OpDecorate %var_iadd LinkageAttributes "var_iadd" Export
66 OpDecorate %var_isub LinkageAttributes "var_isub" Export
67 OpDecorate %var_imul LinkageAttributes "var_imul" Export
68 OpDecorate %var_udiv LinkageAttributes "var_udiv" Export
69 OpDecorate %var_udiv0 LinkageAttributes "var_udiv0" Export
70 OpDecorate %var_sdiv LinkageAttributes "var_sdiv" Export
71 OpDecorate %var_sdiv0 LinkageAttributes "var_sdiv0" Export
72 OpDecorate %var_umod LinkageAttributes "var_umod" Export
73 OpDecorate %var_srem LinkageAttributes "var_srem" Export
74 OpDecorate %var_smod LinkageAttributes "var_smod" Export
75 OpDecorate %var_srl LinkageAttributes "var_srl" Export
76 OpDecorate %var_sra LinkageAttributes "var_sra" Export
77 OpDecorate %var_sll LinkageAttributes "var_sll" Export
78 OpDecorate %var_sll_big LinkageAttributes "var_sll_big" Export
79 OpDecorate %var_bitor LinkageAttributes "var_bitor" Export
80 OpDecorate %var_bitxor LinkageAttributes "var_bitxor" Export
81 OpDecorate %var_bitand LinkageAttributes "var_bitand" Export
82 OpDecorate %var_vecshuf LinkageAttributes "var_vecshuf" Export
83 OpDecorate %var_compext LinkageAttributes "var_compext" Export
84 OpDecorate %var_compins LinkageAttributes "var_compins" Export
85 OpDecorate %var_logor LinkageAttributes "var_logor" Export
86 OpDecorate %var_logand LinkageAttributes "var_logand" Export
87 OpDecorate %var_lognot LinkageAttributes "var_lognot" Export
88 OpDecorate %var_logeq LinkageAttributes "var_logeq" Export
89 OpDecorate %var_logne LinkageAttributes "var_logne" Export
90 OpDecorate %var_select LinkageAttributes "var_select" Export
91 OpDecorate %var_icmpeq LinkageAttributes "var_icmpeq" Export
92 OpDecorate %var_icmpne LinkageAttributes "var_icmpne" Export
93 OpDecorate %var_icmpult LinkageAttributes "var_icmpult" Export
94 OpDecorate %var_icmpslt LinkageAttributes "var_icmpslt" Export
95 OpDecorate %var_icmpugt LinkageAttributes "var_icmpugt" Export
96 OpDecorate %var_icmpsgt LinkageAttributes "var_icmpsgt" Export
97 OpDecorate %var_icmpule LinkageAttributes "var_icmpule" Export
98 OpDecorate %var_icmpsle LinkageAttributes "var_icmpsle" Export
99 OpDecorate %var_icmpuge LinkageAttributes "var_icmpuge" Export
100 OpDecorate %var_icmpsge LinkageAttributes "var_icmpsge" Export
101 OpDecorate %var_bitcast LinkageAttributes "var_bitcast" Export
102 %bool = OpTypeBool
103 %true = OpConstantTrue %bool
104 %false = OpConstantFalse %bool
105 %uchar = OpTypeInt 8 0
106 %uint = OpTypeInt 32 0
107 %float = OpTypeFloat 32
108 %v2i32 = OpTypeVector %uint 2
109 %uint_0 = OpConstant %uint 0
110 %uint_4 = OpConstant %uint 4
111 %uint_53 = OpConstant %uint 53
112 %uint_min4 = OpConstant %uint 0xfffffffc
113 %float_1 = OpConstant %float 1.0
114 %vec_53_0 = OpConstantComposite %v2i32 %uint_53 %uint_0
115 %vec_4_4 = OpConstantComposite %v2i32 %uint_4 %uint_4
116 %sconvert = OpSpecConstantOp %uchar SConvert %uint_53
117 %uconvert = OpSpecConstantOp %uchar UConvert %uint_53
118 %snegate = OpSpecConstantOp %uint SNegate %uint_53
119 %not = OpSpecConstantOp %uint Not %uint_53
120 %iadd = OpSpecConstantOp %uint IAdd %uint_53 %uint_min4
121 %isub = OpSpecConstantOp %uint ISub %uint_53 %uint_min4
122 %imul = OpSpecConstantOp %uint IMul %uint_53 %uint_min4
123 %udiv = OpSpecConstantOp %uint UDiv %uint_min4 %uint_53
124 %udiv0 = OpSpecConstantOp %uint UDiv %uint_min4 %uint_0
125 %sdiv = OpSpecConstantOp %uint SDiv %uint_53 %uint_min4
126 %sdiv0 = OpSpecConstantOp %uint SDiv %uint_53 %uint_0
127 %umod = OpSpecConstantOp %uint UMod %uint_53 %uint_4
128 %srem = OpSpecConstantOp %uint SRem %uint_53 %uint_min4
129 %smod = OpSpecConstantOp %uint SMod %uint_53 %uint_min4
130 %srl = OpSpecConstantOp %uint ShiftRightLogical %uint_min4 %uint_4
131 %sra = OpSpecConstantOp %uint ShiftRightArithmetic %uint_min4 %uint_4
132 %sll = OpSpecConstantOp %uint ShiftLeftLogical %uint_53 %uint_4
133 %sll_big = OpSpecConstantOp %uint ShiftLeftLogical %uint_4 %uint_53
134 %bitor = OpSpecConstantOp %uint BitwiseOr %uint_53 %uint_min4
135 %bitxor = OpSpecConstantOp %uint BitwiseXor %uint_53 %uint_min4
136 %bitand = OpSpecConstantOp %uint BitwiseAnd %uint_53 %uint_min4
137 %vecshuf = OpSpecConstantOp %v2i32 VectorShuffle %vec_53_0 %vec_4_4 2 0
138 %compext = OpSpecConstantOp %uint CompositeExtract %vec_53_0 0
139 %compins = OpSpecConstantOp %v2i32 CompositeInsert %uint_53 %vec_53_0 1
140 %logor = OpSpecConstantOp %bool LogicalOr %true %false
141 %logand = OpSpecConstantOp %bool LogicalAnd %true %false
142 %lognot = OpSpecConstantOp %bool LogicalNot %true
143 %logeq = OpSpecConstantOp %bool LogicalEqual %true %false
144 %logne = OpSpecConstantOp %bool LogicalNotEqual %true %false
145 %select = OpSpecConstantOp %uint Select %logeq %uint_4 %uint_53
146 %icmpeq = OpSpecConstantOp %bool IEqual %uint_53 %uint_min4
147 %icmpne = OpSpecConstantOp %bool INotEqual %uint_53 %uint_min4
148 %icmpult = OpSpecConstantOp %bool ULessThan %uint_53 %uint_min4
149 %icmpslt = OpSpecConstantOp %bool SLessThan %uint_53 %uint_min4
150 %icmpugt = OpSpecConstantOp %bool UGreaterThan %uint_53 %uint_min4
151 %icmpsgt = OpSpecConstantOp %bool SGreaterThan %uint_53 %uint_min4
152 %icmpule = OpSpecConstantOp %bool ULessThanEqual %uint_53 %uint_min4
153 %icmpsle = OpSpecConstantOp %bool SLessThanEqual %uint_53 %uint_min4
154 %icmpuge = OpSpecConstantOp %bool UGreaterThanEqual %uint_53 %uint_min4
155 %icmpsge = OpSpecConstantOp %bool SGreaterThanEqual %uint_53 %uint_min4
156 %bitcast = OpSpecConstantOp %uint Bitcast %float_1
157 %_ptr_uchar = OpTypePointer CrossWorkgroup %uchar
158 %_ptr_uint = OpTypePointer CrossWorkgroup %uint
159 %_ptr_bool = OpTypePointer CrossWorkgroup %bool
160 %_ptr_v2i32 = OpTypePointer CrossWorkgroup %v2i32
161 %void = OpTypeVoid
162 %14 = OpTypeFunction %void
163
164 %var_sconvert = OpVariable %_ptr_uchar CrossWorkgroup %sconvert
165 %var_uconvert = OpVariable %_ptr_uchar CrossWorkgroup %uconvert
166 %var_snegate = OpVariable %_ptr_uint CrossWorkgroup %snegate
167 %var_not = OpVariable %_ptr_uint CrossWorkgroup %not
168 %var_iadd = OpVariable %_ptr_uint CrossWorkgroup %iadd
169 %var_isub = OpVariable %_ptr_uint CrossWorkgroup %isub
170 %var_imul = OpVariable %_ptr_uint CrossWorkgroup %imul
171 %var_udiv = OpVariable %_ptr_uint CrossWorkgroup %udiv
172 %var_udiv0 = OpVariable %_ptr_uint CrossWorkgroup %udiv0
173 %var_sdiv = OpVariable %_ptr_uint CrossWorkgroup %sdiv
174 %var_sdiv0 = OpVariable %_ptr_uint CrossWorkgroup %sdiv0
175 %var_umod = OpVariable %_ptr_uint CrossWorkgroup %umod
176 %var_srem = OpVariable %_ptr_uint CrossWorkgroup %srem
177 %var_smod = OpVariable %_ptr_uint CrossWorkgroup %smod
178 %var_srl = OpVariable %_ptr_uint CrossWorkgroup %srl
179 %var_sra = OpVariable %_ptr_uint CrossWorkgroup %sra
180 %var_sll = OpVariable %_ptr_uint CrossWorkgroup %sll
181 %var_sll_big = OpVariable %_ptr_uint CrossWorkgroup %sll_big
182 %var_bitor = OpVariable %_ptr_uint CrossWorkgroup %bitor
183 %var_bitxor = OpVariable %_ptr_uint CrossWorkgroup %bitxor
184 %var_bitand = OpVariable %_ptr_uint CrossWorkgroup %bitand
185 %var_vecshuf = OpVariable %_ptr_v2i32 CrossWorkgroup %vecshuf
186 %var_compext = OpVariable %_ptr_uint CrossWorkgroup %compext
187 %var_compins = OpVariable %_ptr_v2i32 CrossWorkgroup %compins
188 %var_logor = OpVariable %_ptr_bool CrossWorkgroup %logor
189 %var_logand = OpVariable %_ptr_bool CrossWorkgroup %logand
190 %var_lognot = OpVariable %_ptr_bool CrossWorkgroup %lognot
191 %var_logeq = OpVariable %_ptr_bool CrossWorkgroup %logeq
192 %var_logne = OpVariable %_ptr_bool CrossWorkgroup %logne
193 %var_select = OpVariable %_ptr_uint CrossWorkgroup %select
194 %var_icmpeq = OpVariable %_ptr_bool CrossWorkgroup %icmpeq
195 %var_icmpne = OpVariable %_ptr_bool CrossWorkgroup %icmpne
196 %var_icmpult = OpVariable %_ptr_bool CrossWorkgroup %icmpult
197 %var_icmpslt = OpVariable %_ptr_bool CrossWorkgroup %icmpslt
198 %var_icmpugt = OpVariable %_ptr_bool CrossWorkgroup %icmpugt
199 %var_icmpsgt = OpVariable %_ptr_bool CrossWorkgroup %icmpsgt
200 %var_icmpule = OpVariable %_ptr_bool CrossWorkgroup %icmpule
201 %var_icmpsle = OpVariable %_ptr_bool CrossWorkgroup %icmpsle
202 %var_icmpuge = OpVariable %_ptr_bool CrossWorkgroup %icmpuge
203 %var_icmpsge = OpVariable %_ptr_bool CrossWorkgroup %icmpsge
204 %var_bitcast = OpVariable %_ptr_uint CrossWorkgroup %bitcast
205
206 %15 = OpFunction %void Pure %14
207 %entry = OpLabel
208 OpReturn
209 OpFunctionEnd