1 ;; #pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_vote : enable
3 ;; kernel void testSubGroupElect(global int* dst) {
4 ;; dst[0] = sub_group_elect();
7 ;; kernel void testSubGroupNonUniformAll(global int* dst) {
8 ;; dst[0] = sub_group_non_uniform_all(0);
11 ;; kernel void testSubGroupNonUniformAny(global int* dst) {
12 ;; dst[0] = sub_group_non_uniform_any(0);
15 ;; #pragma OPENCL EXTENSION cl_khr_fp16 : enable
16 ;; #pragma OPENCL EXTENSION cl_khr_fp64 : enable
17 ;; kernel void testSubGroupNonUniformAllEqual(global int* dst) {
20 ;; dst[0] = sub_group_non_uniform_all_equal( v );
24 ;; dst[0] = sub_group_non_uniform_all_equal( v );
28 ;; dst[0] = sub_group_non_uniform_all_equal( v );
32 ;; dst[0] = sub_group_non_uniform_all_equal( v );
36 ;; dst[0] = sub_group_non_uniform_all_equal( v );
40 ;; dst[0] = sub_group_non_uniform_all_equal( v );
44 ;; dst[0] = sub_group_non_uniform_all_equal( v );
48 ;; dst[0] = sub_group_non_uniform_all_equal( v );
52 ;; dst[0] = sub_group_non_uniform_all_equal( v );
56 ;; dst[0] = sub_group_non_uniform_all_equal( v );
60 ;; dst[0] = sub_group_non_uniform_all_equal( v );
64 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
66 ; CHECK-SPIRV-DAG: OpCapability GroupNonUniformVote
68 ; CHECK-SPIRV-DAG: %[[#bool:]] = OpTypeBool
69 ; CHECK-SPIRV-DAG: %[[#char:]] = OpTypeInt 8 0
70 ; CHECK-SPIRV-DAG: %[[#short:]] = OpTypeInt 16 0
71 ; CHECK-SPIRV-DAG: %[[#int:]] = OpTypeInt 32 0
72 ; CHECK-SPIRV-DAG: %[[#long:]] = OpTypeInt 64 0
73 ; CHECK-SPIRV-DAG: %[[#half:]] = OpTypeFloat 16
74 ; CHECK-SPIRV-DAG: %[[#float:]] = OpTypeFloat 32
75 ; CHECK-SPIRV-DAG: %[[#double:]] = OpTypeFloat 64
77 ; CHECK-SPIRV-DAG: %[[#false:]] = OpConstantFalse %[[#bool]]
78 ; CHECK-SPIRV-DAG: %[[#true:]] = OpConstantTrue %[[#bool]]
79 ; CHECK-SPIRV-DAG: %[[#ScopeSubgroup:]] = OpConstant %[[#int]] 3
80 ; CHECK-SPIRV-DAG: %[[#char_0:]] = OpConstant %[[#char]] 0
81 ; CHECK-SPIRV-DAG: %[[#char_10:]] = OpConstant %[[#char]] 10
82 ; CHECK-SPIRV-DAG: %[[#short_0:]] = OpConstant %[[#short]] 0
83 ; CHECK-SPIRV-DAG: %[[#int_0:]] = OpConstant %[[#int]] 0
84 ; CHECK-SPIRV-DAG: %[[#long_0:]] = OpConstantNull %[[#long]]
85 ; CHECK-SPIRV-DAG: %[[#half_0:]] = OpConstant %[[#half]] 0
86 ; CHECK-SPIRV-DAG: %[[#float_0:]] = OpConstant %[[#float]] 0
87 ; CHECK-SPIRV-DAG: %[[#double_0:]] = OpConstant %[[#double]] 0
89 ; CHECK-SPIRV: OpFunction
90 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformElect %[[#bool]] %[[#ScopeSubgroup]]
91 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformElect %[[#bool]] %[[#ScopeSubgroup]]
92 ; CHECK-SPIRV: OpFunctionEnd
94 define dso_local spir_kernel void @testSubGroupElect(i32 addrspace(1)* nocapture) local_unnamed_addr {
95 %2 = tail call spir_func i32 @_Z15sub_group_electv()
96 %r2 = tail call spir_func i1 @__spirv_GroupNonUniformElect(i32 3)
97 store i32 %2, i32 addrspace(1)* %0, align 4
101 declare dso_local spir_func i32 @_Z15sub_group_electv() local_unnamed_addr
102 declare dso_local spir_func i1 @__spirv_GroupNonUniformElect(i32)
104 ; CHECK-SPIRV: OpFunction
105 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAll %[[#bool]] %[[#ScopeSubgroup]] %[[#false]]
106 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAll %[[#bool]] %[[#ScopeSubgroup]] %[[#true]]
107 ; CHECK-SPIRV: OpFunctionEnd
109 define dso_local spir_kernel void @testSubGroupNonUniformAll(i32 addrspace(1)* nocapture) local_unnamed_addr {
110 %2 = tail call spir_func i32 @_Z25sub_group_non_uniform_alli(i32 0)
111 %r2 = tail call spir_func i1 @__spirv_GroupNonUniformAll(i32 3, i1 true)
112 store i32 %2, i32 addrspace(1)* %0, align 4
116 declare dso_local spir_func i32 @_Z25sub_group_non_uniform_alli(i32) local_unnamed_addr
117 declare dso_local spir_func i1 @__spirv_GroupNonUniformAll(i32, i1)
119 ; CHECK-SPIRV: OpFunction
120 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAny %[[#bool]] %[[#ScopeSubgroup]] %[[#false]]
121 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAny %[[#bool]] %[[#ScopeSubgroup]] %[[#true]]
122 ; CHECK-SPIRV: OpFunctionEnd
124 define dso_local spir_kernel void @testSubGroupNonUniformAny(i32 addrspace(1)* nocapture) local_unnamed_addr {
125 %2 = tail call spir_func i32 @_Z25sub_group_non_uniform_anyi(i32 0)
126 %r2 = tail call spir_func i1 @__spirv_GroupNonUniformAny(i32 3, i1 true)
127 store i32 %2, i32 addrspace(1)* %0, align 4
131 declare dso_local spir_func i32 @_Z25sub_group_non_uniform_anyi(i32) local_unnamed_addr
132 declare dso_local spir_func i1 @__spirv_GroupNonUniformAny(i32, i1)
134 ; CHECK-SPIRV: OpFunction
135 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#char_0]]
136 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#char_10]]
137 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#char_0]]
138 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#short_0]]
139 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#short_0]]
140 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#int_0]]
141 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#int_0]]
142 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#long_0]]
143 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#long_0]]
144 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#float_0]]
145 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#half_0]]
146 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#double_0]]
147 ; CHECK-SPIRV: OpFunctionEnd
149 define dso_local spir_kernel void @testSubGroupNonUniformAllEqual(i32 addrspace(1)* nocapture) local_unnamed_addr {
150 %2 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalc(i8 signext 0)
151 %r2 = tail call spir_func i1 @__spirv_GroupNonUniformAllEqual(i32 3, i8 signext 10)
152 store i32 %2, i32 addrspace(1)* %0, align 4
153 %3 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalh(i8 zeroext 0)
154 store i32 %3, i32 addrspace(1)* %0, align 4
155 %4 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equals(i16 signext 0)
156 store i32 %4, i32 addrspace(1)* %0, align 4
157 %5 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalt(i16 zeroext 0)
158 store i32 %5, i32 addrspace(1)* %0, align 4
159 %6 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equali(i32 0)
160 store i32 %6, i32 addrspace(1)* %0, align 4
161 %7 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalj(i32 0)
162 store i32 %7, i32 addrspace(1)* %0, align 4
163 %8 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equall(i64 0)
164 store i32 %8, i32 addrspace(1)* %0, align 4
165 %9 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalm(i64 0)
166 store i32 %9, i32 addrspace(1)* %0, align 4
167 %10 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalf(float 0.000000e+00)
168 store i32 %10, i32 addrspace(1)* %0, align 4
169 %11 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalDh(half 0xH0000)
170 store i32 %11, i32 addrspace(1)* %0, align 4
171 %12 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equald(double 0.000000e+00)
172 store i32 %12, i32 addrspace(1)* %0, align 4
176 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalc(i8 signext) local_unnamed_addr
177 declare dso_local spir_func i1 @__spirv_GroupNonUniformAllEqual(i32, i8 signext)
179 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalh(i8 zeroext) local_unnamed_addr
181 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equals(i16 signext) local_unnamed_addr
183 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalt(i16 zeroext) local_unnamed_addr
185 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equali(i32) local_unnamed_addr
187 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalj(i32) local_unnamed_addr
189 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equall(i64) local_unnamed_addr
191 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalm(i64) local_unnamed_addr
193 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalf(float) local_unnamed_addr
195 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalDh(half) local_unnamed_addr
197 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equald(double) local_unnamed_addr