Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / PowerPC / vector-bool-pixel-altivec-init-no-parentheses.c
blob071f66a8f0ab6a895b50afb90b64c98574ec32d4
1 // RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \
2 // RUN: -faltivec-src-compat=mixed -triple powerpc-unknown-unknown -S \
3 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=MIXED-ERR
4 // RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \
5 // RUN: -faltivec-src-compat=mixed -triple powerpc64le-unknown-unknown -S \
6 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=MIXED-ERR
7 // RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \
8 // RUN: -faltivec-src-compat=gcc -triple powerpc-unknown-unknown -S \
9 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC-ERR
10 // RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \
11 // RUN: -faltivec-src-compat=gcc -triple powerpc64le-unknown-unknown -S \
12 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC-ERR
13 // RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
14 // RUN: -faltivec-src-compat=xl -triple powerpc-unknown-unknown -S \
15 // RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
16 // RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
17 // RUN: -faltivec-src-compat=xl -triple powerpc64le-unknown-unknown -S \
18 // RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
19 // RUN: not %clang -mcpu=pwr8 -faltivec-src-compat=mixed --target=powerpc-unknown-unknown \
20 // RUN: -S -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=MIXED-ERR
21 // RUN: not %clang -mcpu=pwr9 -faltivec-src-compat=mixed --target=powerpc-unknown-unknown \
22 // RUN: -S -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=MIXED-ERR
23 // RUN: not %clang -mcpu=pwr8 -faltivec-src-compat=gcc --target=powerpc-unknown-unknown \
24 // RUN: -S -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC-ERR
25 // RUN: not %clang -mcpu=pwr9 -faltivec-src-compat=gcc --target=powerpc-unknown-unknown \
26 // RUN: -S -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC-ERR
27 // RUN: %clang -mcpu=pwr8 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \
28 // RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
29 // RUN: %clang -mcpu=pwr9 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \
30 // RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
32 // Vector bool type
33 vector bool char vbi8_1;
34 vector bool char vbi8_2;
36 vector bool short vbi16_1;
37 vector bool short vbi16_2;
39 vector bool int vbi32_1;
40 vector bool int vbi32_2;
42 vector bool long long vbi64_1;
43 vector bool long long vbi64_2;
45 // Vector pixel type
46 vector pixel p1;
48 ////////////////////////////////////////////////////////////////////////////////
49 void test_vector_bool_pixel_init_no_parentheses(void) {
50 // vector bool char initialization
51 vbi8_1 = (vector bool char)'a';
52 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned char'
53 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned char' (vector of 16 'unsigned char' values) and integer type 'int' of different size
54 // XL: <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
55 char c = 'c';
56 vbi8_2 = (vector bool char)c;
57 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned char'
58 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned char' (vector of 16 'unsigned char' values) and integer type 'char' of different size
59 // XL: [[INS_ELT:%.*]] = insertelement <16 x i8>
60 // XL: [[SHUFF:%.*]] = shufflevector <16 x i8> [[INS_ELT]], <16 x i8> poison, <16 x i32> zeroinitializer
61 // XL: store <16 x i8> [[SHUFF]]
63 // vector bool short initialization
64 vbi16_1 = (vector bool short)5;
65 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned short'
66 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned short' (vector of 8 'unsigned short' values) and integer type 'int' of different size
67 // XL: <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
68 short si16 = 55;
69 vbi16_2 = (vector bool short)si16;
70 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned short'
71 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned short' (vector of 8 'unsigned short' values) and integer type 'short' of different size
72 // XL: [[INS_ELT:%.*]] = insertelement <8 x i16>
73 // XL: [[SHUFF:%.*]] = shufflevector <8 x i16> [[INS_ELT]], <8 x i16> poison, <8 x i32> zeroinitializer
74 // XL: store <8 x i16> [[SHUFF]]
76 // vector bool int initialization
77 vbi32_1 = (vector bool int)9;
78 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned int'
79 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned int' (vector of 4 'unsigned int' values) and integer type 'int' of different size
80 // XL: <i32 9, i32 9, i32 9, i32 9>
81 int si32 = 99;
82 vbi32_2 = (vector bool int)si32;
83 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned int'
84 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned int' (vector of 4 'unsigned int' values) and integer type 'int' of different size
85 // XL: [[INS_ELT:%.*]] = insertelement <4 x i32>
86 // XL: [[SHUFF:%.*]] = shufflevector <4 x i32> [[INS_ELT]], <4 x i32> poison, <4 x i32> zeroinitializer
87 // XL: store <4 x i32> [[SHUFF]]
89 // vector bool long long initialization
90 vbi64_1 = (vector bool long long)13;
91 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned long long'
92 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned long long' (vector of 2 'unsigned long long' values) and integer type 'int' of different size
93 // XL: <i64 13, i64 13>
94 long long si64 = 1313;
95 vbi64_2 = (vector bool long long)si64;
96 // MIXED-ERR: error: invalid conversion between vector type '__vector __bool unsigned long long'
97 // GCC-ERR: error: invalid conversion between vector type '__vector __bool unsigned long long' (vector of 2 'unsigned long long' values) and integer type 'long long' of different size
98 // XL: [[INS_ELT:%.*]] = insertelement <2 x i64>
99 // XL: [[SHUFF:%.*]] = shufflevector <2 x i64> [[INS_ELT]], <2 x i64> poison, <2 x i32> zeroinitializer
100 // XL: store <2 x i64> [[SHUFF]]
102 // vector pixel initialization
103 p1 = (vector pixel)1;
104 // MIXED-ERR: error: invalid conversion between vector type '__vector __pixel '
105 // GCC-ERR: error: invalid conversion between vector type '__vector __pixel ' (vector of 8 'unsigned short' values) and integer type 'int' of different size
106 // XL: <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>