brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.5 KiB · 033847c Raw
232 lines · cpp
1// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -Wno-unused -std=c++11 -emit-llvm -o - | FileCheck %s2 3using FourShorts = short __attribute__((__vector_size__(8)));4using TwoInts = int __attribute__((__vector_size__(8)));5using TwoUInts = unsigned __attribute__((__vector_size__(8)));6using FourInts = int __attribute__((__vector_size__(16)));7using FourUInts = unsigned __attribute__((__vector_size__(16)));8using TwoLongLong = long long __attribute__((__vector_size__(16)));9using FourLongLong = long long __attribute__((__vector_size__(32)));10using TwoFloats = float __attribute__((__vector_size__(8)));11using FourFloats = float __attribute__((__vector_size__(16)));12using TwoDoubles = double __attribute__((__vector_size__(16)));13using FourDoubles = double __attribute__((__vector_size__(32)));14 15FourShorts four_shorts;16TwoInts two_ints;17TwoUInts two_uints;18FourInts four_ints;19FourUInts four_uints;20TwoLongLong two_ll;21FourLongLong four_ll;22TwoFloats two_floats;23FourFloats four_floats;24TwoDoubles two_doubles;25FourDoubles four_doubles;26 27short some_short;28unsigned short some_ushort;29int some_int;30float some_float;31unsigned int some_uint;32long long some_ll;33unsigned long long some_ull;34double some_double;35 36// CHECK: TwoVectorOps37void TwoVectorOps() {38  two_ints ? two_ints : two_ints;39  // CHECK: %[[COND:.+]] = load <2 x i32>40  // CHECK: %[[LHS:.+]] = load <2 x i32>41  // CHECK: %[[RHS:.+]] = load <2 x i32>42  // CHECK: %[[NEZERO:.+]] = icmp ne <2 x i32> %[[COND]], zeroinitializer43  // CHECK: %[[SELECT:.+]] = select <2 x i1> %[[NEZERO]], <2 x i32> %[[LHS]], <2 x i32> %[[RHS]]44 45  two_ints ? two_floats : two_floats;46  // CHECK: %[[COND:.+]] = load <2 x i32>47  // CHECK: %[[LHS:.+]] = load <2 x float>48  // CHECK: %[[RHS:.+]] = load <2 x float>49  // CHECK: %[[NEZERO:.+]] = icmp ne <2 x i32> %[[COND]], zeroinitializer50  // CHECK: %[[SELECT:.+]] = select <2 x i1> %[[NEZERO]], <2 x float> %[[LHS]], <2 x float> %[[RHS]]51 52  two_ll ? two_doubles : two_doubles;53  // CHECK: %[[COND:.+]] = load <2 x i64>54  // CHECK: %[[LHS:.+]] = load <2 x double>55  // CHECK: %[[RHS:.+]] = load <2 x double>56  // CHECK: %[[NEZERO:.+]] = icmp ne <2 x i64> %[[COND]], zeroinitializer57  // CHECK: %[[SELECT:.+]] = select <2 x i1> %[[NEZERO]], <2 x double> %[[LHS]], <2 x double> %[[RHS]]58}59 60// CHECK: TwoScalarOps61void TwoScalarOps() {62  four_shorts ? some_short : some_short;63  // CHECK: %[[COND:.+]] = load <4 x i16>64  // CHECK: %[[LHS:.+]] = load i1665  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x i16> poison, i16 %[[LHS]], i64 066  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x i16> %[[LHS_SPLAT_INSERT]], <4 x i16> poison, <4 x i32> zeroinitializer67  // CHECK: %[[RHS:.+]] = load i1668  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i16> poison, i16 %[[RHS]], i64 069  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i16> %[[RHS_SPLAT_INSERT]], <4 x i16> poison, <4 x i32> zeroinitializer70  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i16> %[[COND]], zeroinitializer71  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i16> %[[LHS_SPLAT]], <4 x i16> %[[RHS_SPLAT]]72 73  four_shorts ? some_ushort : some_ushort;74  // CHECK: %[[COND:.+]] = load <4 x i16>75  // CHECK: %[[LHS:.+]] = load i1676  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x i16> poison, i16 %[[LHS]], i64 077  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x i16> %[[LHS_SPLAT_INSERT]], <4 x i16> poison, <4 x i32> zeroinitializer78  // CHECK: %[[RHS:.+]] = load i1679  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i16> poison, i16 %[[RHS]], i64 080  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i16> %[[RHS_SPLAT_INSERT]], <4 x i16> poison, <4 x i32> zeroinitializer81  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i16> %[[COND]], zeroinitializer82  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i16> %[[LHS_SPLAT]], <4 x i16> %[[RHS_SPLAT]]83 84  four_ints ? some_ushort : some_short;85  // CHECK: %[[COND:.+]] = load <4 x i32>86  // CHECK: %[[LHS:.+]] = load i1687  // CHECK: %[[LHS_ZEXT:.+]] = zext i16 %[[LHS]] to i3288  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[LHS_ZEXT]], i64 089  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x i32> %[[LHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer90  // CHECK: %[[RHS:.+]] = load i1691  // CHECK: %[[RHS_SEXT:.+]] = sext i16 %[[RHS]] to i3292  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[RHS_SEXT]], i64 093  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i32> %[[RHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer94  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer95  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[LHS_SPLAT]], <4 x i32> %[[RHS_SPLAT]]96 97  four_ints ? some_int : some_float;98  // CHECK: %[[COND:.+]] = load <4 x i32>99  // CHECK: %[[LHS:.+]] = load i32100  // CHECK: %[[LHS_CONV:.+]] = sitofp i32 %[[LHS]] to float101  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x float> poison, float %[[LHS_CONV]], i64 0102  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x float> %[[LHS_SPLAT_INSERT]], <4 x float> poison, <4 x i32> zeroinitializer103  // CHECK: %[[RHS:.+]] = load float104  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x float> poison, float %[[RHS]], i64 0105  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x float> %[[RHS_SPLAT_INSERT]], <4 x float> poison, <4 x i32> zeroinitializer106  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer107  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x float> %[[LHS_SPLAT]], <4 x float> %[[RHS_SPLAT]]108 109  four_ll ? some_double : some_ll;110  // CHECK: %[[COND:.+]] = load <4 x i64>111  // CHECK: %[[LHS:.+]] = load double112  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x double> poison, double %[[LHS]], i64 0113  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x double> %[[LHS_SPLAT_INSERT]], <4 x double> poison, <4 x i32> zeroinitializer114  // CHECK: %[[RHS:.+]] = load i64115  // CHECK: %[[RHS_CONV:.+]] = sitofp i64 %[[RHS]] to double116  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x double> poison, double %[[RHS_CONV]], i64 0117  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x double> %[[RHS_SPLAT_INSERT]], <4 x double> poison, <4 x i32> zeroinitializer118  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer119  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x double> %[[LHS_SPLAT]], <4 x double> %[[RHS_SPLAT]]120 121  four_ints ? some_int : some_short;122  // CHECK: %[[COND:.+]] = load <4 x i32>123  // CHECK: %[[LHS:.+]] = load i32124  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[LHS]], i64 0125  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x i32> %[[LHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer126  // CHECK: %[[RHS:.+]] = load i16127  // CHECK: %[[RHS_SEXT:.+]] = sext i16 %[[RHS]] to i32128  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[RHS_SEXT]], i64 0129  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i32> %[[RHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer130  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer131  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[LHS_SPLAT]], <4 x i32> %[[RHS_SPLAT]]132}133 134// CHECK: OneScalarOp135void OneScalarOp() {136  four_ints ? four_ints : some_int;137  // CHECK: %[[COND:.+]] = load <4 x i32>138  // CHECK: %[[LHS:.+]] = load <4 x i32>139  // CHECK: %[[RHS:.+]] = load i32140  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[RHS]], i64 0141  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i32> %[[RHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer142  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer143  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[LHS]], <4 x i32> %[[RHS_SPLAT]]144 145  four_ints ? four_ints : 5;146  // CHECK: %[[COND:.+]] = load <4 x i32>147  // CHECK: %[[LHS:.+]] = load <4 x i32>148  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer149  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[LHS]], <4 x i32> splat (i32 5)150 151  four_ints ?: some_float;152  // CHECK: %[[COND:.+]] = load <4 x i32>153  // CHECK: %[[RHS:.+]] = load float154  // CHECK: %[[RHS_CONV:.+]] = fptosi float %[[RHS]] to i32155  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[RHS_CONV]], i64 0156  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i32> %[[RHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer157  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer158  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[COND]], <4 x i32> %[[RHS_SPLAT]]159 160  four_ints ? four_ints : 5.0f;161  // CHECK: %[[COND:.+]] = load <4 x i32>162  // CHECK: %[[LHS:.+]] = load <4 x i32>163  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer164  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[LHS]], <4 x i32> splat (i32 5)165 166  four_ints ? some_float : four_ints;167  // CHECK: %[[COND:.+]] = load <4 x i32>168  // CHECK: %[[LHS:.+]] = load float169  // CHECK: %[[LHS_CONV:.+]] = fptosi float %[[LHS]] to i32170  // CHECK: %[[LHS_SPLAT_INSERT:.+]] = insertelement <4 x i32> poison, i32 %[[LHS_CONV]], i64 0171  // CHECK: %[[LHS_SPLAT:.+]] = shufflevector <4 x i32> %[[LHS_SPLAT_INSERT]], <4 x i32> poison, <4 x i32> zeroinitializer172  // CHECK: %[[RHS:.+]] = load <4 x i32>173  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer174  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i32> %[[LHS_SPLAT]], <4 x i32> %[[RHS]]175 176  four_ints ? four_floats : some_float;177  // CHECK: %[[COND:.+]] = load <4 x i32>178  // CHECK: %[[LHS:.+]] = load <4 x float>179  // CHECK: %[[RHS:.+]] = load float180  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x float> poison, float %[[RHS]], i64 0181  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x float> %[[RHS_SPLAT_INSERT]], <4 x float> poison, <4 x i32> zeroinitializer182  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i32> %[[COND]], zeroinitializer183  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x float> %[[LHS]], <4 x float> %[[RHS_SPLAT]]184 185  four_ll ? four_doubles : 6.0;186  // CHECK: %[[COND:.+]] = load <4 x i64>187  // CHECK: %[[LHS:.+]] = load <4 x double>188  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer189  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x double> %[[LHS]], <4 x double> splat (double 6.{{.+}})190 191  four_ll ? four_ll : 6.0;192  // CHECK: %[[COND:.+]] = load <4 x i64>193  // CHECK: %[[LHS:.+]] = load <4 x i64>194  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer195  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i64> %[[LHS]], <4 x i64> splat (i64 6)196 197  four_ll ? four_ll : 6;198  // CHECK: %[[COND:.+]] = load <4 x i64>199  // CHECK: %[[LHS:.+]] = load <4 x i64>200  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer201  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i64> %[[LHS]], <4 x i64> splat (i64 6)202 203  four_ll ? four_ll : some_int;204  // CHECK: %[[COND:.+]] = load <4 x i64>205  // CHECK: %[[LHS:.+]] = load <4 x i64>206  // CHECK: %[[RHS:.+]] = load i32207  // CHECK: %[[RHS_CONV:.+]] = sext i32 %[[RHS]] to i64208  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i64> poison, i64 %[[RHS_CONV]], i64 0209  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i64> %[[RHS_SPLAT_INSERT]], <4 x i64> poison, <4 x i32> zeroinitializer210  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer211  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i64> %[[LHS]], <4 x i64> %[[RHS_SPLAT]]212 213  four_ll ? four_ll : some_ll;214  // CHECK: %[[COND:.+]] = load <4 x i64>215  // CHECK: %[[LHS:.+]] = load <4 x i64>216  // CHECK: %[[RHS:.+]] = load i64217  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i64> poison, i64 %[[RHS]], i64 0218  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i64> %[[RHS_SPLAT_INSERT]], <4 x i64> poison, <4 x i32> zeroinitializer219  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer220  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i64> %[[LHS]], <4 x i64> %[[RHS_SPLAT]]221 222  four_ll ? four_ll : some_double;223  // CHECK: %[[COND:.+]] = load <4 x i64>224  // CHECK: %[[LHS:.+]] = load <4 x i64>225  // CHECK: %[[RHS:.+]] = load double226  // CHECK: %[[RHS_CONV:.+]] = fptosi double %[[RHS]] to i64227  // CHECK: %[[RHS_SPLAT_INSERT:.+]] = insertelement <4 x i64> poison, i64 %[[RHS_CONV]], i64 0228  // CHECK: %[[RHS_SPLAT:.+]] = shufflevector <4 x i64> %[[RHS_SPLAT_INSERT]], <4 x i64> poison, <4 x i32> zeroinitializer229  // CHECK: %[[NEZERO:.+]] = icmp ne <4 x i64> %[[COND]], zeroinitializer230  // CHECK: %[[SELECT:.+]] = select <4 x i1> %[[NEZERO]], <4 x i64> %[[LHS]], <4 x i64> %[[RHS_SPLAT]]231}232