• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 %s -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)));
5
6void kernel ker() {
7  bool t = true;
8  int4 vec4 = (int4)t;
9// CHECK: {{%.*}} = load i8, i8* %t, align 1
10// CHECK: {{%.*}} = trunc i8 {{%.*}} to i1
11// CHECK: {{%.*}} = sext i1 {{%.*}} to i32
12// CHECK: {{%.*}} = insertelement <4 x i32> undef, i32 {{%.*}}, i32 0
13// CHECK: {{%.*}} = shufflevector <4 x i32> {{%.*}}, <4 x i32> undef, <4 x i32> zeroinitializer
14// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* %vec4, align 16
15  int i = (int)t;
16// CHECK: {{%.*}} = load i8, i8* %t, align 1
17// CHECK: {{%.*}} = trunc i8 {{%.*}} to i1
18// CHECK: {{%.*}} = zext i1 {{%.*}} to i32
19// CHECK: store i32 {{%.*}}, i32* %i, align 4
20
21  uchar4 vc;
22  vc = (uchar4)true;
23// CHECK: store <4 x i8> <i8 -1, i8 -1, i8 -1, i8 -1>, <4 x i8>* %vc, align 4
24  unsigned char c;
25  c = (unsigned char)true;
26// CHECK: store i8 1, i8* %c, align 1
27}
28