[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGenOpenCL / bool_cast.cl
blob3cb2c0c09734c4dd8b40c7af88972b448cf3c2de
1 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -o - -O0 | FileCheck %s
3 typedef unsigned char uchar4 __attribute((ext_vector_type(4)));
4 typedef unsigned int int4 __attribute((ext_vector_type(4)));
5 typedef float float4 __attribute((ext_vector_type(4)));
7 // CHECK-LABEL: define{{.*}} spir_kernel void @ker()
8 void kernel ker() {
9 bool t = true;
10 int4 vec4 = (int4)t;
11 // CHECK: {{%.*}} = load i8, ptr %t, align 1
12 // CHECK: {{%.*}} = trunc i8 {{%.*}} to i1
13 // CHECK: {{%.*}} = sext i1 {{%.*}} to i32
14 // CHECK: {{%.*}} = insertelement <4 x i32> poison, i32 {{%.*}}, i64 0
15 // CHECK: {{%.*}} = shufflevector <4 x i32> {{%.*}}, <4 x i32> poison, <4 x i32> zeroinitializer
16 // CHECK: store <4 x i32> {{%.*}}, ptr %vec4, align 16
17 int i = (int)t;
18 // CHECK: {{%.*}} = load i8, ptr %t, align 1
19 // CHECK: {{%.*}} = trunc i8 {{%.*}} to i1
20 // CHECK: {{%.*}} = zext i1 {{%.*}} to i32
21 // CHECK: store i32 {{%.*}}, ptr %i, align 4
23 uchar4 vc;
24 vc = (uchar4)true;
25 // CHECK: store <4 x i8> splat (i8 -1), ptr %vc, align 4
26 unsigned char c;
27 c = (unsigned char)true;
28 // CHECK: store i8 1, ptr %c, align 1
30 float4 vf;
31 vf = (float4)true;
32 // CHECK: store <4 x float> splat (float -1.000000e+00)