257 lines · plain
1; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV2 3; CHECK-SPIRV: %[[#bool:]] = OpTypeBool4; CHECK-SPIRV: %[[#bool2:]] = OpTypeVector %[[#bool]] 25 6; CHECK-SPIRV: OpFunction7; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]8; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]9; CHECK-SPIRV: %[[#]] = OpUGreaterThan %[[#bool2]] %[[#A]] %[[#B]]10; CHECK-SPIRV: OpFunctionEnd11 12;; kernel void testUGreaterThan(uint2 a, uint2 b, global int2 *res) {13;; res[0] = a > b;14;; }15 16define 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 {17entry:18 %cmp = icmp ugt <2 x i32> %a, %b19 %sext = sext <2 x i1> %cmp to <2 x i32>20 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 821 ret void22}23 24; CHECK-SPIRV: OpFunction25; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]26; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]27; CHECK-SPIRV: %[[#]] = OpSGreaterThan %[[#bool2]] %[[#A]] %[[#B]]28; CHECK-SPIRV: OpFunctionEnd29 30;; kernel void testSGreaterThan(int2 a, int2 b, global int2 *res) {31;; res[0] = a > b;32;; }33 34define 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 {35entry:36 %cmp = icmp sgt <2 x i32> %a, %b37 %sext = sext <2 x i1> %cmp to <2 x i32>38 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 839 ret void40}41 42; CHECK-SPIRV: OpFunction43; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]44; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]45; CHECK-SPIRV: %[[#]] = OpUGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]46; CHECK-SPIRV: OpFunctionEnd47 48;; kernel void testUGreaterThanEqual(uint2 a, uint2 b, global int2 *res) {49;; res[0] = a >= b;50;; }51 52define 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 {53entry:54 %cmp = icmp uge <2 x i32> %a, %b55 %sext = sext <2 x i1> %cmp to <2 x i32>56 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 857 ret void58}59 60; CHECK-SPIRV: OpFunction61; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]62; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]63; CHECK-SPIRV: %[[#]] = OpSGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]64; CHECK-SPIRV: OpFunctionEnd65 66;; kernel void testSGreaterThanEqual(int2 a, int2 b, global int2 *res) {67;; res[0] = a >= b;68;; }69 70define 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 {71entry:72 %cmp = icmp sge <2 x i32> %a, %b73 %sext = sext <2 x i1> %cmp to <2 x i32>74 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 875 ret void76}77 78; CHECK-SPIRV: OpFunction79; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]80; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]81; CHECK-SPIRV: %[[#]] = OpULessThan %[[#bool2]] %[[#A]] %[[#B]]82; CHECK-SPIRV: OpFunctionEnd83 84;; kernel void testULessThan(uint2 a, uint2 b, global int2 *res) {85;; res[0] = a < b;86;; }87 88define 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 {89entry:90 %cmp = icmp ult <2 x i32> %a, %b91 %sext = sext <2 x i1> %cmp to <2 x i32>92 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 893 ret void94}95 96; CHECK-SPIRV: OpFunction97; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]98; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]99; CHECK-SPIRV: %[[#]] = OpSLessThan %[[#bool2]] %[[#A]] %[[#B]]100; CHECK-SPIRV: OpFunctionEnd101 102;; kernel void testSLessThan(int2 a, int2 b, global int2 *res) {103;; res[0] = a < b;104;; }105 106define 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 {107entry:108 %cmp = icmp slt <2 x i32> %a, %b109 %sext = sext <2 x i1> %cmp to <2 x i32>110 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8111 ret void112}113 114; CHECK-SPIRV: OpFunction115; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]116; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]117; CHECK-SPIRV: %[[#]] = OpULessThanEqual %[[#bool2]] %[[#A]] %[[#B]]118; CHECK-SPIRV: OpFunctionEnd119 120;; kernel void testULessThanEqual(uint2 a, uint2 b, global int2 *res) {121;; res[0] = a <= b;122;; }123 124define 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 {125entry:126 %cmp = icmp ule <2 x i32> %a, %b127 %sext = sext <2 x i1> %cmp to <2 x i32>128 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8129 ret void130}131 132; CHECK-SPIRV: OpFunction133; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]134; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]135; CHECK-SPIRV: %[[#]] = OpSLessThanEqual %[[#bool2]] %[[#A]] %[[#B]]136; CHECK-SPIRV: OpFunctionEnd137 138;; kernel void testSLessThanEqual(int2 a, int2 b, global int2 *res) {139;; res[0] = a <= b;140;; }141 142define 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 {143entry:144 %cmp = icmp sle <2 x i32> %a, %b145 %sext = sext <2 x i1> %cmp to <2 x i32>146 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8147 ret void148}149 150; CHECK-SPIRV: OpFunction151; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]152; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]153; CHECK-SPIRV: %[[#]] = OpFOrdEqual %[[#bool2]] %[[#A]] %[[#B]]154; CHECK-SPIRV: OpFunctionEnd155 156;; kernel void testFOrdEqual(float2 a, float2 b, global int2 *res) {157;; res[0] = a == b;158;; }159 160define 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 {161entry:162 %cmp = fcmp oeq <2 x float> %a, %b163 %sext = sext <2 x i1> %cmp to <2 x i32>164 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8165 ret void166}167 168; CHECK-SPIRV: OpFunction169; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]170; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]171; CHECK-SPIRV: %[[#]] = OpFUnordNotEqual %[[#bool2]] %[[#A]] %[[#B]]172; CHECK-SPIRV: OpFunctionEnd173 174;; kernel void testFUnordNotEqual(float2 a, float2 b, global int2 *res) {175;; res[0] = a != b;176;; }177 178define 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 {179entry:180 %cmp = fcmp une <2 x float> %a, %b181 %sext = sext <2 x i1> %cmp to <2 x i32>182 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8183 ret void184}185 186; CHECK-SPIRV: OpFunction187; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]188; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]189; CHECK-SPIRV: %[[#]] = OpFOrdGreaterThan %[[#bool2]] %[[#A]] %[[#B]]190; CHECK-SPIRV: OpFunctionEnd191 192;; kernel void testFOrdGreaterThan(float2 a, float2 b, global int2 *res) {193;; res[0] = a > b;194;; }195 196define 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 {197entry:198 %cmp = fcmp ogt <2 x float> %a, %b199 %sext = sext <2 x i1> %cmp to <2 x i32>200 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8201 ret void202}203 204; CHECK-SPIRV: OpFunction205; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]206; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]207; CHECK-SPIRV: %[[#]] = OpFOrdGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]208; CHECK-SPIRV: OpFunctionEnd209 210;; kernel void testFOrdGreaterThanEqual(float2 a, float2 b, global int2 *res) {211;; res[0] = a >= b;212;; }213 214define 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 {215entry:216 %cmp = fcmp oge <2 x float> %a, %b217 %sext = sext <2 x i1> %cmp to <2 x i32>218 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8219 ret void220}221 222; CHECK-SPIRV: OpFunction223; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]224; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]225; CHECK-SPIRV: %[[#]] = OpFOrdLessThan %[[#bool2]] %[[#A]] %[[#B]]226; CHECK-SPIRV: OpFunctionEnd227 228;; kernel void testFOrdLessThan(float2 a, float2 b, global int2 *res) {229;; res[0] = a < b;230;; }231 232define 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 {233entry:234 %cmp = fcmp olt <2 x float> %a, %b235 %sext = sext <2 x i1> %cmp to <2 x i32>236 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8237 ret void238}239 240; CHECK-SPIRV: OpFunction241; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]242; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]243; CHECK-SPIRV: %[[#]] = OpFOrdLessThanEqual %[[#bool2]] %[[#A]] %[[#B]]244; CHECK-SPIRV: OpFunctionEnd245 246;; kernel void testFOrdLessThanEqual(float2 a, float2 b, global int2 *res) {247;; res[0] = a <= b;248;; }249 250define 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 {251entry:252 %cmp = fcmp ole <2 x float> %a, %b253 %sext = sext <2 x i1> %cmp to <2 x i32>254 store <2 x i32> %sext, <2 x i32> addrspace(1)* %res, align 8255 ret void256}257