1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ; CHECK-SPIRV: %[[#bool:]] = OpTypeBool
4 ; CHECK-SPIRV: %[[#bool2:]] = OpTypeVector %[[#bool]] 2
6 ; CHECK-SPIRV: OpFunction
7 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
8 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
9 ; CHECK-SPIRV: %[[#]] = OpUGreaterThan %[[#bool2]] %[[#A]] %[[#B]]
10 ; CHECK-SPIRV: OpFunctionEnd
12 ;; kernel void testUGreaterThan(uint2 a, uint2 b, global int2 *res) {
16 define dso_local spir_kernel void @testUGreaterThan(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
18 %cmp = icmp ugt <2 x i32> %a, %b
19 %sext = sext <2 x i1> %cmp to <2 x i32>
20 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
24 ; CHECK-SPIRV: OpFunction
25 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
26 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
27 ; CHECK-SPIRV: %[[#]] = OpSGreaterThan %[[#bool2]] %[[#A]] %[[#B]]
28 ; CHECK-SPIRV: OpFunctionEnd
30 ;; kernel void testSGreaterThan(int2 a, int2 b, global int2 *res) {
34 define dso_local spir_kernel void @testSGreaterThan(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
36 %cmp = icmp sgt <2 x i32> %a, %b
37 %sext = sext <2 x i1> %cmp to <2 x i32>
38 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
42 ; CHECK-SPIRV: OpFunction
43 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
44 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
45 ; CHECK-SPIRV: %[[#]] = OpUGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]
46 ; CHECK-SPIRV: OpFunctionEnd
48 ;; kernel void testUGreaterThanEqual(uint2 a, uint2 b, global int2 *res) {
52 define dso_local spir_kernel void @testUGreaterThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
54 %cmp = icmp uge <2 x i32> %a, %b
55 %sext = sext <2 x i1> %cmp to <2 x i32>
56 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
60 ; CHECK-SPIRV: OpFunction
61 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
62 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
63 ; CHECK-SPIRV: %[[#]] = OpSGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]
64 ; CHECK-SPIRV: OpFunctionEnd
66 ;; kernel void testSGreaterThanEqual(int2 a, int2 b, global int2 *res) {
70 define dso_local spir_kernel void @testSGreaterThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
72 %cmp = icmp sge <2 x i32> %a, %b
73 %sext = sext <2 x i1> %cmp to <2 x i32>
74 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
78 ; CHECK-SPIRV: OpFunction
79 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
80 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
81 ; CHECK-SPIRV: %[[#]] = OpULessThan %[[#bool2]] %[[#A]] %[[#B]]
82 ; CHECK-SPIRV: OpFunctionEnd
84 ;; kernel void testULessThan(uint2 a, uint2 b, global int2 *res) {
88 define dso_local spir_kernel void @testULessThan(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
90 %cmp = icmp ult <2 x i32> %a, %b
91 %sext = sext <2 x i1> %cmp to <2 x i32>
92 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
96 ; CHECK-SPIRV: OpFunction
97 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
98 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
99 ; CHECK-SPIRV: %[[#]] = OpSLessThan %[[#bool2]] %[[#A]] %[[#B]]
100 ; CHECK-SPIRV: OpFunctionEnd
102 ;; kernel void testSLessThan(int2 a, int2 b, global int2 *res) {
106 define dso_local spir_kernel void @testSLessThan(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
108 %cmp = icmp slt <2 x i32> %a, %b
109 %sext = sext <2 x i1> %cmp to <2 x i32>
110 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
114 ; CHECK-SPIRV: OpFunction
115 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
116 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
117 ; CHECK-SPIRV: %[[#]] = OpULessThanEqual %[[#bool2]] %[[#A]] %[[#B]]
118 ; CHECK-SPIRV: OpFunctionEnd
120 ;; kernel void testULessThanEqual(uint2 a, uint2 b, global int2 *res) {
124 define dso_local spir_kernel void @testULessThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
126 %cmp = icmp ule <2 x i32> %a, %b
127 %sext = sext <2 x i1> %cmp to <2 x i32>
128 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
132 ; CHECK-SPIRV: OpFunction
133 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
134 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
135 ; CHECK-SPIRV: %[[#]] = OpSLessThanEqual %[[#bool2]] %[[#A]] %[[#B]]
136 ; CHECK-SPIRV: OpFunctionEnd
138 ;; kernel void testSLessThanEqual(int2 a, int2 b, global int2 *res) {
142 define dso_local spir_kernel void @testSLessThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
144 %cmp = icmp sle <2 x i32> %a, %b
145 %sext = sext <2 x i1> %cmp to <2 x i32>
146 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
150 ; CHECK-SPIRV: OpFunction
151 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
152 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
153 ; CHECK-SPIRV: %[[#]] = OpFOrdEqual %[[#bool2]] %[[#A]] %[[#B]]
154 ; CHECK-SPIRV: OpFunctionEnd
156 ;; kernel void testFOrdEqual(float2 a, float2 b, global int2 *res) {
160 define dso_local spir_kernel void @testFOrdEqual(<2 x float> noundef %a, <2 x float> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
162 %cmp = fcmp oeq <2 x float> %a, %b
163 %sext = sext <2 x i1> %cmp to <2 x i32>
164 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
168 ; CHECK-SPIRV: OpFunction
169 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
170 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
171 ; CHECK-SPIRV: %[[#]] = OpFUnordNotEqual %[[#bool2]] %[[#A]] %[[#B]]
172 ; CHECK-SPIRV: OpFunctionEnd
174 ;; kernel void testFUnordNotEqual(float2 a, float2 b, global int2 *res) {
178 define dso_local spir_kernel void @testFUnordNotEqual(<2 x float> noundef %a, <2 x float> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
180 %cmp = fcmp une <2 x float> %a, %b
181 %sext = sext <2 x i1> %cmp to <2 x i32>
182 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
186 ; CHECK-SPIRV: OpFunction
187 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
188 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
189 ; CHECK-SPIRV: %[[#]] = OpFOrdGreaterThan %[[#bool2]] %[[#A]] %[[#B]]
190 ; CHECK-SPIRV: OpFunctionEnd
192 ;; kernel void testFOrdGreaterThan(float2 a, float2 b, global int2 *res) {
196 define dso_local spir_kernel void @testFOrdGreaterThan(<2 x float> noundef %a, <2 x float> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
198 %cmp = fcmp ogt <2 x float> %a, %b
199 %sext = sext <2 x i1> %cmp to <2 x i32>
200 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
204 ; CHECK-SPIRV: OpFunction
205 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
206 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
207 ; CHECK-SPIRV: %[[#]] = OpFOrdGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]
208 ; CHECK-SPIRV: OpFunctionEnd
210 ;; kernel void testFOrdGreaterThanEqual(float2 a, float2 b, global int2 *res) {
214 define dso_local spir_kernel void @testFOrdGreaterThanEqual(<2 x float> noundef %a, <2 x float> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
216 %cmp = fcmp oge <2 x float> %a, %b
217 %sext = sext <2 x i1> %cmp to <2 x i32>
218 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
222 ; CHECK-SPIRV: OpFunction
223 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
224 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
225 ; CHECK-SPIRV: %[[#]] = OpFOrdLessThan %[[#bool2]] %[[#A]] %[[#B]]
226 ; CHECK-SPIRV: OpFunctionEnd
228 ;; kernel void testFOrdLessThan(float2 a, float2 b, global int2 *res) {
232 define dso_local spir_kernel void @testFOrdLessThan(<2 x float> noundef %a, <2 x float> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
234 %cmp = fcmp olt <2 x float> %a, %b
235 %sext = sext <2 x i1> %cmp to <2 x i32>
236 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8
240 ; CHECK-SPIRV: OpFunction
241 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
242 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
243 ; CHECK-SPIRV: %[[#]] = OpFOrdLessThanEqual %[[#bool2]] %[[#A]] %[[#B]]
244 ; CHECK-SPIRV: OpFunctionEnd
246 ;; kernel void testFOrdLessThanEqual(float2 a, float2 b, global int2 *res) {
250 define dso_local spir_kernel void @testFOrdLessThanEqual(<2 x float> noundef %a, <2 x float> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
252 %cmp = fcmp ole <2 x float> %a, %b
253 %sext = sext <2 x i1> %cmp to <2 x i32>
254 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8