1// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o - -O0 | FileCheck %s
2
3typedef unsigned char uchar4 __attribute((ext_vector_type(4)));
4typedef unsigned int int4 __attribute((ext_vector_type(4)));
5typedef float float4 __attribute((ext_vector_type(4)));
6
7// CHECK-LABEL: define{{.*}} spir_kernel void @ker()
8void kernel ker() {
9  bool t = true;
10  int4 vec4 = (int4)t;
11// CHECK: {{%.*}} = load i8, i8* %t, align 1
12// CHECK: {{%.*}} = trunc i8 {{%.*}} to i1
13// CHECK: {{%.*}} = sext i1 {{%.*}} to i32
14// CHECK: {{%.*}} = insertelement <4 x i32> poison, i32 {{%.*}}, i32 0
15// CHECK: {{%.*}} = shufflevector <4 x i32> {{%.*}}, <4 x i32> poison, <4 x i32> zeroinitializer
16// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* %vec4, align 16
17  int i = (int)t;
18// CHECK: {{%.*}} = load i8, i8* %t, align 1
19// CHECK: {{%.*}} = trunc i8 {{%.*}} to i1
20// CHECK: {{%.*}} = zext i1 {{%.*}} to i32
21// CHECK: store i32 {{%.*}}, i32* %i, align 4
22
23  uchar4 vc;
24  vc = (uchar4)true;
25// CHECK: store <4 x i8> <i8 -1, i8 -1, i8 -1, i8 -1>, <4 x i8>* %vc, align 4
26  unsigned char c;
27  c = (unsigned char)true;
28// CHECK: store i8 1, i8* %c, align 1
29
30  float4 vf;
31  vf = (float4)true;
32// CHECK: store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
33}
34