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: %[[#ScopeSubgroup:]] = OpConstant %[[#int]] 3
79 ; CHECK-SPIRV-DAG: %[[#char_0:]] = OpConstant %[[#char]] 0
80 ; CHECK-SPIRV-DAG: %[[#short_0:]] = OpConstant %[[#short]] 0
81 ; CHECK-SPIRV-DAG: %[[#int_0:]] = OpConstant %[[#int]] 0
82 ; CHECK-SPIRV-DAG: %[[#long_0:]] = OpConstantNull %[[#long]]
83 ; CHECK-SPIRV-DAG: %[[#half_0:]] = OpConstant %[[#half]] 0
84 ; CHECK-SPIRV-DAG: %[[#float_0:]] = OpConstant %[[#float]] 0
85 ; CHECK-SPIRV-DAG: %[[#double_0:]] = OpConstant %[[#double]] 0
87 ; CHECK-SPIRV: OpFunction
88 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformElect %[[#bool]] %[[#ScopeSubgroup]]
89 ; CHECK-SPIRV: OpFunctionEnd
91 define dso_local spir_kernel void @testSubGroupElect(i32 addrspace(1)* nocapture) local_unnamed_addr {
92 %2 = tail call spir_func i32 @_Z15sub_group_electv()
93 store i32 %2, i32 addrspace(1)* %0, align 4
97 declare dso_local spir_func i32 @_Z15sub_group_electv() local_unnamed_addr
99 ; CHECK-SPIRV: OpFunction
100 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAll %[[#bool]] %[[#ScopeSubgroup]] %[[#false]]
101 ; CHECK-SPIRV: OpFunctionEnd
103 define dso_local spir_kernel void @testSubGroupNonUniformAll(i32 addrspace(1)* nocapture) local_unnamed_addr {
104 %2 = tail call spir_func i32 @_Z25sub_group_non_uniform_alli(i32 0)
105 store i32 %2, i32 addrspace(1)* %0, align 4
109 declare dso_local spir_func i32 @_Z25sub_group_non_uniform_alli(i32) local_unnamed_addr
111 ; CHECK-SPIRV: OpFunction
112 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAny %[[#bool]] %[[#ScopeSubgroup]] %[[#false]]
113 ; CHECK-SPIRV: OpFunctionEnd
115 define dso_local spir_kernel void @testSubGroupNonUniformAny(i32 addrspace(1)* nocapture) local_unnamed_addr {
116 %2 = tail call spir_func i32 @_Z25sub_group_non_uniform_anyi(i32 0)
117 store i32 %2, i32 addrspace(1)* %0, align 4
121 declare dso_local spir_func i32 @_Z25sub_group_non_uniform_anyi(i32) local_unnamed_addr
123 ; CHECK-SPIRV: OpFunction
124 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#char_0]]
125 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#char_0]]
126 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#short_0]]
127 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#short_0]]
128 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#int_0]]
129 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#int_0]]
130 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#long_0]]
131 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#long_0]]
132 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#float_0]]
133 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#half_0]]
134 ; CHECK-SPIRV: %[[#]] = OpGroupNonUniformAllEqual %[[#bool]] %[[#ScopeSubgroup]] %[[#double_0]]
135 ; CHECK-SPIRV: OpFunctionEnd
137 define dso_local spir_kernel void @testSubGroupNonUniformAllEqual(i32 addrspace(1)* nocapture) local_unnamed_addr {
138 %2 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalc(i8 signext 0)
139 store i32 %2, i32 addrspace(1)* %0, align 4
140 %3 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalh(i8 zeroext 0)
141 store i32 %3, i32 addrspace(1)* %0, align 4
142 %4 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equals(i16 signext 0)
143 store i32 %4, i32 addrspace(1)* %0, align 4
144 %5 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalt(i16 zeroext 0)
145 store i32 %5, i32 addrspace(1)* %0, align 4
146 %6 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equali(i32 0)
147 store i32 %6, i32 addrspace(1)* %0, align 4
148 %7 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalj(i32 0)
149 store i32 %7, i32 addrspace(1)* %0, align 4
150 %8 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equall(i64 0)
151 store i32 %8, i32 addrspace(1)* %0, align 4
152 %9 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalm(i64 0)
153 store i32 %9, i32 addrspace(1)* %0, align 4
154 %10 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalf(float 0.000000e+00)
155 store i32 %10, i32 addrspace(1)* %0, align 4
156 %11 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equalDh(half 0xH0000)
157 store i32 %11, i32 addrspace(1)* %0, align 4
158 %12 = tail call spir_func i32 @_Z31sub_group_non_uniform_all_equald(double 0.000000e+00)
159 store i32 %12, i32 addrspace(1)* %0, align 4
163 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalc(i8 signext) local_unnamed_addr
165 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalh(i8 zeroext) local_unnamed_addr
167 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equals(i16 signext) local_unnamed_addr
169 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalt(i16 zeroext) local_unnamed_addr
171 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equali(i32) local_unnamed_addr
173 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalj(i32) local_unnamed_addr
175 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equall(i64) local_unnamed_addr
177 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalm(i64) local_unnamed_addr
179 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalf(float) local_unnamed_addr
181 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equalDh(half) local_unnamed_addr
183 declare dso_local spir_func i32 @_Z31sub_group_non_uniform_all_equald(double) local_unnamed_addr