62 lines · cpp
1// RUN: %clang_cc1 %s -triple arm64-apple-ios8.1.0 -std=c++11 -emit-llvm -o - | FileCheck %s2 3typedef __attribute__((__ext_vector_type__(8))) float vector_float8;4 5typedef vector_float8 float8;6 7// CHECK-LABEL: define{{.*}} void @_Z23MandelbrotPolyCalcSIMD8v8void MandelbrotPolyCalcSIMD8() {9 constexpr float8 v4 = 4.0; // value to compare against abs(z)^2, to see if bounded10 float8 vABS;11 auto vLT = vABS < v4;12 // CHECK: store <8 x float>13 // CHECK: [[ZERO:%.*]] = load <8 x float>, ptr [[VARBS:%.*]]14 // CHECK: [[CMP:%.*]] = fcmp olt <8 x float> [[ZERO]]15 // CHECK: [[SEXT:%.*]] = sext <8 x i1> [[CMP]] to <8 x i32>16 // CHECK: store <8 x i32> [[SEXT]], ptr [[VLT:%.*]]17}18 19typedef __attribute__((__ext_vector_type__(4))) int int4;20typedef __attribute__((__ext_vector_type__(4))) float float4;21typedef __attribute__((__ext_vector_type__(4))) __int128 bigint4;22 23// CHECK-LABEL: define{{.*}} void @_Z14BoolConversionv24void BoolConversion() {25 // CHECK: store <4 x i32> splat (i32 -1)26 int4 intsT = (int4)true;27 // CHECK: store <4 x i32> zeroinitializer28 int4 intsF = (int4)false;29 // CHECK: store <4 x float> splat (float -1.000000e+00)30 float4 floatsT = (float4)true;31 // CHECK: store <4 x float> zeroinitializer32 float4 floatsF = (float4)false;33 // CHECK: store <4 x i128> splat (i128 -1)34 bigint4 bigintsT = (bigint4)true;35 // CHECK: store <4 x i128> zeroinitializer36 bigint4 bigintsF = (bigint4)false;37 38 // CHECK: store <4 x i32> splat (i32 -1)39 constexpr int4 cIntsT = (int4)true;40 // CHECK: store <4 x i32> zeroinitializer41 constexpr int4 cIntsF = (int4)false;42 // CHECK: store <4 x float> splat (float -1.000000e+00)43 constexpr float4 cFloatsT = (float4)true;44 // CHECK: store <4 x float> zeroinitializer45 constexpr float4 cFloatsF = (float4)false;46 // CHECK: store <4 x i128> splat (i128 -1)47 constexpr bigint4 cBigintsT = (bigint4)true;48 // CHECK: store <4 x i128> zeroinitializer49 constexpr bigint4 cBigintsF = (bigint4)false;50}51 52typedef __attribute__((vector_size(8))) int gcc_int_2;53gcc_int_2 FloatToIntConversion(gcc_int_2 Int2, float f) {54 return Int2 + f;55 // CHECK: %[[LOAD_INT:.+]] = load <2 x i32>56 // CHECK: %[[LOAD:.+]] = load float, ptr57 // CHECK: %[[CONV:.+]] = fptosi float %[[LOAD]] to i3258 // CHECK: %[[INSERT:.+]] = insertelement <2 x i32> poison, i32 %[[CONV]], i64 059 // CHECK: %[[SPLAT:.+]] = shufflevector <2 x i32> %[[INSERT]], <2 x i32> poison, <2 x i32> zeroinitializer60 // CHECK: add <2 x i32> %[[LOAD_INT]], %[[SPLAT]]61}62