Skip to content

Commit 23a03d7

Browse files
svenvhAlexeySotkin
authored andcommitted
Add tests for SConvert, UConvert, BitCast OpSpecConstantOp
These do not need any further implementation work.
1 parent de22867 commit 23a03d7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/SpecConstants/specconstantop-init.spvasm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
; operations are supported. Also verify that edge cases such as division
1010
; by zero are handled gracefully.
1111

12+
; CHECK: @var_sconvert = addrspace(1) global i8 53
13+
; CHECK: @var_uconvert = addrspace(1) global i8 53
1214
; CHECK: @var_snegate = addrspace(1) global i32 -53
1315
; CHECK: @var_not = addrspace(1) global i32 -54
1416
; CHECK: @var_iadd = addrspace(1) global i32 49
@@ -43,13 +45,17 @@
4345
; CHECK: @var_icmpsle = addrspace(1) global i1 false
4446
; CHECK: @var_icmpuge = addrspace(1) global i1 false
4547
; CHECK: @var_icmpsge = addrspace(1) global i1 true
48+
; CHECK: @var_bitcast = addrspace(1) global i32 1065353216
4649

4750
OpCapability Addresses
4851
OpCapability Linkage
4952
OpCapability Kernel
53+
OpCapability Int8
5054
OpMemoryModel Physical32 OpenCL
5155
OpEntryPoint Kernel %15 "foo"
5256
OpName %entry "entry"
57+
OpDecorate %var_sconvert LinkageAttributes "var_sconvert" Export
58+
OpDecorate %var_uconvert LinkageAttributes "var_uconvert" Export
5359
OpDecorate %var_snegate LinkageAttributes "var_snegate" Export
5460
OpDecorate %var_not LinkageAttributes "var_not" Export
5561
OpDecorate %var_iadd LinkageAttributes "var_iadd" Export
@@ -83,14 +89,20 @@
8389
OpDecorate %var_icmpsle LinkageAttributes "var_icmpsle" Export
8490
OpDecorate %var_icmpuge LinkageAttributes "var_icmpuge" Export
8591
OpDecorate %var_icmpsge LinkageAttributes "var_icmpsge" Export
92+
OpDecorate %var_bitcast LinkageAttributes "var_bitcast" Export
8693
%bool = OpTypeBool
8794
%true = OpConstantTrue %bool
8895
%false = OpConstantFalse %bool
96+
%uchar = OpTypeInt 8 0
8997
%uint = OpTypeInt 32 0
98+
%float = OpTypeFloat 32
9099
%uint_0 = OpConstant %uint 0
91100
%uint_4 = OpConstant %uint 4
92101
%uint_53 = OpConstant %uint 53
93102
%uint_min4 = OpConstant %uint 0xfffffffc
103+
%float_1 = OpConstant %float 1.0
104+
%sconvert = OpSpecConstantOp %uchar SConvert %uint_53
105+
%uconvert = OpSpecConstantOp %uchar UConvert %uint_53
94106
%snegate = OpSpecConstantOp %uint SNegate %uint_53
95107
%not = OpSpecConstantOp %uint Not %uint_53
96108
%iadd = OpSpecConstantOp %uint IAdd %uint_53 %uint_min4
@@ -124,11 +136,15 @@
124136
%icmpsle = OpSpecConstantOp %bool SLessThanEqual %uint_53 %uint_min4
125137
%icmpuge = OpSpecConstantOp %bool UGreaterThanEqual %uint_53 %uint_min4
126138
%icmpsge = OpSpecConstantOp %bool SGreaterThanEqual %uint_53 %uint_min4
139+
%bitcast = OpSpecConstantOp %uint Bitcast %float_1
140+
%_ptr_uchar = OpTypePointer CrossWorkgroup %uchar
127141
%_ptr_uint = OpTypePointer CrossWorkgroup %uint
128142
%_ptr_bool = OpTypePointer CrossWorkgroup %bool
129143
%void = OpTypeVoid
130144
%14 = OpTypeFunction %void
131145

146+
%var_sconvert = OpVariable %_ptr_uchar CrossWorkgroup %sconvert
147+
%var_uconvert = OpVariable %_ptr_uchar CrossWorkgroup %uconvert
132148
%var_snegate = OpVariable %_ptr_uint CrossWorkgroup %snegate
133149
%var_not = OpVariable %_ptr_uint CrossWorkgroup %not
134150
%var_iadd = OpVariable %_ptr_uint CrossWorkgroup %iadd
@@ -162,6 +178,7 @@
162178
%var_icmpsle = OpVariable %_ptr_bool CrossWorkgroup %icmpsle
163179
%var_icmpuge = OpVariable %_ptr_bool CrossWorkgroup %icmpuge
164180
%var_icmpsge = OpVariable %_ptr_bool CrossWorkgroup %icmpsge
181+
%var_bitcast = OpVariable %_ptr_uint CrossWorkgroup %bitcast
165182

166183
%15 = OpFunction %void Pure %14
167184
%entry = OpLabel

0 commit comments

Comments
 (0)