[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / CodeGen / SPIRV / transcoding / sub_group_ballot.ll
bloba815f5d44969c9b73754ffb72014974c8ae70d3f
1 ;; #pragma OPENCL EXTENSION cl_khr_subgroup_ballot : enable
2 ;; #pragma OPENCL EXTENSION cl_khr_fp16 : enable
3 ;; #pragma OPENCL EXTENSION cl_khr_fp64 : enable
4 ;;
5 ;; kernel void testNonUniformBroadcastChars()
6 ;; {
7 ;;     char16 v = 0;
8 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
9 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
10 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
11 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
12 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
13 ;;     v = sub_group_non_uniform_broadcast(v, 0);
14 ;;     v.s0 = sub_group_broadcast_first(v.s0);
15 ;; }
17 ;; kernel void testNonUniformBroadcastUChars()
18 ;; {
19 ;;     uchar16 v = 0;
20 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
21 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
22 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
23 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
24 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
25 ;;     v = sub_group_non_uniform_broadcast(v, 0);
26 ;;     v.s0 = sub_group_broadcast_first(v.s0);
27 ;; }
29 ;; kernel void testNonUniformBroadcastShorts()
30 ;; {
31 ;;     short16 v = 0;
32 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
33 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
34 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
35 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
36 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
37 ;;     v = sub_group_non_uniform_broadcast(v, 0);
38 ;;     v.s0 = sub_group_broadcast_first(v.s0);
39 ;; }
41 ;; kernel void testNonUniformBroadcastUShorts()
42 ;; {
43 ;;     ushort16 v = 0;
44 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
45 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
46 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
47 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
48 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
49 ;;     v = sub_group_non_uniform_broadcast(v, 0);
50 ;;     v.s0 = sub_group_broadcast_first(v.s0);
51 ;; }
53 ;; kernel void testNonUniformBroadcastInts()
54 ;; {
55 ;;     int16 v = 0;
56 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
57 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
58 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
59 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
60 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
61 ;;     v = sub_group_non_uniform_broadcast(v, 0);
62 ;;     v.s0 = sub_group_broadcast_first(v.s0);
63 ;; }
65 ;; kernel void testNonUniformBroadcastUInts()
66 ;; {
67 ;;     uint16 v = 0;
68 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
69 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
70 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
71 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
72 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
73 ;;     v = sub_group_non_uniform_broadcast(v, 0);
74 ;;     v.s0 = sub_group_broadcast_first(v.s0);
75 ;; }
77 ;; kernel void testNonUniformBroadcastLongs()
78 ;; {
79 ;;     long16 v = 0;
80 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
81 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
82 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
83 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
84 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
85 ;;     v = sub_group_non_uniform_broadcast(v, 0);
86 ;;     v.s0 = sub_group_broadcast_first(v.s0);
87 ;; }
89 ;; kernel void testNonUniformBroadcastULongs()
90 ;; {
91 ;;     ulong16 v = 0;
92 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
93 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
94 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
95 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
96 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
97 ;;     v = sub_group_non_uniform_broadcast(v, 0);
98 ;;     v.s0 = sub_group_broadcast_first(v.s0);
99 ;; }
101 ;; kernel void testNonUniformBroadcastFloats()
102 ;; {
103 ;;     float16 v = 0;
104 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
105 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
106 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
107 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
108 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
109 ;;     v = sub_group_non_uniform_broadcast(v, 0);
110 ;;     v.s0 = sub_group_broadcast_first(v.s0);
111 ;; }
113 ;; kernel void testNonUniformBroadcastHalfs()
114 ;; {
115 ;;     half16 v = 0;
116 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
117 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
118 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
119 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
120 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
121 ;;     v = sub_group_non_uniform_broadcast(v, 0);
122 ;;     v.s0 = sub_group_broadcast_first(v.s0);
123 ;; }
125 ;; kernel void testNonUniformBroadcastDoubles()
126 ;; {
127 ;;     double16 v = 0;
128 ;;     v.s0 = sub_group_non_uniform_broadcast(v.s0, 0);
129 ;;     v.s01 = sub_group_non_uniform_broadcast(v.s01, 0);
130 ;;     v.s012 = sub_group_non_uniform_broadcast(v.s012, 0);
131 ;;     v.s0123 = sub_group_non_uniform_broadcast(v.s0123, 0);
132 ;;     v.s01234567 = sub_group_non_uniform_broadcast(v.s01234567, 0);
133 ;;     v = sub_group_non_uniform_broadcast(v, 0);
134 ;;     v.s0 = sub_group_broadcast_first(v.s0);
135 ;; }
137 ;; kernel void testBallotOperations(global uint* dst)
138 ;; {
139 ;;     uint4 v = sub_group_ballot(0);
140 ;;     dst[0] = sub_group_inverse_ballot(v);
141 ;;     dst[1] = sub_group_ballot_bit_extract(v, 0);
142 ;;     dst[2] = sub_group_ballot_bit_count(v);
143 ;;     dst[3] = sub_group_ballot_inclusive_scan(v);
144 ;;     dst[4] = sub_group_ballot_exclusive_scan(v);
145 ;;     dst[5] = sub_group_ballot_find_lsb(v);
146 ;;     dst[6] = sub_group_ballot_find_msb(v);
147 ;; }
149 ;; kernel void testSubgroupMasks(global uint4* dst)
150 ;; {
151 ;;     dst[0] = get_sub_group_eq_mask();
152 ;;     dst[1] = get_sub_group_ge_mask();
153 ;;     dst[2] = get_sub_group_gt_mask();
154 ;;     dst[3] = get_sub_group_le_mask();
155 ;;     dst[4] = get_sub_group_lt_mask();
156 ;; }
158 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
160 ; CHECK-SPIRV-DAG: OpCapability GroupNonUniformBallot
162 ; CHECK-SPIRV-DAG: OpDecorate %[[#eqMask:]] BuiltIn SubgroupEqMask
163 ; CHECK-SPIRV-DAG: OpDecorate %[[#geMask:]] BuiltIn SubgroupGeMask
164 ; CHECK-SPIRV-DAG: OpDecorate %[[#gtMask:]] BuiltIn SubgroupGtMask
165 ; CHECK-SPIRV-DAG: OpDecorate %[[#leMask:]] BuiltIn SubgroupLeMask
166 ; CHECK-SPIRV-DAG: OpDecorate %[[#ltMask:]] BuiltIn SubgroupLtMask
168 ; CHECK-SPIRV-DAG: %[[#bool:]] = OpTypeBool
169 ; CHECK-SPIRV-DAG: %[[#char:]] = OpTypeInt 8 0
170 ; CHECK-SPIRV-DAG: %[[#short:]] = OpTypeInt 16 0
171 ; CHECK-SPIRV-DAG: %[[#int:]] = OpTypeInt 32 0
172 ; CHECK-SPIRV-DAG: %[[#long:]] = OpTypeInt 64 0
173 ; CHECK-SPIRV-DAG: %[[#half:]] = OpTypeFloat 16
174 ; CHECK-SPIRV-DAG: %[[#float:]] = OpTypeFloat 32
175 ; CHECK-SPIRV-DAG: %[[#double:]] = OpTypeFloat 64
177 ; CHECK-SPIRV-DAG: %[[#char2:]] = OpTypeVector %[[#char]] 2
178 ; CHECK-SPIRV-DAG: %[[#char3:]] = OpTypeVector %[[#char]] 3
179 ; CHECK-SPIRV-DAG: %[[#char4:]] = OpTypeVector %[[#char]] 4
180 ; CHECK-SPIRV-DAG: %[[#char8:]] = OpTypeVector %[[#char]] 8
181 ; CHECK-SPIRV-DAG: %[[#char16:]] = OpTypeVector %[[#char]] 16
183 ; CHECK-SPIRV-DAG: %[[#short2:]] = OpTypeVector %[[#short]] 2
184 ; CHECK-SPIRV-DAG: %[[#short3:]] = OpTypeVector %[[#short]] 3
185 ; CHECK-SPIRV-DAG: %[[#short4:]] = OpTypeVector %[[#short]] 4
186 ; CHECK-SPIRV-DAG: %[[#short8:]] = OpTypeVector %[[#short]] 8
187 ; CHECK-SPIRV-DAG: %[[#short16:]] = OpTypeVector %[[#short]] 16
189 ; CHECK-SPIRV-DAG: %[[#int2:]] = OpTypeVector %[[#int]] 2
190 ; CHECK-SPIRV-DAG: %[[#int3:]] = OpTypeVector %[[#int]] 3
191 ; CHECK-SPIRV-DAG: %[[#int4:]] = OpTypeVector %[[#int]] 4
192 ; CHECK-SPIRV-DAG: %[[#int8:]] = OpTypeVector %[[#int]] 8
193 ; CHECK-SPIRV-DAG: %[[#int16:]] = OpTypeVector %[[#int]] 16
195 ; CHECK-SPIRV-DAG: %[[#long2:]] = OpTypeVector %[[#long]] 2
196 ; CHECK-SPIRV-DAG: %[[#long3:]] = OpTypeVector %[[#long]] 3
197 ; CHECK-SPIRV-DAG: %[[#long4:]] = OpTypeVector %[[#long]] 4
198 ; CHECK-SPIRV-DAG: %[[#long8:]] = OpTypeVector %[[#long]] 8
199 ; CHECK-SPIRV-DAG: %[[#long16:]] = OpTypeVector %[[#long]] 16
201 ; CHECK-SPIRV-DAG: %[[#float2:]] = OpTypeVector %[[#float]] 2
202 ; CHECK-SPIRV-DAG: %[[#float3:]] = OpTypeVector %[[#float]] 3
203 ; CHECK-SPIRV-DAG: %[[#float4:]] = OpTypeVector %[[#float]] 4
204 ; CHECK-SPIRV-DAG: %[[#float8:]] = OpTypeVector %[[#float]] 8
205 ; CHECK-SPIRV-DAG: %[[#float16:]] = OpTypeVector %[[#float]] 16
207 ; CHECK-SPIRV-DAG: %[[#half2:]] = OpTypeVector %[[#half]] 2
208 ; CHECK-SPIRV-DAG: %[[#half3:]] = OpTypeVector %[[#half]] 3
209 ; CHECK-SPIRV-DAG: %[[#half4:]] = OpTypeVector %[[#half]] 4
210 ; CHECK-SPIRV-DAG: %[[#half8:]] = OpTypeVector %[[#half]] 8
211 ; CHECK-SPIRV-DAG: %[[#half16:]] = OpTypeVector %[[#half]] 16
213 ; CHECK-SPIRV-DAG: %[[#double2:]] = OpTypeVector %[[#double]] 2
214 ; CHECK-SPIRV-DAG: %[[#double3:]] = OpTypeVector %[[#double]] 3
215 ; CHECK-SPIRV-DAG: %[[#double4:]] = OpTypeVector %[[#double]] 4
216 ; CHECK-SPIRV-DAG: %[[#double8:]] = OpTypeVector %[[#double]] 8
217 ; CHECK-SPIRV-DAG: %[[#double16:]] = OpTypeVector %[[#double]] 16
219 ; CHECK-SPIRV-DAG: %[[#false:]] = OpConstantFalse %[[#bool]]
220 ; CHECK-SPIRV-DAG: %[[#ScopeSubgroup:]] = OpConstant %[[#int]] 3
221 ; CHECK-SPIRV-DAG: %[[#char_0:]] = OpConstant %[[#char]] 0
222 ; CHECK-SPIRV-DAG: %[[#short_0:]] = OpConstant %[[#short]] 0
223 ; CHECK-SPIRV-DAG: %[[#int_0:]] = OpConstant %[[#int]] 0
224 ; CHECK-SPIRV-DAG: %[[#long_0:]] = OpConstantNull %[[#long]]
225 ; CHECK-SPIRV-DAG: %[[#half_0:]] = OpConstant %[[#half]] 0
226 ; CHECK-SPIRV-DAG: %[[#float_0:]] = OpConstant %[[#float]] 0
227 ; CHECK-SPIRV-DAG: %[[#double_0:]] = OpConstant %[[#double]] 0
229 ; CHECK-SPIRV: OpFunction
230 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char]] %[[#ScopeSubgroup]] %[[#char_0]] %[[#int_0]]
231 ; CHECK-SPIRV: %[[#char2_0:]] = OpVectorShuffle %[[#char2]]
232 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char2]] %[[#ScopeSubgroup]] %[[#char2_0]] %[[#int_0]]
233 ; CHECK-SPIRV: %[[#char3_0:]] = OpVectorShuffle %[[#char3]]
234 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char3]] %[[#ScopeSubgroup]] %[[#char3_0]] %[[#int_0]]
235 ; CHECK-SPIRV: %[[#char4_0:]] = OpVectorShuffle %[[#char4]]
236 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char4]] %[[#ScopeSubgroup]] %[[#char4_0]] %[[#int_0]]
237 ; CHECK-SPIRV: %[[#char8_0:]] = OpVectorShuffle %[[#char8]]
238 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char8]] %[[#ScopeSubgroup]] %[[#char8_0]] %[[#int_0]]
239 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#char16]]
240 ; CHECK-SPIRV: %[[#char16_0:]] = OpVectorShuffle %[[#char16]]
241 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char16]] %[[#ScopeSubgroup]] %[[#char16_0]] %[[#int_0]]
242 ; CHECK-SPIRV: %[[#char_value:]] = OpCompositeExtract %[[#char]]
243 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#char]] %[[#ScopeSubgroup]] %[[#char_value]]
244 ; CHECK-SPIRV: OpFunctionEnd
246 define dso_local spir_kernel void @testNonUniformBroadcastChars() local_unnamed_addr {
247   %1 = tail call spir_func signext i8 @_Z31sub_group_non_uniform_broadcastcj(i8 signext 0, i32 0)
248   %2 = insertelement <16 x i8> <i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %1, i64 0
249   %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <2 x i32> <i32 0, i32 1>
250   %4 = tail call spir_func <2 x i8> @_Z31sub_group_non_uniform_broadcastDv2_cj(<2 x i8> %3, i32 0)
251   %5 = shufflevector <2 x i8> %4, <2 x i8> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
252   %6 = shufflevector <16 x i8> %5, <16 x i8> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
253   %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <3 x i32> <i32 0, i32 1, i32 2>
254   %8 = tail call spir_func <3 x i8> @_Z31sub_group_non_uniform_broadcastDv3_cj(<3 x i8> %7, i32 0)
255   %9 = shufflevector <3 x i8> %8, <3 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
256   %10 = shufflevector <16 x i8> %9, <16 x i8> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
257   %11 = shufflevector <16 x i8> %10, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
258   %12 = tail call spir_func <4 x i8> @_Z31sub_group_non_uniform_broadcastDv4_cj(<4 x i8> %11, i32 0)
259   %13 = shufflevector <4 x i8> %12, <4 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
260   %14 = shufflevector <16 x i8> %13, <16 x i8> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
261   %15 = shufflevector <16 x i8> %14, <16 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
262   %16 = tail call spir_func <8 x i8> @_Z31sub_group_non_uniform_broadcastDv8_cj(<8 x i8> %15, i32 0)
263   %17 = shufflevector <8 x i8> %16, <8 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
264   %18 = shufflevector <16 x i8> %17, <16 x i8> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
265   %19 = tail call spir_func <16 x i8> @_Z31sub_group_non_uniform_broadcastDv16_cj(<16 x i8> %18, i32 0)
266   %20 = extractelement <16 x i8> %19, i64 0
267   %21 = tail call spir_func signext i8 @_Z25sub_group_broadcast_firstc(i8 signext %20)
268   ret void
271 declare dso_local spir_func signext i8 @_Z31sub_group_non_uniform_broadcastcj(i8 signext, i32) local_unnamed_addr
273 declare dso_local spir_func <2 x i8> @_Z31sub_group_non_uniform_broadcastDv2_cj(<2 x i8>, i32) local_unnamed_addr
275 declare dso_local spir_func <3 x i8> @_Z31sub_group_non_uniform_broadcastDv3_cj(<3 x i8>, i32) local_unnamed_addr
277 declare dso_local spir_func <4 x i8> @_Z31sub_group_non_uniform_broadcastDv4_cj(<4 x i8>, i32) local_unnamed_addr
279 declare dso_local spir_func <8 x i8> @_Z31sub_group_non_uniform_broadcastDv8_cj(<8 x i8>, i32) local_unnamed_addr
281 declare dso_local spir_func <16 x i8> @_Z31sub_group_non_uniform_broadcastDv16_cj(<16 x i8>, i32) local_unnamed_addr
283 declare dso_local spir_func signext i8 @_Z25sub_group_broadcast_firstc(i8 signext) local_unnamed_addr
285 ; CHECK-SPIRV: OpFunction
286 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char]] %[[#ScopeSubgroup]] %[[#char_0]] %[[#int_0]]
287 ; CHECK-SPIRV: %[[#char2_0:]] = OpVectorShuffle %[[#char2]]
288 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char2]] %[[#ScopeSubgroup]] %[[#char2_0]] %[[#int_0]]
289 ; CHECK-SPIRV: %[[#char3_0:]] = OpVectorShuffle %[[#char3]]
290 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char3]] %[[#ScopeSubgroup]] %[[#char3_0]] %[[#int_0]]
291 ; CHECK-SPIRV: %[[#char4_0:]] = OpVectorShuffle %[[#char4]]
292 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char4]] %[[#ScopeSubgroup]] %[[#char4_0]] %[[#int_0]]
293 ; CHECK-SPIRV: %[[#char8_0:]] = OpVectorShuffle %[[#char8]]
294 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char8]] %[[#ScopeSubgroup]] %[[#char8_0]] %[[#int_0]]
295 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#char16]]
296 ; CHECK-SPIRV: %[[#char16_0:]] = OpVectorShuffle %[[#char16]]
297 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#char16]] %[[#ScopeSubgroup]] %[[#char16_0]] %[[#int_0]]
298 ; CHECK-SPIRV: %[[#char_value:]] = OpCompositeExtract %[[#char]]
299 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#char]] %[[#ScopeSubgroup]] %[[#char_value]]
300 ; CHECK-SPIRV: OpFunctionEnd
302 define dso_local spir_kernel void @testNonUniformBroadcastUChars() local_unnamed_addr {
303   %1 = tail call spir_func zeroext i8 @_Z31sub_group_non_uniform_broadcasthj(i8 zeroext 0, i32 0)
304   %2 = insertelement <16 x i8> <i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %1, i64 0
305   %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <2 x i32> <i32 0, i32 1>
306   %4 = tail call spir_func <2 x i8> @_Z31sub_group_non_uniform_broadcastDv2_hj(<2 x i8> %3, i32 0)
307   %5 = shufflevector <2 x i8> %4, <2 x i8> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
308   %6 = shufflevector <16 x i8> %5, <16 x i8> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
309   %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <3 x i32> <i32 0, i32 1, i32 2>
310   %8 = tail call spir_func <3 x i8> @_Z31sub_group_non_uniform_broadcastDv3_hj(<3 x i8> %7, i32 0)
311   %9 = shufflevector <3 x i8> %8, <3 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
312   %10 = shufflevector <16 x i8> %9, <16 x i8> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
313   %11 = shufflevector <16 x i8> %10, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
314   %12 = tail call spir_func <4 x i8> @_Z31sub_group_non_uniform_broadcastDv4_hj(<4 x i8> %11, i32 0)
315   %13 = shufflevector <4 x i8> %12, <4 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
316   %14 = shufflevector <16 x i8> %13, <16 x i8> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
317   %15 = shufflevector <16 x i8> %14, <16 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
318   %16 = tail call spir_func <8 x i8> @_Z31sub_group_non_uniform_broadcastDv8_hj(<8 x i8> %15, i32 0)
319   %17 = shufflevector <8 x i8> %16, <8 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
320   %18 = shufflevector <16 x i8> %17, <16 x i8> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
321   %19 = tail call spir_func <16 x i8> @_Z31sub_group_non_uniform_broadcastDv16_hj(<16 x i8> %18, i32 0)
322   %20 = extractelement <16 x i8> %19, i64 0
323   %21 = tail call spir_func zeroext i8 @_Z25sub_group_broadcast_firsth(i8 zeroext %20)
324   ret void
327 declare dso_local spir_func zeroext i8 @_Z31sub_group_non_uniform_broadcasthj(i8 zeroext, i32) local_unnamed_addr
329 declare dso_local spir_func <2 x i8> @_Z31sub_group_non_uniform_broadcastDv2_hj(<2 x i8>, i32) local_unnamed_addr
331 declare dso_local spir_func <3 x i8> @_Z31sub_group_non_uniform_broadcastDv3_hj(<3 x i8>, i32) local_unnamed_addr
333 declare dso_local spir_func <4 x i8> @_Z31sub_group_non_uniform_broadcastDv4_hj(<4 x i8>, i32) local_unnamed_addr
335 declare dso_local spir_func <8 x i8> @_Z31sub_group_non_uniform_broadcastDv8_hj(<8 x i8>, i32) local_unnamed_addr
337 declare dso_local spir_func <16 x i8> @_Z31sub_group_non_uniform_broadcastDv16_hj(<16 x i8>, i32) local_unnamed_addr
339 declare dso_local spir_func zeroext i8 @_Z25sub_group_broadcast_firsth(i8 zeroext) local_unnamed_addr
341 ; CHECK-SPIRV: OpFunction
342 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short]] %[[#ScopeSubgroup]] %[[#short_0]] %[[#int_0]]
343 ; CHECK-SPIRV: %[[#short2_0:]] = OpVectorShuffle %[[#short2]]
344 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short2]] %[[#ScopeSubgroup]] %[[#short2_0]] %[[#int_0]]
345 ; CHECK-SPIRV: %[[#short3_0:]] = OpVectorShuffle %[[#short3]]
346 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short3]] %[[#ScopeSubgroup]] %[[#short3_0]] %[[#int_0]]
347 ; CHECK-SPIRV: %[[#short4_0:]] = OpVectorShuffle %[[#short4]]
348 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short4]] %[[#ScopeSubgroup]] %[[#short4_0]] %[[#int_0]]
349 ; CHECK-SPIRV: %[[#short8_0:]] = OpVectorShuffle %[[#short8]]
350 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short8]] %[[#ScopeSubgroup]] %[[#short8_0]] %[[#int_0]]
351 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#short16]]
352 ; CHECK-SPIRV: %[[#short16_0:]] = OpVectorShuffle %[[#short16]]
353 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short16]] %[[#ScopeSubgroup]] %[[#short16_0]] %[[#int_0]]
354 ; CHECK-SPIRV: %[[#short_value:]] = OpCompositeExtract %[[#short]]
355 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#short]] %[[#ScopeSubgroup]] %[[#short_value]]
356 ; CHECK-SPIRV: OpFunctionEnd
358 define dso_local spir_kernel void @testNonUniformBroadcastShorts() local_unnamed_addr {
359   %1 = tail call spir_func signext i16 @_Z31sub_group_non_uniform_broadcastsj(i16 signext 0, i32 0)
360   %2 = insertelement <16 x i16> <i16 undef, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, i16 %1, i64 0
361   %3 = shufflevector <16 x i16> %2, <16 x i16> undef, <2 x i32> <i32 0, i32 1>
362   %4 = tail call spir_func <2 x i16> @_Z31sub_group_non_uniform_broadcastDv2_sj(<2 x i16> %3, i32 0)
363   %5 = shufflevector <2 x i16> %4, <2 x i16> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
364   %6 = shufflevector <16 x i16> %5, <16 x i16> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
365   %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <3 x i32> <i32 0, i32 1, i32 2>
366   %8 = tail call spir_func <3 x i16> @_Z31sub_group_non_uniform_broadcastDv3_sj(<3 x i16> %7, i32 0)
367   %9 = shufflevector <3 x i16> %8, <3 x i16> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
368   %10 = shufflevector <16 x i16> %9, <16 x i16> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
369   %11 = shufflevector <16 x i16> %10, <16 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
370   %12 = tail call spir_func <4 x i16> @_Z31sub_group_non_uniform_broadcastDv4_sj(<4 x i16> %11, i32 0)
371   %13 = shufflevector <4 x i16> %12, <4 x i16> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
372   %14 = shufflevector <16 x i16> %13, <16 x i16> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
373   %15 = shufflevector <16 x i16> %14, <16 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
374   %16 = tail call spir_func <8 x i16> @_Z31sub_group_non_uniform_broadcastDv8_sj(<8 x i16> %15, i32 0)
375   %17 = shufflevector <8 x i16> %16, <8 x i16> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
376   %18 = shufflevector <16 x i16> %17, <16 x i16> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
377   %19 = tail call spir_func <16 x i16> @_Z31sub_group_non_uniform_broadcastDv16_sj(<16 x i16> %18, i32 0)
378   %20 = extractelement <16 x i16> %19, i64 0
379   %21 = tail call spir_func signext i16 @_Z25sub_group_broadcast_firsts(i16 signext %20)
380   ret void
383 declare dso_local spir_func signext i16 @_Z31sub_group_non_uniform_broadcastsj(i16 signext, i32) local_unnamed_addr
385 declare dso_local spir_func <2 x i16> @_Z31sub_group_non_uniform_broadcastDv2_sj(<2 x i16>, i32) local_unnamed_addr
387 declare dso_local spir_func <3 x i16> @_Z31sub_group_non_uniform_broadcastDv3_sj(<3 x i16>, i32) local_unnamed_addr
389 declare dso_local spir_func <4 x i16> @_Z31sub_group_non_uniform_broadcastDv4_sj(<4 x i16>, i32) local_unnamed_addr
391 declare dso_local spir_func <8 x i16> @_Z31sub_group_non_uniform_broadcastDv8_sj(<8 x i16>, i32) local_unnamed_addr
393 declare dso_local spir_func <16 x i16> @_Z31sub_group_non_uniform_broadcastDv16_sj(<16 x i16>, i32) local_unnamed_addr
395 declare dso_local spir_func signext i16 @_Z25sub_group_broadcast_firsts(i16 signext) local_unnamed_addr
397 ; CHECK-SPIRV: OpFunction
398 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short]] %[[#ScopeSubgroup]] %[[#short_0]] %[[#int_0]]
399 ; CHECK-SPIRV: %[[#short2_0:]] = OpVectorShuffle %[[#short2]]
400 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short2]] %[[#ScopeSubgroup]] %[[#short2_0]] %[[#int_0]]
401 ; CHECK-SPIRV: %[[#short3_0:]] = OpVectorShuffle %[[#short3]]
402 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short3]] %[[#ScopeSubgroup]] %[[#short3_0]] %[[#int_0]]
403 ; CHECK-SPIRV: %[[#short4_0:]] = OpVectorShuffle %[[#short4]]
404 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short4]] %[[#ScopeSubgroup]] %[[#short4_0]] %[[#int_0]]
405 ; CHECK-SPIRV: %[[#short8_0:]] = OpVectorShuffle %[[#short8]]
406 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short8]] %[[#ScopeSubgroup]] %[[#short8_0]] %[[#int_0]]
407 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#short16]]
408 ; CHECK-SPIRV: %[[#short16_0:]] = OpVectorShuffle %[[#short16]]
409 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#short16]] %[[#ScopeSubgroup]] %[[#short16_0]] %[[#int_0]]
410 ; CHECK-SPIRV: %[[#short_value:]] = OpCompositeExtract %[[#short]]
411 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#short]] %[[#ScopeSubgroup]] %[[#short_value]]
412 ; CHECK-SPIRV: OpFunctionEnd
414 define dso_local spir_kernel void @testNonUniformBroadcastUShorts() local_unnamed_addr {
415   %1 = tail call spir_func zeroext i16 @_Z31sub_group_non_uniform_broadcasttj(i16 zeroext 0, i32 0)
416   %2 = insertelement <16 x i16> <i16 undef, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, i16 %1, i64 0
417   %3 = shufflevector <16 x i16> %2, <16 x i16> undef, <2 x i32> <i32 0, i32 1>
418   %4 = tail call spir_func <2 x i16> @_Z31sub_group_non_uniform_broadcastDv2_tj(<2 x i16> %3, i32 0)
419   %5 = shufflevector <2 x i16> %4, <2 x i16> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
420   %6 = shufflevector <16 x i16> %5, <16 x i16> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
421   %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <3 x i32> <i32 0, i32 1, i32 2>
422   %8 = tail call spir_func <3 x i16> @_Z31sub_group_non_uniform_broadcastDv3_tj(<3 x i16> %7, i32 0)
423   %9 = shufflevector <3 x i16> %8, <3 x i16> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
424   %10 = shufflevector <16 x i16> %9, <16 x i16> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
425   %11 = shufflevector <16 x i16> %10, <16 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
426   %12 = tail call spir_func <4 x i16> @_Z31sub_group_non_uniform_broadcastDv4_tj(<4 x i16> %11, i32 0)
427   %13 = shufflevector <4 x i16> %12, <4 x i16> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
428   %14 = shufflevector <16 x i16> %13, <16 x i16> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
429   %15 = shufflevector <16 x i16> %14, <16 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
430   %16 = tail call spir_func <8 x i16> @_Z31sub_group_non_uniform_broadcastDv8_tj(<8 x i16> %15, i32 0)
431   %17 = shufflevector <8 x i16> %16, <8 x i16> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
432   %18 = shufflevector <16 x i16> %17, <16 x i16> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
433   %19 = tail call spir_func <16 x i16> @_Z31sub_group_non_uniform_broadcastDv16_tj(<16 x i16> %18, i32 0)
434   %20 = extractelement <16 x i16> %19, i64 0
435   %21 = tail call spir_func zeroext i16 @_Z25sub_group_broadcast_firstt(i16 zeroext %20)
436   ret void
439 declare dso_local spir_func zeroext i16 @_Z31sub_group_non_uniform_broadcasttj(i16 zeroext, i32) local_unnamed_addr
441 declare dso_local spir_func <2 x i16> @_Z31sub_group_non_uniform_broadcastDv2_tj(<2 x i16>, i32) local_unnamed_addr
443 declare dso_local spir_func <3 x i16> @_Z31sub_group_non_uniform_broadcastDv3_tj(<3 x i16>, i32) local_unnamed_addr
445 declare dso_local spir_func <4 x i16> @_Z31sub_group_non_uniform_broadcastDv4_tj(<4 x i16>, i32) local_unnamed_addr
447 declare dso_local spir_func <8 x i16> @_Z31sub_group_non_uniform_broadcastDv8_tj(<8 x i16>, i32) local_unnamed_addr
449 declare dso_local spir_func <16 x i16> @_Z31sub_group_non_uniform_broadcastDv16_tj(<16 x i16>, i32) local_unnamed_addr
451 declare dso_local spir_func zeroext i16 @_Z25sub_group_broadcast_firstt(i16 zeroext) local_unnamed_addr
453 ; CHECK-SPIRV: OpFunction
454 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int]] %[[#ScopeSubgroup]] %[[#int_0]] %[[#int_0]]
455 ; CHECK-SPIRV: %[[#int2_0:]] = OpVectorShuffle %[[#int2]]
456 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int2]] %[[#ScopeSubgroup]] %[[#int2_0]] %[[#int_0]]
457 ; CHECK-SPIRV: %[[#int3_0:]] = OpVectorShuffle %[[#int3]]
458 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int3]] %[[#ScopeSubgroup]] %[[#int3_0]] %[[#int_0]]
459 ; CHECK-SPIRV: %[[#int4_0:]] = OpVectorShuffle %[[#int4]]
460 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int4]] %[[#ScopeSubgroup]] %[[#int4_0]] %[[#int_0]]
461 ; CHECK-SPIRV: %[[#int8_0:]] = OpVectorShuffle %[[#int8]]
462 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int8]] %[[#ScopeSubgroup]] %[[#int8_0]] %[[#int_0]]
463 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#int16]]
464 ; CHECK-SPIRV: %[[#int16_0:]] = OpVectorShuffle %[[#int16]]
465 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int16]] %[[#ScopeSubgroup]] %[[#int16_0]] %[[#int_0]]
466 ; CHECK-SPIRV: %[[#int_value:]] = OpCompositeExtract %[[#int]]
467 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#int]] %[[#ScopeSubgroup]] %[[#int_value]]
468 ; CHECK-SPIRV: OpFunctionEnd
470 define dso_local spir_kernel void @testNonUniformBroadcastInts() local_unnamed_addr {
471   %1 = tail call spir_func i32 @_Z31sub_group_non_uniform_broadcastij(i32 0, i32 0)
472   %2 = insertelement <16 x i32> <i32 undef, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>, i32 %1, i64 0
473   %3 = shufflevector <16 x i32> %2, <16 x i32> undef, <2 x i32> <i32 0, i32 1>
474   %4 = tail call spir_func <2 x i32> @_Z31sub_group_non_uniform_broadcastDv2_ij(<2 x i32> %3, i32 0)
475   %5 = shufflevector <2 x i32> %4, <2 x i32> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
476   %6 = shufflevector <16 x i32> %5, <16 x i32> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
477   %7 = shufflevector <16 x i32> %6, <16 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
478   %8 = tail call spir_func <3 x i32> @_Z31sub_group_non_uniform_broadcastDv3_ij(<3 x i32> %7, i32 0)
479   %9 = shufflevector <3 x i32> %8, <3 x i32> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
480   %10 = shufflevector <16 x i32> %9, <16 x i32> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
481   %11 = shufflevector <16 x i32> %10, <16 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
482   %12 = tail call spir_func <4 x i32> @_Z31sub_group_non_uniform_broadcastDv4_ij(<4 x i32> %11, i32 0)
483   %13 = shufflevector <4 x i32> %12, <4 x i32> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
484   %14 = shufflevector <16 x i32> %13, <16 x i32> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
485   %15 = shufflevector <16 x i32> %14, <16 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
486   %16 = tail call spir_func <8 x i32> @_Z31sub_group_non_uniform_broadcastDv8_ij(<8 x i32> %15, i32 0)
487   %17 = shufflevector <8 x i32> %16, <8 x i32> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
488   %18 = shufflevector <16 x i32> %17, <16 x i32> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
489   %19 = tail call spir_func <16 x i32> @_Z31sub_group_non_uniform_broadcastDv16_ij(<16 x i32> %18, i32 0)
490   %20 = extractelement <16 x i32> %19, i64 0
491   %21 = tail call spir_func i32 @_Z25sub_group_broadcast_firsti(i32 %20)
492   ret void
495 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_broadcastij(i32, i32) local_unnamed_addr
497 declare dso_local spir_func <2 x i32> @_Z31sub_group_non_uniform_broadcastDv2_ij(<2 x i32>, i32) local_unnamed_addr
499 declare dso_local spir_func <3 x i32> @_Z31sub_group_non_uniform_broadcastDv3_ij(<3 x i32>, i32) local_unnamed_addr
501 declare dso_local spir_func <4 x i32> @_Z31sub_group_non_uniform_broadcastDv4_ij(<4 x i32>, i32) local_unnamed_addr
503 declare dso_local spir_func <8 x i32> @_Z31sub_group_non_uniform_broadcastDv8_ij(<8 x i32>, i32) local_unnamed_addr
505 declare dso_local spir_func <16 x i32> @_Z31sub_group_non_uniform_broadcastDv16_ij(<16 x i32>, i32) local_unnamed_addr
507 declare dso_local spir_func i32 @_Z25sub_group_broadcast_firsti(i32) local_unnamed_addr
509 ; CHECK-SPIRV: OpFunction
510 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int]] %[[#ScopeSubgroup]] %[[#int_0]] %[[#int_0]]
511 ; CHECK-SPIRV: %[[#int2_0:]] = OpVectorShuffle %[[#int2]]
512 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int2]] %[[#ScopeSubgroup]] %[[#int2_0]] %[[#int_0]]
513 ; CHECK-SPIRV: %[[#int3_0:]] = OpVectorShuffle %[[#int3]]
514 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int3]] %[[#ScopeSubgroup]] %[[#int3_0]] %[[#int_0]]
515 ; CHECK-SPIRV: %[[#int4_0:]] = OpVectorShuffle %[[#int4]]
516 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int4]] %[[#ScopeSubgroup]] %[[#int4_0]] %[[#int_0]]
517 ; CHECK-SPIRV: %[[#int8_0:]] = OpVectorShuffle %[[#int8]]
518 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int8]] %[[#ScopeSubgroup]] %[[#int8_0]] %[[#int_0]]
519 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#int16]]
520 ; CHECK-SPIRV: %[[#int16_0:]] = OpVectorShuffle %[[#int16]]
521 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#int16]] %[[#ScopeSubgroup]] %[[#int16_0]] %[[#int_0]]
522 ; CHECK-SPIRV: %[[#int_value:]] = OpCompositeExtract %[[#int]]
523 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#int]] %[[#ScopeSubgroup]] %[[#int_value]]
524 ; CHECK-SPIRV: OpFunctionEnd
526 define dso_local spir_kernel void @testNonUniformBroadcastUInts() local_unnamed_addr {
527   %1 = tail call spir_func i32 @_Z31sub_group_non_uniform_broadcastjj(i32 0, i32 0)
528   %2 = insertelement <16 x i32> <i32 undef, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>, i32 %1, i64 0
529   %3 = shufflevector <16 x i32> %2, <16 x i32> undef, <2 x i32> <i32 0, i32 1>
530   %4 = tail call spir_func <2 x i32> @_Z31sub_group_non_uniform_broadcastDv2_jj(<2 x i32> %3, i32 0)
531   %5 = shufflevector <2 x i32> %4, <2 x i32> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
532   %6 = shufflevector <16 x i32> %5, <16 x i32> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
533   %7 = shufflevector <16 x i32> %6, <16 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
534   %8 = tail call spir_func <3 x i32> @_Z31sub_group_non_uniform_broadcastDv3_jj(<3 x i32> %7, i32 0)
535   %9 = shufflevector <3 x i32> %8, <3 x i32> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
536   %10 = shufflevector <16 x i32> %9, <16 x i32> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
537   %11 = shufflevector <16 x i32> %10, <16 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
538   %12 = tail call spir_func <4 x i32> @_Z31sub_group_non_uniform_broadcastDv4_jj(<4 x i32> %11, i32 0)
539   %13 = shufflevector <4 x i32> %12, <4 x i32> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
540   %14 = shufflevector <16 x i32> %13, <16 x i32> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
541   %15 = shufflevector <16 x i32> %14, <16 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
542   %16 = tail call spir_func <8 x i32> @_Z31sub_group_non_uniform_broadcastDv8_jj(<8 x i32> %15, i32 0)
543   %17 = shufflevector <8 x i32> %16, <8 x i32> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
544   %18 = shufflevector <16 x i32> %17, <16 x i32> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
545   %19 = tail call spir_func <16 x i32> @_Z31sub_group_non_uniform_broadcastDv16_jj(<16 x i32> %18, i32 0)
546   %20 = extractelement <16 x i32> %19, i64 0
547   %21 = tail call spir_func i32 @_Z25sub_group_broadcast_firstj(i32 %20)
548   ret void
551 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_broadcastjj(i32, i32) local_unnamed_addr
553 declare dso_local spir_func <2 x i32> @_Z31sub_group_non_uniform_broadcastDv2_jj(<2 x i32>, i32) local_unnamed_addr
555 declare dso_local spir_func <3 x i32> @_Z31sub_group_non_uniform_broadcastDv3_jj(<3 x i32>, i32) local_unnamed_addr
557 declare dso_local spir_func <4 x i32> @_Z31sub_group_non_uniform_broadcastDv4_jj(<4 x i32>, i32) local_unnamed_addr
559 declare dso_local spir_func <8 x i32> @_Z31sub_group_non_uniform_broadcastDv8_jj(<8 x i32>, i32) local_unnamed_addr
561 declare dso_local spir_func <16 x i32> @_Z31sub_group_non_uniform_broadcastDv16_jj(<16 x i32>, i32) local_unnamed_addr
563 declare dso_local spir_func i32 @_Z25sub_group_broadcast_firstj(i32) local_unnamed_addr
565 ; CHECK-SPIRV: OpFunction
566 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long]] %[[#ScopeSubgroup]] %[[#long_0]] %[[#int_0]]
567 ; CHECK-SPIRV: %[[#long2_0:]] = OpVectorShuffle %[[#long2]]
568 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long2]] %[[#ScopeSubgroup]] %[[#long2_0]] %[[#int_0]]
569 ; CHECK-SPIRV: %[[#long3_0:]] = OpVectorShuffle %[[#long3]]
570 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long3]] %[[#ScopeSubgroup]] %[[#long3_0]] %[[#int_0]]
571 ; CHECK-SPIRV: %[[#long4_0:]] = OpVectorShuffle %[[#long4]]
572 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long4]] %[[#ScopeSubgroup]] %[[#long4_0]] %[[#int_0]]
573 ; CHECK-SPIRV: %[[#long8_0:]] = OpVectorShuffle %[[#long8]]
574 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long8]] %[[#ScopeSubgroup]] %[[#long8_0]] %[[#int_0]]
575 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#long16]]
576 ; CHECK-SPIRV: %[[#long16_0:]] = OpVectorShuffle %[[#long16]]
577 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long16]] %[[#ScopeSubgroup]] %[[#long16_0]] %[[#int_0]]
578 ; CHECK-SPIRV: %[[#long_value:]] = OpCompositeExtract %[[#long]]
579 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#long]] %[[#ScopeSubgroup]] %[[#long_value]]
580 ; CHECK-SPIRV: OpFunctionEnd
582 define dso_local spir_kernel void @testNonUniformBroadcastLongs() local_unnamed_addr {
583   %1 = tail call spir_func i64 @_Z31sub_group_non_uniform_broadcastlj(i64 0, i32 0)
584   %2 = insertelement <16 x i64> <i64 undef, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0>, i64 %1, i64 0
585   %3 = shufflevector <16 x i64> %2, <16 x i64> undef, <2 x i32> <i32 0, i32 1>
586   %4 = tail call spir_func <2 x i64> @_Z31sub_group_non_uniform_broadcastDv2_lj(<2 x i64> %3, i32 0)
587   %5 = shufflevector <2 x i64> %4, <2 x i64> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
588   %6 = shufflevector <16 x i64> %5, <16 x i64> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
589   %7 = shufflevector <16 x i64> %6, <16 x i64> undef, <3 x i32> <i32 0, i32 1, i32 2>
590   %8 = tail call spir_func <3 x i64> @_Z31sub_group_non_uniform_broadcastDv3_lj(<3 x i64> %7, i32 0)
591   %9 = shufflevector <3 x i64> %8, <3 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
592   %10 = shufflevector <16 x i64> %9, <16 x i64> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
593   %11 = shufflevector <16 x i64> %10, <16 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
594   %12 = tail call spir_func <4 x i64> @_Z31sub_group_non_uniform_broadcastDv4_lj(<4 x i64> %11, i32 0)
595   %13 = shufflevector <4 x i64> %12, <4 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
596   %14 = shufflevector <16 x i64> %13, <16 x i64> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
597   %15 = shufflevector <16 x i64> %14, <16 x i64> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
598   %16 = tail call spir_func <8 x i64> @_Z31sub_group_non_uniform_broadcastDv8_lj(<8 x i64> %15, i32 0)
599   %17 = shufflevector <8 x i64> %16, <8 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
600   %18 = shufflevector <16 x i64> %17, <16 x i64> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
601   %19 = tail call spir_func <16 x i64> @_Z31sub_group_non_uniform_broadcastDv16_lj(<16 x i64> %18, i32 0)
602   %20 = extractelement <16 x i64> %19, i64 0
603   %21 = tail call spir_func i64 @_Z25sub_group_broadcast_firstl(i64 %20)
604   ret void
607 declare dso_local spir_func i64 @_Z31sub_group_non_uniform_broadcastlj(i64, i32) local_unnamed_addr
609 declare dso_local spir_func <2 x i64> @_Z31sub_group_non_uniform_broadcastDv2_lj(<2 x i64>, i32) local_unnamed_addr
611 declare dso_local spir_func <3 x i64> @_Z31sub_group_non_uniform_broadcastDv3_lj(<3 x i64>, i32) local_unnamed_addr
613 declare dso_local spir_func <4 x i64> @_Z31sub_group_non_uniform_broadcastDv4_lj(<4 x i64>, i32) local_unnamed_addr
615 declare dso_local spir_func <8 x i64> @_Z31sub_group_non_uniform_broadcastDv8_lj(<8 x i64>, i32) local_unnamed_addr
617 declare dso_local spir_func <16 x i64> @_Z31sub_group_non_uniform_broadcastDv16_lj(<16 x i64>, i32) local_unnamed_addr
619 declare dso_local spir_func i64 @_Z25sub_group_broadcast_firstl(i64) local_unnamed_addr
621 ; CHECK-SPIRV: OpFunction
622 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long]] %[[#ScopeSubgroup]] %[[#long_0]] %[[#int_0]]
623 ; CHECK-SPIRV: %[[#long2_0:]] = OpVectorShuffle %[[#long2]]
624 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long2]] %[[#ScopeSubgroup]] %[[#long2_0]] %[[#int_0]]
625 ; CHECK-SPIRV: %[[#long3_0:]] = OpVectorShuffle %[[#long3]]
626 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long3]] %[[#ScopeSubgroup]] %[[#long3_0]] %[[#int_0]]
627 ; CHECK-SPIRV: %[[#long4_0:]] = OpVectorShuffle %[[#long4]]
628 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long4]] %[[#ScopeSubgroup]] %[[#long4_0]] %[[#int_0]]
629 ; CHECK-SPIRV: %[[#long8_0:]] = OpVectorShuffle %[[#long8]]
630 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long8]] %[[#ScopeSubgroup]] %[[#long8_0]] %[[#int_0]]
631 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#long16]]
632 ; CHECK-SPIRV: %[[#long16_0:]] = OpVectorShuffle %[[#long16]]
633 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#long16]] %[[#ScopeSubgroup]] %[[#long16_0]] %[[#int_0]]
634 ; CHECK-SPIRV: %[[#long_value:]] = OpCompositeExtract %[[#long]]
635 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#long]] %[[#ScopeSubgroup]] %[[#long_value]]
636 ; CHECK-SPIRV: OpFunctionEnd
638 define dso_local spir_kernel void @testNonUniformBroadcastULongs() local_unnamed_addr {
639   %1 = tail call spir_func i64 @_Z31sub_group_non_uniform_broadcastmj(i64 0, i32 0)
640   %2 = insertelement <16 x i64> <i64 undef, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0>, i64 %1, i64 0
641   %3 = shufflevector <16 x i64> %2, <16 x i64> undef, <2 x i32> <i32 0, i32 1>
642   %4 = tail call spir_func <2 x i64> @_Z31sub_group_non_uniform_broadcastDv2_mj(<2 x i64> %3, i32 0)
643   %5 = shufflevector <2 x i64> %4, <2 x i64> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
644   %6 = shufflevector <16 x i64> %5, <16 x i64> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
645   %7 = shufflevector <16 x i64> %6, <16 x i64> undef, <3 x i32> <i32 0, i32 1, i32 2>
646   %8 = tail call spir_func <3 x i64> @_Z31sub_group_non_uniform_broadcastDv3_mj(<3 x i64> %7, i32 0)
647   %9 = shufflevector <3 x i64> %8, <3 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
648   %10 = shufflevector <16 x i64> %9, <16 x i64> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
649   %11 = shufflevector <16 x i64> %10, <16 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
650   %12 = tail call spir_func <4 x i64> @_Z31sub_group_non_uniform_broadcastDv4_mj(<4 x i64> %11, i32 0)
651   %13 = shufflevector <4 x i64> %12, <4 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
652   %14 = shufflevector <16 x i64> %13, <16 x i64> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
653   %15 = shufflevector <16 x i64> %14, <16 x i64> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
654   %16 = tail call spir_func <8 x i64> @_Z31sub_group_non_uniform_broadcastDv8_mj(<8 x i64> %15, i32 0)
655   %17 = shufflevector <8 x i64> %16, <8 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
656   %18 = shufflevector <16 x i64> %17, <16 x i64> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
657   %19 = tail call spir_func <16 x i64> @_Z31sub_group_non_uniform_broadcastDv16_mj(<16 x i64> %18, i32 0)
658   %20 = extractelement <16 x i64> %19, i64 0
659   %21 = tail call spir_func i64 @_Z25sub_group_broadcast_firstm(i64 %20)
660   ret void
663 declare dso_local spir_func i64 @_Z31sub_group_non_uniform_broadcastmj(i64, i32) local_unnamed_addr
665 declare dso_local spir_func <2 x i64> @_Z31sub_group_non_uniform_broadcastDv2_mj(<2 x i64>, i32) local_unnamed_addr
667 declare dso_local spir_func <3 x i64> @_Z31sub_group_non_uniform_broadcastDv3_mj(<3 x i64>, i32) local_unnamed_addr
669 declare dso_local spir_func <4 x i64> @_Z31sub_group_non_uniform_broadcastDv4_mj(<4 x i64>, i32) local_unnamed_addr
671 declare dso_local spir_func <8 x i64> @_Z31sub_group_non_uniform_broadcastDv8_mj(<8 x i64>, i32) local_unnamed_addr
673 declare dso_local spir_func <16 x i64> @_Z31sub_group_non_uniform_broadcastDv16_mj(<16 x i64>, i32) local_unnamed_addr
675 declare dso_local spir_func i64 @_Z25sub_group_broadcast_firstm(i64) local_unnamed_addr
677 ; CHECK-SPIRV: OpFunction
678 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#float]] %[[#ScopeSubgroup]] %[[#float_0]] %[[#int_0]]
679 ; CHECK-SPIRV: %[[#float2_0:]] = OpVectorShuffle %[[#float2]]
680 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#float2]] %[[#ScopeSubgroup]] %[[#float2_0]] %[[#int_0]]
681 ; CHECK-SPIRV: %[[#float3_0:]] = OpVectorShuffle %[[#float3]]
682 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#float3]] %[[#ScopeSubgroup]] %[[#float3_0]] %[[#int_0]]
683 ; CHECK-SPIRV: %[[#float4_0:]] = OpVectorShuffle %[[#float4]]
684 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#float4]] %[[#ScopeSubgroup]] %[[#float4_0]] %[[#int_0]]
685 ; CHECK-SPIRV: %[[#float8_0:]] = OpVectorShuffle %[[#float8]]
686 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#float8]] %[[#ScopeSubgroup]] %[[#float8_0]] %[[#int_0]]
687 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#float16]]
688 ; CHECK-SPIRV: %[[#float16_0:]] = OpVectorShuffle %[[#float16]]
689 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#float16]] %[[#ScopeSubgroup]] %[[#float16_0]] %[[#int_0]]
690 ; CHECK-SPIRV: %[[#float_value:]] = OpCompositeExtract %[[#float]]
691 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#float]] %[[#ScopeSubgroup]] %[[#float_value]]
692 ; CHECK-SPIRV: OpFunctionEnd
694 define dso_local spir_kernel void @testNonUniformBroadcastFloats() local_unnamed_addr {
695   %1 = tail call spir_func float @_Z31sub_group_non_uniform_broadcastfj(float 0.000000e+00, i32 0)
696   %2 = insertelement <16 x float> <float undef, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %1, i64 0
697   %3 = shufflevector <16 x float> %2, <16 x float> undef, <2 x i32> <i32 0, i32 1>
698   %4 = tail call spir_func <2 x float> @_Z31sub_group_non_uniform_broadcastDv2_fj(<2 x float> %3, i32 0)
699   %5 = shufflevector <2 x float> %4, <2 x float> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
700   %6 = shufflevector <16 x float> %5, <16 x float> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
701   %7 = shufflevector <16 x float> %6, <16 x float> undef, <3 x i32> <i32 0, i32 1, i32 2>
702   %8 = tail call spir_func <3 x float> @_Z31sub_group_non_uniform_broadcastDv3_fj(<3 x float> %7, i32 0)
703   %9 = shufflevector <3 x float> %8, <3 x float> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
704   %10 = shufflevector <16 x float> %9, <16 x float> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
705   %11 = shufflevector <16 x float> %10, <16 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
706   %12 = tail call spir_func <4 x float> @_Z31sub_group_non_uniform_broadcastDv4_fj(<4 x float> %11, i32 0)
707   %13 = shufflevector <4 x float> %12, <4 x float> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
708   %14 = shufflevector <16 x float> %13, <16 x float> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
709   %15 = shufflevector <16 x float> %14, <16 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
710   %16 = tail call spir_func <8 x float> @_Z31sub_group_non_uniform_broadcastDv8_fj(<8 x float> %15, i32 0)
711   %17 = shufflevector <8 x float> %16, <8 x float> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
712   %18 = shufflevector <16 x float> %17, <16 x float> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
713   %19 = tail call spir_func <16 x float> @_Z31sub_group_non_uniform_broadcastDv16_fj(<16 x float> %18, i32 0)
714   %20 = extractelement <16 x float> %19, i64 0
715   %21 = tail call spir_func float @_Z25sub_group_broadcast_firstf(float %20)
716   ret void
719 declare dso_local spir_func float @_Z31sub_group_non_uniform_broadcastfj(float, i32) local_unnamed_addr
721 declare dso_local spir_func <2 x float> @_Z31sub_group_non_uniform_broadcastDv2_fj(<2 x float>, i32) local_unnamed_addr
723 declare dso_local spir_func <3 x float> @_Z31sub_group_non_uniform_broadcastDv3_fj(<3 x float>, i32) local_unnamed_addr
725 declare dso_local spir_func <4 x float> @_Z31sub_group_non_uniform_broadcastDv4_fj(<4 x float>, i32) local_unnamed_addr
727 declare dso_local spir_func <8 x float> @_Z31sub_group_non_uniform_broadcastDv8_fj(<8 x float>, i32) local_unnamed_addr
729 declare dso_local spir_func <16 x float> @_Z31sub_group_non_uniform_broadcastDv16_fj(<16 x float>, i32) local_unnamed_addr
731 declare dso_local spir_func float @_Z25sub_group_broadcast_firstf(float) local_unnamed_addr
733 ; CHECK-SPIRV: OpFunction
734 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#half]] %[[#ScopeSubgroup]] %[[#half_0]] %[[#int_0]]
735 ; CHECK-SPIRV: %[[#half2_0:]] = OpVectorShuffle %[[#half2]]
736 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#half2]] %[[#ScopeSubgroup]] %[[#half2_0]] %[[#int_0]]
737 ; CHECK-SPIRV: %[[#half3_0:]] = OpVectorShuffle %[[#half3]]
738 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#half3]] %[[#ScopeSubgroup]] %[[#half3_0]] %[[#int_0]]
739 ; CHECK-SPIRV: %[[#half4_0:]] = OpVectorShuffle %[[#half4]]
740 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#half4]] %[[#ScopeSubgroup]] %[[#half4_0]] %[[#int_0]]
741 ; CHECK-SPIRV: %[[#half8_0:]] = OpVectorShuffle %[[#half8]]
742 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#half8]] %[[#ScopeSubgroup]] %[[#half8_0]] %[[#int_0]]
743 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#half16]]
744 ; CHECK-SPIRV: %[[#half16_0:]] = OpVectorShuffle %[[#half16]]
745 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#half16]] %[[#ScopeSubgroup]] %[[#half16_0]] %[[#int_0]]
746 ; CHECK-SPIRV: %[[#half_value:]] = OpCompositeExtract %[[#half]]
747 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#half]] %[[#ScopeSubgroup]] %[[#half_value]]
748 ; CHECK-SPIRV: OpFunctionEnd
750 define dso_local spir_kernel void @testNonUniformBroadcastHalfs() local_unnamed_addr {
751   %1 = tail call spir_func half @_Z31sub_group_non_uniform_broadcastDhj(half 0xH0000, i32 0)
752   %2 = insertelement <16 x half> <half undef, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000, half 0xH0000>, half %1, i64 0
753   %3 = shufflevector <16 x half> %2, <16 x half> undef, <2 x i32> <i32 0, i32 1>
754   %4 = tail call spir_func <2 x half> @_Z31sub_group_non_uniform_broadcastDv2_Dhj(<2 x half> %3, i32 0)
755   %5 = shufflevector <2 x half> %4, <2 x half> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
756   %6 = shufflevector <16 x half> %5, <16 x half> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
757   %7 = shufflevector <16 x half> %6, <16 x half> undef, <3 x i32> <i32 0, i32 1, i32 2>
758   %8 = tail call spir_func <3 x half> @_Z31sub_group_non_uniform_broadcastDv3_Dhj(<3 x half> %7, i32 0)
759   %9 = shufflevector <3 x half> %8, <3 x half> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
760   %10 = shufflevector <16 x half> %9, <16 x half> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
761   %11 = shufflevector <16 x half> %10, <16 x half> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
762   %12 = tail call spir_func <4 x half> @_Z31sub_group_non_uniform_broadcastDv4_Dhj(<4 x half> %11, i32 0)
763   %13 = shufflevector <4 x half> %12, <4 x half> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
764   %14 = shufflevector <16 x half> %13, <16 x half> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
765   %15 = shufflevector <16 x half> %14, <16 x half> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
766   %16 = tail call spir_func <8 x half> @_Z31sub_group_non_uniform_broadcastDv8_Dhj(<8 x half> %15, i32 0)
767   %17 = shufflevector <8 x half> %16, <8 x half> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
768   %18 = shufflevector <16 x half> %17, <16 x half> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
769   %19 = tail call spir_func <16 x half> @_Z31sub_group_non_uniform_broadcastDv16_Dhj(<16 x half> %18, i32 0)
770   %20 = extractelement <16 x half> %19, i64 0
771   %21 = tail call spir_func half @_Z25sub_group_broadcast_firstDh(half %20)
772   ret void
775 declare dso_local spir_func half @_Z31sub_group_non_uniform_broadcastDhj(half, i32) local_unnamed_addr
777 declare dso_local spir_func <2 x half> @_Z31sub_group_non_uniform_broadcastDv2_Dhj(<2 x half>, i32) local_unnamed_addr
779 declare dso_local spir_func <3 x half> @_Z31sub_group_non_uniform_broadcastDv3_Dhj(<3 x half>, i32) local_unnamed_addr
781 declare dso_local spir_func <4 x half> @_Z31sub_group_non_uniform_broadcastDv4_Dhj(<4 x half>, i32) local_unnamed_addr
783 declare dso_local spir_func <8 x half> @_Z31sub_group_non_uniform_broadcastDv8_Dhj(<8 x half>, i32) local_unnamed_addr
785 declare dso_local spir_func <16 x half> @_Z31sub_group_non_uniform_broadcastDv16_Dhj(<16 x half>, i32) local_unnamed_addr
787 declare dso_local spir_func half @_Z25sub_group_broadcast_firstDh(half) local_unnamed_addr
789 ; CHECK-SPIRV: OpFunction
790 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#double]] %[[#ScopeSubgroup]] %[[#double_0]] %[[#int_0]]
791 ; CHECK-SPIRV: %[[#double2_0:]] = OpVectorShuffle %[[#double2]]
792 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#double2]] %[[#ScopeSubgroup]] %[[#double2_0]] %[[#int_0]]
793 ; CHECK-SPIRV: %[[#double3_0:]] = OpVectorShuffle %[[#double3]]
794 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#double3]] %[[#ScopeSubgroup]] %[[#double3_0]] %[[#int_0]]
795 ; CHECK-SPIRV: %[[#double4_0:]] = OpVectorShuffle %[[#double4]]
796 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#double4]] %[[#ScopeSubgroup]] %[[#double4_0]] %[[#int_0]]
797 ; CHECK-SPIRV: %[[#double8_0:]] = OpVectorShuffle %[[#double8]]
798 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#double8]] %[[#ScopeSubgroup]] %[[#double8_0]] %[[#int_0]]
799 ; CHECK-SPIRV: %[[#]] = OpVectorShuffle %[[#double16]]
800 ; CHECK-SPIRV: %[[#double16_0:]] = OpVectorShuffle %[[#double16]]
801 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcast %[[#double16]] %[[#ScopeSubgroup]] %[[#double16_0]] %[[#int_0]]
802 ; CHECK-SPIRV: %[[#double_value:]] = OpCompositeExtract %[[#double]]
803 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBroadcastFirst %[[#double]] %[[#ScopeSubgroup]] %[[#double_value]]
804 ; CHECK-SPIRV: OpFunctionEnd
806 define dso_local spir_kernel void @testNonUniformBroadcastDoubles() local_unnamed_addr {
807   %1 = tail call spir_func double @_Z31sub_group_non_uniform_broadcastdj(double 0.000000e+00, i32 0)
808   %2 = insertelement <16 x double> <double undef, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00>, double %1, i64 0
809   %3 = shufflevector <16 x double> %2, <16 x double> undef, <2 x i32> <i32 0, i32 1>
810   %4 = tail call spir_func <2 x double> @_Z31sub_group_non_uniform_broadcastDv2_dj(<2 x double> %3, i32 0)
811   %5 = shufflevector <2 x double> %4, <2 x double> undef, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
812   %6 = shufflevector <16 x double> %5, <16 x double> %2, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
813   %7 = shufflevector <16 x double> %6, <16 x double> undef, <3 x i32> <i32 0, i32 1, i32 2>
814   %8 = tail call spir_func <3 x double> @_Z31sub_group_non_uniform_broadcastDv3_dj(<3 x double> %7, i32 0)
815   %9 = shufflevector <3 x double> %8, <3 x double> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
816   %10 = shufflevector <16 x double> %9, <16 x double> %6, <16 x i32> <i32 0, i32 1, i32 2, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
817   %11 = shufflevector <16 x double> %10, <16 x double> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
818   %12 = tail call spir_func <4 x double> @_Z31sub_group_non_uniform_broadcastDv4_dj(<4 x double> %11, i32 0)
819   %13 = shufflevector <4 x double> %12, <4 x double> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
820   %14 = shufflevector <16 x double> %13, <16 x double> %10, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
821   %15 = shufflevector <16 x double> %14, <16 x double> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
822   %16 = tail call spir_func <8 x double> @_Z31sub_group_non_uniform_broadcastDv8_dj(<8 x double> %15, i32 0)
823   %17 = shufflevector <8 x double> %16, <8 x double> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
824   %18 = shufflevector <16 x double> %17, <16 x double> %14, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
825   %19 = tail call spir_func <16 x double> @_Z31sub_group_non_uniform_broadcastDv16_dj(<16 x double> %18, i32 0)
826   %20 = extractelement <16 x double> %19, i64 0
827   %21 = tail call spir_func double @_Z25sub_group_broadcast_firstd(double %20)
828   ret void
831 declare dso_local spir_func double @_Z31sub_group_non_uniform_broadcastdj(double, i32) local_unnamed_addr
833 declare dso_local spir_func <2 x double> @_Z31sub_group_non_uniform_broadcastDv2_dj(<2 x double>, i32) local_unnamed_addr
835 declare dso_local spir_func <3 x double> @_Z31sub_group_non_uniform_broadcastDv3_dj(<3 x double>, i32) local_unnamed_addr
837 declare dso_local spir_func <4 x double> @_Z31sub_group_non_uniform_broadcastDv4_dj(<4 x double>, i32) local_unnamed_addr
839 declare dso_local spir_func <8 x double> @_Z31sub_group_non_uniform_broadcastDv8_dj(<8 x double>, i32) local_unnamed_addr
841 declare dso_local spir_func <16 x double> @_Z31sub_group_non_uniform_broadcastDv16_dj(<16 x double>, i32) local_unnamed_addr
843 declare dso_local spir_func double @_Z25sub_group_broadcast_firstd(double) local_unnamed_addr
845 ; CHECK-SPIRV: OpFunction
846 ; CHECK-SPIRV: %[[#ballot:]] = OpGroupNonUniformBallot %[[#int4]] %[[#ScopeSubgroup]] %[[#false]]
847 ; CHECK-SPIRV: %[[#ballot2:]] = OpGroupNonUniformBallot %[[#int4]] %[[#ScopeSubgroup]] %[[#false]]
848 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformInverseBallot %[[#bool]] %[[#ScopeSubgroup]] %[[#ballot]]
849 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformInverseBallot %[[#bool]] %[[#ScopeSubgroup]] %[[#ballot2]]
850 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitExtract %[[#bool]] %[[#ScopeSubgroup]] %[[#ballot]] %[[#int_0]]
851 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitExtract %[[#bool]] %[[#ScopeSubgroup]] %[[#ballot2]] %[[#int_0]]
852 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitCount %[[#int]] %[[#ScopeSubgroup]] Reduce %[[#ballot]]
853 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitCount %[[#int]] %[[#ScopeSubgroup]] Reduce %[[#ballot2]]
854 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitCount %[[#int]] %[[#ScopeSubgroup]] InclusiveScan %[[#ballot]]
855 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitCount %[[#int]] %[[#ScopeSubgroup]] InclusiveScan %[[#ballot2]]
856 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitCount %[[#int]] %[[#ScopeSubgroup]] ExclusiveScan %[[#ballot]]
857 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotBitCount %[[#int]] %[[#ScopeSubgroup]] ExclusiveScan %[[#ballot2]]
858 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotFindLSB %[[#int]] %[[#ScopeSubgroup]] %[[#ballot]]
859 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotFindLSB %[[#int]] %[[#ScopeSubgroup]] %[[#ballot2]]
860 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotFindMSB %[[#int]] %[[#ScopeSubgroup]] %[[#ballot]]
861 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformBallotFindMSB %[[#int]] %[[#ScopeSubgroup]] %[[#ballot2]]
862 ; CHECK-SPIRV: OpFunctionEnd
864 define dso_local spir_kernel void @testBallotOperations(i32 addrspace(1)* nocapture) local_unnamed_addr {
865   %2 = tail call spir_func <4 x i32> @_Z16sub_group_balloti(i32 0)
866   %r2 = tail call spir_func <4 x i32> @__spirv_GroupNonUniformBallot(i32 3, i1 false)
867   %3 = tail call spir_func i32 @_Z24sub_group_inverse_ballotDv4_j(<4 x i32> %2)
868   %r3 = tail call spir_func i1 @__spirv_GroupNonUniformInverseBallot(i32 3, <4 x i32> %r2)
869   store i32 %3, i32 addrspace(1)* %0, align 4
870   %4 = tail call spir_func i32 @_Z28sub_group_ballot_bit_extractDv4_jj(<4 x i32> %2, i32 0)
871   %r4 = tail call spir_func i32 @__spirv_GroupNonUniformBallotBitExtract(i32 3, <4 x i32> %r2, i32 0)
872   %5 = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 1
873   store i32 %4, i32 addrspace(1)* %5, align 4
874   %6 = tail call spir_func i32 @_Z26sub_group_ballot_bit_countDv4_j(<4 x i32> %2)
875   %r6 = tail call spir_func i32 @__spirv_GroupNonUniformBallotBitCount(i32 3, i32 0, <4 x i32> %r2)
876   %7 = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 2
877   store i32 %6, i32 addrspace(1)* %7, align 4
878   %8 = tail call spir_func i32 @_Z31sub_group_ballot_inclusive_scanDv4_j(<4 x i32> %2)
879   %r8 = tail call spir_func i32 @__spirv_GroupNonUniformBallotBitCount(i32 3, i32 1, <4 x i32> %r2)
880   %9 = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 3
881   store i32 %8, i32 addrspace(1)* %9, align 4
882   %10 = tail call spir_func i32 @_Z31sub_group_ballot_exclusive_scanDv4_j(<4 x i32> %2)
883   %r10 = tail call spir_func i32 @__spirv_GroupNonUniformBallotBitCount(i32 3, i32 2, <4 x i32> %r2)
884   %11 = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 4
885   store i32 %10, i32 addrspace(1)* %11, align 4
886   %12 = tail call spir_func i32 @_Z25sub_group_ballot_find_lsbDv4_j(<4 x i32> %2)
887   %r12 = tail call spir_func i32 @__spirv_GroupNonUniformBallotFindLSB(i32 3, <4 x i32> %r2)
888   %13 = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 5
889   store i32 %12, i32 addrspace(1)* %13, align 4
890   %14 = tail call spir_func i32 @_Z25sub_group_ballot_find_msbDv4_j(<4 x i32> %2)
891   %r14 = tail call spir_func i32 @__spirv_GroupNonUniformBallotFindMSB(i32 3, <4 x i32> %r2)
892   %15 = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 6
893   store i32 %14, i32 addrspace(1)* %15, align 4
894   ret void
897 declare dso_local spir_func <4 x i32> @_Z16sub_group_balloti(i32) local_unnamed_addr
898 declare dso_local spir_func <4 x i32> @__spirv_GroupNonUniformBallot(i32, i1)
900 declare dso_local spir_func i32 @_Z24sub_group_inverse_ballotDv4_j(<4 x i32>) local_unnamed_addr
901 declare dso_local spir_func i1 @__spirv_GroupNonUniformInverseBallot(i32, <4 x i32>)
903 declare dso_local spir_func i32 @_Z28sub_group_ballot_bit_extractDv4_jj(<4 x i32>, i32) local_unnamed_addr
904 declare dso_local spir_func i1 @__spirv_GroupNonUniformBallotBitExtract(i32, <4 x i32>, i32) local_unnamed_addr
906 declare dso_local spir_func i32 @_Z26sub_group_ballot_bit_countDv4_j(<4 x i32>) local_unnamed_addr
907 declare dso_local spir_func i32 @__spirv_GroupNonUniformBallotBitCount(i32, i32, <4 x i32>)
909 declare dso_local spir_func i32 @_Z31sub_group_ballot_inclusive_scanDv4_j(<4 x i32>) local_unnamed_addr
911 declare dso_local spir_func i32 @_Z31sub_group_ballot_exclusive_scanDv4_j(<4 x i32>) local_unnamed_addr
913 declare dso_local spir_func i32 @_Z25sub_group_ballot_find_lsbDv4_j(<4 x i32>) local_unnamed_addr
914 declare dso_local spir_func i32 @__spirv_GroupNonUniformBallotFindLSB(i32, <4 x i32>)
916 declare dso_local spir_func i32 @_Z25sub_group_ballot_find_msbDv4_j(<4 x i32>) local_unnamed_addr
917 declare dso_local spir_func i32 @__spirv_GroupNonUniformBallotFindMSB(i32, <4 x i32>)
919 ; CHECK-SPIRV: OpFunction
920 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#int4]] %[[#eqMask]]
921 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#int4]] %[[#geMask]]
922 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#int4]] %[[#gtMask]]
923 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#int4]] %[[#leMask]]
924 ; CHECK-SPIRV: %[[#]] = OpLoad %[[#int4]] %[[#ltMask]]
925 ; CHECK-SPIRV: OpFunctionEnd
927 define dso_local spir_kernel void @testSubgroupMasks(<4 x i32> addrspace(1)* nocapture) local_unnamed_addr {
928   %2 = tail call spir_func <4 x i32> @_Z21get_sub_group_eq_maskv()
929   store <4 x i32> %2, <4 x i32> addrspace(1)* %0, align 16
930   %3 = tail call spir_func <4 x i32> @_Z21get_sub_group_ge_maskv()
931   %4 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %0, i64 1
932   store <4 x i32> %3, <4 x i32> addrspace(1)* %4, align 16
933   %5 = tail call spir_func <4 x i32> @_Z21get_sub_group_gt_maskv()
934   %6 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %0, i64 2
935   store <4 x i32> %5, <4 x i32> addrspace(1)* %6, align 16
936   %7 = tail call spir_func <4 x i32> @_Z21get_sub_group_le_maskv()
937   %8 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %0, i64 3
938   store <4 x i32> %7, <4 x i32> addrspace(1)* %8, align 16
939   %9 = tail call spir_func <4 x i32> @_Z21get_sub_group_lt_maskv()
940   %10 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %0, i64 4
941   store <4 x i32> %9, <4 x i32> addrspace(1)* %10, align 16
942   ret void
945 declare dso_local spir_func <4 x i32> @_Z21get_sub_group_eq_maskv() local_unnamed_addr
947 declare dso_local spir_func <4 x i32> @_Z21get_sub_group_ge_maskv() local_unnamed_addr
949 declare dso_local spir_func <4 x i32> @_Z21get_sub_group_gt_maskv() local_unnamed_addr
951 declare dso_local spir_func <4 x i32> @_Z21get_sub_group_le_maskv() local_unnamed_addr
953 declare dso_local spir_func <4 x i32> @_Z21get_sub_group_lt_maskv() local_unnamed_addr