191 lines · plain
1! RUN: %flang_fc1 -flang-experimental-hlfir -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefixes="LLVMIR" %s2! RUN: %flang_fc1 -flang-experimental-hlfir -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefixes="LLVMIR" %s3! REQUIRES: target=powerpc{{.*}}4 5!----------------------6! vec_sel7!----------------------8 9! CHECK-LABEL: vec_sel_testi110subroutine vec_sel_testi1(arg1, arg2, arg3)11 vector(integer(1)) :: arg1, arg2, r12 vector(unsigned(1)) :: arg313 r = vec_sel(arg1, arg2, arg3)14 15! LLVMIR: %[[arg1:.*]] = load <16 x i8>, ptr %{{.*}}, align 1616! LLVMIR: %[[arg2:.*]] = load <16 x i8>, ptr %{{.*}}, align 1617! LLVMIR: %[[arg3:.*]] = load <16 x i8>, ptr %{{.*}}, align 1618! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[arg3]], splat (i8 -1)19! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[arg1]], %[[comp]]20! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[arg2]], %[[arg3]]21! LLVMIR: %{{[0-9]+}} = or <16 x i8> %[[and1]], %[[and2]]22end subroutine vec_sel_testi123 24! CHECK-LABEL: vec_sel_testi225subroutine vec_sel_testi2(arg1, arg2, arg3)26 vector(integer(2)) :: arg1, arg2, r27 vector(unsigned(2)) :: arg328 r = vec_sel(arg1, arg2, arg3)29 30! LLVMIR: %[[arg1:.*]] = load <8 x i16>, ptr %{{.*}}, align 1631! LLVMIR: %[[arg2:.*]] = load <8 x i16>, ptr %{{.*}}, align 1632! LLVMIR: %[[arg3:.*]] = load <8 x i16>, ptr %{{.*}}, align 1633! LLVMIR: %[[bc1:.*]] = bitcast <8 x i16> %5 to <16 x i8>34! LLVMIR: %[[bc2:.*]] = bitcast <8 x i16> %6 to <16 x i8>35! LLVMIR: %[[bc3:.*]] = bitcast <8 x i16> %7 to <16 x i8>36! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)37! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]38! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]39! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]40! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <8 x i16>41end subroutine vec_sel_testi242 43! CHECK-LABEL: vec_sel_testi444subroutine vec_sel_testi4(arg1, arg2, arg3)45 vector(integer(4)) :: arg1, arg2, r46 vector(unsigned(4)) :: arg347 r = vec_sel(arg1, arg2, arg3)48 49! LLVMIR: %[[arg1:.*]] = load <4 x i32>, ptr %{{.*}}, align 1650! LLVMIR: %[[arg2:.*]] = load <4 x i32>, ptr %{{.*}}, align 1651! LLVMIR: %[[arg3:.*]] = load <4 x i32>, ptr %{{.*}}, align 1652! LLVMIR: %[[bc1:.*]] = bitcast <4 x i32> %5 to <16 x i8>53! LLVMIR: %[[bc2:.*]] = bitcast <4 x i32> %6 to <16 x i8>54! LLVMIR: %[[bc3:.*]] = bitcast <4 x i32> %7 to <16 x i8>55! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)56! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]57! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]58! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]59! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <4 x i32>60end subroutine vec_sel_testi461 62! CHECK-LABEL: vec_sel_testi863subroutine vec_sel_testi8(arg1, arg2, arg3)64 vector(integer(8)) :: arg1, arg2, r65 vector(unsigned(8)) :: arg366 r = vec_sel(arg1, arg2, arg3)67 68! LLVMIR: %[[arg1:.*]] = load <2 x i64>, ptr %{{.*}}, align 1669! LLVMIR: %[[arg2:.*]] = load <2 x i64>, ptr %{{.*}}, align 1670! LLVMIR: %[[arg3:.*]] = load <2 x i64>, ptr %{{.*}}, align 1671! LLVMIR: %[[bc1:.*]] = bitcast <2 x i64> %5 to <16 x i8>72! LLVMIR: %[[bc2:.*]] = bitcast <2 x i64> %6 to <16 x i8>73! LLVMIR: %[[bc3:.*]] = bitcast <2 x i64> %7 to <16 x i8>74! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)75! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]76! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]77! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]78! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <2 x i64>79end subroutine vec_sel_testi880 81! CHECK-LABEL: vec_sel_testu182subroutine vec_sel_testu1(arg1, arg2, arg3)83 vector(unsigned(1)) :: arg1, arg2, r84 vector(unsigned(1)) :: arg385 r = vec_sel(arg1, arg2, arg3)86 87! LLVMIR: %[[arg1:.*]] = load <16 x i8>, ptr %{{.*}}, align 1688! LLVMIR: %[[arg2:.*]] = load <16 x i8>, ptr %{{.*}}, align 1689! LLVMIR: %[[arg3:.*]] = load <16 x i8>, ptr %{{.*}}, align 1690! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[arg3]], splat (i8 -1)91! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[arg1]], %[[comp]]92! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[arg2]], %[[arg3]]93! LLVMIR: %{{[0-9]+}} = or <16 x i8> %[[and1]], %[[and2]]94end subroutine vec_sel_testu195 96! CHECK-LABEL: vec_sel_testu297subroutine vec_sel_testu2(arg1, arg2, arg3)98 vector(unsigned(2)) :: arg1, arg2, r99 vector(unsigned(2)) :: arg3100 r = vec_sel(arg1, arg2, arg3)101 102! LLVMIR: %[[arg1:.*]] = load <8 x i16>, ptr %{{.*}}, align 16103! LLVMIR: %[[arg2:.*]] = load <8 x i16>, ptr %{{.*}}, align 16104! LLVMIR: %[[arg3:.*]] = load <8 x i16>, ptr %{{.*}}, align 16105! LLVMIR: %[[bc1:.*]] = bitcast <8 x i16> %5 to <16 x i8>106! LLVMIR: %[[bc2:.*]] = bitcast <8 x i16> %6 to <16 x i8>107! LLVMIR: %[[bc3:.*]] = bitcast <8 x i16> %7 to <16 x i8>108! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)109! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]110! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]111! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]112! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <8 x i16>113end subroutine vec_sel_testu2114 115! CHECK-LABEL: vec_sel_testu4116subroutine vec_sel_testu4(arg1, arg2, arg3)117 vector(unsigned(4)) :: arg1, arg2, r118 vector(unsigned(4)) :: arg3119 r = vec_sel(arg1, arg2, arg3)120 121! LLVMIR: %[[arg1:.*]] = load <4 x i32>, ptr %{{.*}}, align 16122! LLVMIR: %[[arg2:.*]] = load <4 x i32>, ptr %{{.*}}, align 16123! LLVMIR: %[[arg3:.*]] = load <4 x i32>, ptr %{{.*}}, align 16124! LLVMIR: %[[bc1:.*]] = bitcast <4 x i32> %5 to <16 x i8>125! LLVMIR: %[[bc2:.*]] = bitcast <4 x i32> %6 to <16 x i8>126! LLVMIR: %[[bc3:.*]] = bitcast <4 x i32> %7 to <16 x i8>127! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)128! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]129! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]130! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]131! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <4 x i32>132end subroutine vec_sel_testu4133 134! CHECK-LABEL: vec_sel_testu8135subroutine vec_sel_testu8(arg1, arg2, arg3)136 vector(unsigned(8)) :: arg1, arg2, r137 vector(unsigned(8)) :: arg3138 r = vec_sel(arg1, arg2, arg3)139 140 141! LLVMIR: %[[arg1:.*]] = load <2 x i64>, ptr %{{.*}}, align 16142! LLVMIR: %[[arg2:.*]] = load <2 x i64>, ptr %{{.*}}, align 16143! LLVMIR: %[[arg3:.*]] = load <2 x i64>, ptr %{{.*}}, align 16144! LLVMIR: %[[bc1:.*]] = bitcast <2 x i64> %5 to <16 x i8>145! LLVMIR: %[[bc2:.*]] = bitcast <2 x i64> %6 to <16 x i8>146! LLVMIR: %[[bc3:.*]] = bitcast <2 x i64> %7 to <16 x i8>147! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)148! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]149! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]150! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]151! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <2 x i64>152end subroutine vec_sel_testu8153 154! CHECK-LABEL: vec_sel_testr4155subroutine vec_sel_testr4(arg1, arg2, arg3)156 vector(real(4)) :: arg1, arg2, r157 vector(unsigned(4)) :: arg3158 r = vec_sel(arg1, arg2, arg3)159 160! LLVMIR: %[[arg1:.*]] = load <4 x float>, ptr %{{.*}}, align 16161! LLVMIR: %[[arg2:.*]] = load <4 x float>, ptr %{{.*}}, align 16162! LLVMIR: %[[arg3:.*]] = load <4 x i32>, ptr %{{.*}}, align 16163! LLVMIR: %[[bc1:.*]] = bitcast <4 x float> %5 to <16 x i8>164! LLVMIR: %[[bc2:.*]] = bitcast <4 x float> %6 to <16 x i8>165! LLVMIR: %[[bc3:.*]] = bitcast <4 x i32> %7 to <16 x i8>166! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)167! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]168! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]169! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]170! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <4 x float>171end subroutine vec_sel_testr4172 173! CHECK-LABEL: vec_sel_testr8174subroutine vec_sel_testr8(arg1, arg2, arg3)175 vector(real(8)) :: arg1, arg2, r176 vector(unsigned(8)) :: arg3177 r = vec_sel(arg1, arg2, arg3)178 179! LLVMIR: %[[arg1:.*]] = load <2 x double>, ptr %{{.*}}, align 16180! LLVMIR: %[[arg2:.*]] = load <2 x double>, ptr %{{.*}}, align 16181! LLVMIR: %[[arg3:.*]] = load <2 x i64>, ptr %{{.*}}, align 16182! LLVMIR: %[[bc1:.*]] = bitcast <2 x double> %5 to <16 x i8>183! LLVMIR: %[[bc2:.*]] = bitcast <2 x double> %6 to <16 x i8>184! LLVMIR: %[[bc3:.*]] = bitcast <2 x i64> %7 to <16 x i8>185! LLVMIR: %[[comp:.*]] = xor <16 x i8> %[[bc3]], splat (i8 -1)186! LLVMIR: %[[and1:.*]] = and <16 x i8> %[[bc1]], %[[comp]]187! LLVMIR: %[[and2:.*]] = and <16 x i8> %[[bc2]], %[[bc3]]188! LLVMIR: %[[or:.*]] = or <16 x i8> %[[and1]], %[[and2]]189! LLVMIR: %{{[0-9]+}} = bitcast <16 x i8> %[[or]] to <2 x double>190end subroutine vec_sel_testr8191