1 // RUN: %clang_cc1 %s -triple arm64-apple-ios8.1.0 -std=c++11 -emit-llvm -o - | FileCheck %s
2 
3 typedef __attribute__((__ext_vector_type__(8))) float vector_float8;
4 
5 typedef vector_float8 float8;
6 
7 // rdar://20000762
8 // CHECK-LABEL: define void @_Z23MandelbrotPolyCalcSIMD8v
9 void MandelbrotPolyCalcSIMD8() {
10   constexpr float8 v4 = 4.0;  // value to compare against abs(z)^2, to see if bounded
11   float8 vABS;
12   auto vLT  = vABS < v4;
13   // CHECK: store <8 x float>
14   // CHECK: [[ZERO:%.*]] = load <8 x float>, <8 x float>* [[VARBS:%.*]]
15   // CHECK: [[CMP:%.*]] = fcmp olt <8 x float> [[ZERO]]
16   // CHECK: [[SEXT:%.*]] = sext <8 x i1> [[CMP]] to <8 x i32>
17   // CHECK: store <8 x i32> [[SEXT]], <8 x i32>* [[VLT:%.*]]
18 }
19 
20 typedef __attribute__((__ext_vector_type__(4))) int int4;
21 typedef __attribute__((__ext_vector_type__(4))) float float4;
22 typedef __attribute__((__ext_vector_type__(4))) __int128 bigint4;
23 
24 // CHECK-LABEL: define void @_Z14BoolConversionv
25 void BoolConversion() {
26   // CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
27   int4 intsT = (int4)true;
28   // CHECK: store <4 x i32> zeroinitializer
29   int4 intsF = (int4)false;
30   // CHECK: store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
31   float4 floatsT = (float4)true;
32   // CHECK: store <4 x float> zeroinitializer
33   float4 floatsF = (float4)false;
34   // CHECK: store <4 x i128> <i128 -1, i128 -1, i128 -1, i128 -1>
35   bigint4 bigintsT = (bigint4)true;
36   // CHECK: store <4 x i128> zeroinitializer
37   bigint4 bigintsF = (bigint4)false;
38 
39   // CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
40   constexpr int4 cIntsT = (int4)true;
41   // CHECK: store <4 x i32> zeroinitializer
42   constexpr int4 cIntsF = (int4)false;
43   // CHECK: store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
44   constexpr float4 cFloatsT = (float4)true;
45   // CHECK: store <4 x float> zeroinitializer
46   constexpr float4 cFloatsF = (float4)false;
47   // CHECK: store <4 x i128> <i128 -1, i128 -1, i128 -1, i128 -1>
48   constexpr bigint4 cBigintsT = (bigint4)true;
49   // CHECK: store <4 x i128> zeroinitializer
50   constexpr bigint4 cBigintsF = (bigint4)false;
51 }
52