brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.8 KiB · 9c8b407 Raw
175 lines · plain
1; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPV2 3;; The IR was generated from the following source:4;; void __kernel K(global float* A, int B) {5;;   bool Cmp = B > 0;6;;   A[0] = Cmp;7;; }8;; Command line:9;; clang -x cl -cl-std=CL2.0 -target spir64 -emit-llvm -S -c test.cl10 11 12; SPV-DAG: OpName %[[#s1:]] "s1"13; SPV-DAG: OpName %[[#s2:]] "s2"14; SPV-DAG: OpName %[[#s3:]] "s3"15; SPV-DAG: OpName %[[#s4:]] "s4"16; SPV-DAG: OpName %[[#s5:]] "s5"17; SPV-DAG: OpName %[[#s6:]] "s6"18; SPV-DAG: OpName %[[#s7:]] "s7"19; SPV-DAG: OpName %[[#s8:]] "s8"20; SPV-DAG: OpName %[[#z1:]] "z1"21; SPV-DAG: OpName %[[#z2:]] "z2"22; SPV-DAG: OpName %[[#z3:]] "z3"23; SPV-DAG: OpName %[[#z4:]] "z4"24; SPV-DAG: OpName %[[#z5:]] "z5"25; SPV-DAG: OpName %[[#z6:]] "z6"26; SPV-DAG: OpName %[[#z7:]] "z7"27; SPV-DAG: OpName %[[#z8:]] "z8"28; SPV-DAG: OpName %[[#ufp1:]] "ufp1"29; SPV-DAG: OpName %[[#ufp2:]] "ufp2"30; SPV-DAG: OpName %[[#sfp1:]] "sfp1"31; SPV-DAG: OpName %[[#sfp2:]] "sfp2"32; SPV-DAG: %[[#int_32:]] = OpTypeInt 32 033; SPV-DAG: %[[#int_8:]] = OpTypeInt 8 034; SPV-DAG: %[[#int_16:]] = OpTypeInt 16 035; SPV-DAG: %[[#int_64:]] = OpTypeInt 64 036; SPV-DAG: %[[#zero_32:]] = OpConstantNull %[[#int_32]]37; SPV-DAG: %[[#one_32:]] = OpConstant %[[#int_32]] 138; SPV-DAG: %[[#zero_8:]] = OpConstantNull %[[#int_8]]39; SPV-DAG: %[[#mone_8:]] = OpConstant %[[#int_8]] 25540; SPV-DAG: %[[#zero_16:]] = OpConstantNull %[[#int_16]]41; SPV-DAG: %[[#mone_16:]] = OpConstant %[[#int_16]] 6553542; SPV-DAG: %[[#mone_32:]] = OpConstant %[[#int_32]] 429496729543; SPV-DAG: %[[#zero_64:]] = OpConstantNull %[[#int_64]]44; SPV-DAG: %[[#mone_64:]] = OpConstant %[[#int_64]] 1844674407370955161545; SPV-DAG: %[[#one_8:]] = OpConstant %[[#int_8]] 146; SPV-DAG: %[[#one_16:]] = OpConstant %[[#int_16]] 147; SPV-DAG: %[[#one_64:]] = OpConstant %[[#int_64]] 148; SPV-DAG: %[[#void:]] = OpTypeVoid49; SPV-DAG: %[[#float:]] = OpTypeFloat 3250; SPV-DAG: %[[#bool:]] = OpTypeBool51; SPV-DAG: %[[#vec_8:]] = OpTypeVector %[[#int_8]] 252; SPV-DAG: %[[#vec_1:]] = OpTypeVector %[[#bool]] 253; SPV-DAG: %[[#vec_16:]] = OpTypeVector %[[#int_16]] 254; SPV-DAG: %[[#vec_32:]] = OpTypeVector %[[#int_32]] 255; SPV-DAG: %[[#vec_64:]] = OpTypeVector %[[#int_64]] 256; SPV-DAG: %[[#vec_float:]] = OpTypeVector %[[#float]] 257; SPV-DAG: %[[#zeros_8:]] = OpConstantNull %[[#vec_8]]58; SPV-DAG: %[[#mones_8:]] = OpConstantComposite %[[#vec_8]] %[[#mone_8]] %[[#mone_8]]59; SPV-DAG: %[[#zeros_16:]] = OpConstantNull %[[#vec_16]]60; SPV-DAG: %[[#mones_16:]] = OpConstantComposite %[[#vec_16]] %[[#mone_16]] %[[#mone_16]]61; SPV-DAG: %[[#zeros_32:]] = OpConstantNull %[[#vec_32]]62; SPV-DAG: %[[#mones_32:]] = OpConstantComposite %[[#vec_32]] %[[#mone_32]] %[[#mone_32]]63; SPV-DAG: %[[#zeros_64:]] = OpConstantNull %[[#vec_64]]64; SPV-DAG: %[[#mones_64:]] = OpConstantComposite %[[#vec_64]] %[[#mone_64]] %[[#mone_64]]65; SPV-DAG: %[[#ones_8:]] = OpConstantComposite %[[#vec_8]] %[[#one_8]] %[[#one_8]]66; SPV-DAG: %[[#ones_16:]] = OpConstantComposite %[[#vec_16]] %[[#one_16]] %[[#one_16]]67; SPV-DAG: %[[#ones_32:]] = OpConstantComposite %[[#vec_32]] %[[#one_32]] %[[#one_32]]68; SPV-DAG: %[[#ones_64:]] = OpConstantComposite %[[#vec_64]] %[[#one_64]] %[[#one_64]]69; SPV-DAG: %[[#pointer:]] = OpTypePointer CrossWorkgroup %[[#float]]70 71@G_s1 = global i8 072@G_s2 = global i16 073@G_s3 = global i32 074@G_s4 = global i64 075@G_s5 = global <2 x i8> zeroinitializer76@G_s6 = global <2 x i16> zeroinitializer77@G_s7 = global <2 x i32> zeroinitializer78@G_s8 = global <2 x i64> zeroinitializer79@G_z1 = global i8 080@G_z2 = global i16 081@G_z3 = global i32 082@G_z4 = global i64 083@G_z5 = global <2 x i8> zeroinitializer84@G_z6 = global <2 x i16> zeroinitializer85@G_z7 = global <2 x i32> zeroinitializer86@G_z8 = global <2 x i64> zeroinitializer87@G_ufp1 = global float 0.088@G_ufp2 = global <2 x float> zeroinitializer89@G_sfp1 = global float 0.090@G_sfp2 = global <2 x float> zeroinitializer91 92; SPV-DAG: OpFunction93; SPV-DAG: %[[#A:]] = OpFunctionParameter %[[#pointer]]94; SPV-DAG: %[[#B:]] = OpFunctionParameter %[[#]]95; SPV-DAG: %[[#i1s:]] = OpFunctionParameter %[[#]]96; SPV-DAG: %[[#i1v:]] = OpFunctionParameter %[[#]]97 98define dso_local spir_kernel void @K(float addrspace(1)* nocapture %A, i32 %B, i1 %i1s, <2 x i1> %i1v) local_unnamed_addr {99entry:100 101; SPV-DAG: %[[#cmp_res:]] = OpSGreaterThan %[[#bool]] %[[#B]] %[[#zero_32]]102  %cmp = icmp sgt i32 %B, 0103; SPV-DAG: %[[#select_res:]] = OpSelect %[[#int_32]] %[[#cmp_res]] %[[#one_32]] %[[#zero_32]]104; SPV-DAG: %[[#utof_res:]] = OpConvertUToF %[[#float]] %[[#select_res]]105  %conv = uitofp i1 %cmp to float106; SPV-DAG: OpStore %[[#A]] %[[#utof_res]]107  store float %conv, float addrspace(1)* %A, align 4;108 109; SPV-DAG: %[[#s1]] = OpSelect %[[#int_8]] %[[#i1s]] %[[#mone_8]] %[[#zero_8]]110  %s1 = sext i1 %i1s to i8111  store i8 %s1, ptr @G_s1112; SPV-DAG: %[[#s2]] = OpSelect %[[#int_16]] %[[#i1s]] %[[#mone_16]] %[[#zero_16]]113  %s2 = sext i1 %i1s to i16114  store i16 %s2, ptr @G_s2115; SPV-DAG: %[[#s3]] = OpSelect %[[#int_32]] %[[#i1s]] %[[#mone_32]] %[[#zero_32]]116  %s3 = sext i1 %i1s to i32117  store i32 %s3, ptr @G_s3118; SPV-DAG: %[[#s4]] = OpSelect %[[#int_64]] %[[#i1s]] %[[#mone_64]] %[[#zero_64]]119  %s4 = sext i1 %i1s to i64120  store i64 %s4, ptr @G_s4121; SPV-DAG: %[[#s5]] = OpSelect %[[#vec_8]] %[[#i1v]] %[[#mones_8]] %[[#zeros_8]]122  %s5 = sext <2 x i1> %i1v to <2 x i8>123  store <2 x i8> %s5, ptr @G_s5124; SPV-DAG: %[[#s6]] = OpSelect %[[#vec_16]] %[[#i1v]] %[[#mones_16]] %[[#zeros_16]]125  %s6 = sext <2 x i1> %i1v to <2 x i16>126  store <2 x i16> %s6, ptr @G_s6127; SPV-DAG: %[[#s7]] = OpSelect %[[#vec_32]] %[[#i1v]] %[[#mones_32]] %[[#zeros_32]]128  %s7 = sext <2 x i1> %i1v to <2 x i32>129  store <2 x i32> %s7, ptr @G_s7130; SPV-DAG: %[[#s8]] = OpSelect %[[#vec_64]] %[[#i1v]] %[[#mones_64]] %[[#zeros_64]]131  %s8 = sext <2 x i1> %i1v to <2 x i64>132  store <2 x i64> %s8, ptr @G_s8133; SPV-DAG: %[[#z1]] = OpSelect %[[#int_8]] %[[#i1s]] %[[#one_8]] %[[#zero_8]]134  %z1 = zext i1 %i1s to i8135  store i8 %z1, ptr @G_z1136; SPV-DAG: %[[#z2]] = OpSelect %[[#int_16]] %[[#i1s]] %[[#one_16]] %[[#zero_16]]137  %z2 = zext i1 %i1s to i16138  store i16 %z2, ptr @G_z2139; SPV-DAG: %[[#z3]] = OpSelect %[[#int_32]] %[[#i1s]] %[[#one_32]] %[[#zero_32]]140  %z3 = zext i1 %i1s to i32141  store i32 %z3, ptr @G_z3142; SPV-DAG: %[[#z4]] = OpSelect %[[#int_64]] %[[#i1s]] %[[#one_64]] %[[#zero_64]]143  %z4 = zext i1 %i1s to i64144  store i64 %z4, ptr @G_z4145; SPV-DAG: %[[#z5]] = OpSelect %[[#vec_8]] %[[#i1v]] %[[#ones_8]] %[[#zeros_8]]146  %z5 = zext <2 x i1> %i1v to <2 x i8>147  store <2 x i8> %z5, ptr @G_z5148; SPV-DAG: %[[#z6]] = OpSelect %[[#vec_16]] %[[#i1v]] %[[#ones_16]] %[[#zeros_16]]149  %z6 = zext <2 x i1> %i1v to <2 x i16>150  store <2 x i16> %z6, ptr @G_z6151; SPV-DAG: %[[#z7]] = OpSelect %[[#vec_32]] %[[#i1v]] %[[#ones_32]] %[[#zeros_32]]152  %z7 = zext <2 x i1> %i1v to <2 x i32>153  store <2 x i32> %z7, ptr @G_z7154; SPV-DAG: %[[#z8]] = OpSelect %[[#vec_64]] %[[#i1v]] %[[#ones_64]] %[[#zeros_64]]155  %z8 = zext <2 x i1> %i1v to <2 x i64>156  store <2 x i64> %z8, ptr @G_z8157; SPV-DAG: %[[#ufp1_res:]] = OpSelect %[[#int_32]] %[[#i1s]] %[[#one_32]] %[[#zero_32]]158; SPV-DAG: %[[#ufp1]] = OpConvertUToF %[[#float]] %[[#ufp1_res]]159  %ufp1 = uitofp i1 %i1s to float160  store float %ufp1, ptr @G_ufp1161; SPV-DAG: %[[#ufp2_res:]] = OpSelect %[[#vec_32]] %[[#i1v]] %[[#ones_32]] %[[#zeros_32]]162; SPV-DAG: %[[#ufp2]] = OpConvertUToF %[[#vec_float]] %[[#ufp2_res]]163  %ufp2 = uitofp <2 x i1> %i1v to <2 x float>164  store <2 x float> %ufp2, ptr @G_ufp2165; SPV-DAG: %[[#sfp1_res:]] = OpSelect %[[#int_32]] %[[#i1s]] %[[#one_32]] %[[#zero_32]]166; SPV-DAG: %[[#sfp1]] = OpConvertSToF %[[#float]] %[[#sfp1_res]]167  %sfp1 = sitofp i1 %i1s to float168  store float %sfp1, ptr @G_sfp1169; SPV-DAG: %[[#sfp2_res:]] = OpSelect %[[#vec_32]] %[[#i1v]] %[[#ones_32]] %[[#zeros_32]]170; SPV-DAG: %[[#sfp2]] = OpConvertSToF %[[#vec_float]] %[[#sfp2_res]]171  %sfp2 = sitofp <2 x i1> %i1v to <2 x float>172  store <2 x float> %sfp2, ptr @G_sfp2173  ret void174}175