1 // RUN: %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 - | FileCheck %s --check-prefix=MIXED
4 // RUN: %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 - | FileCheck %s --check-prefix=MIXED
7 // RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
8 // RUN: -faltivec-src-compat=xl -triple powerpc-unknown-unknown -S \
9 // RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
10 // RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
11 // RUN: -faltivec-src-compat=xl -triple powerpc64le-unknown-unknown -S \
12 // RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
13 // RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \
14 // RUN: -faltivec-src-compat=gcc -triple powerpc-unknown-unknown -S \
15 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC
16 // RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \
17 // RUN: -faltivec-src-compat=gcc -triple powerpc64le-unknown-unknown -S \
18 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC
19 // RUN: %clang -mcpu=pwr8 -faltivec-src-compat=mixed --target=powerpc-unknown-unknown \
20 // RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=MIXED
21 // RUN: %clang -mcpu=pwr9 -faltivec-src-compat=mixed --target=powerpc-unknown-unknown \
22 // RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=MIXED
23 // RUN: %clang -mcpu=pwr8 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \
24 // RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
25 // RUN: %clang -mcpu=pwr9 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \
26 // RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
27 // RUN: not %clang -mcpu=pwr8 -faltivec-src-compat=gcc --target=powerpc-unknown-unknown \
28 // RUN: -S -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC
29 // RUN: not %clang -mcpu=pwr9 -faltivec-src-compat=gcc --target=powerpc-unknown-unknown \
30 // RUN: -S -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC
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
;
48 ////////////////////////////////////////////////////////////////////////////////
49 void test_vector_bool_pixel_init(void) {
50 // vector bool char initialization
51 vbi8_1
= (vector
bool char)('a');
52 // MIXED: <i8 97, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
53 // 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>
54 // GCC: error: invalid conversion between vector type '__vector __bool unsigned char' (vector of 16 'unsigned char' values) and integer type 'unsigned char' of different size
56 vbi8_2
= (vector
bool char)(c
);
57 // MIXED: [[INS:%.*]] = insertelement <16 x i8>
58 // MIXED: store <16 x i8> [[INS:%.*]]
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]]
62 // GCC: error: invalid conversion between vector type '__vector __bool unsigned char' (vector of 16 'unsigned char' values) and integer type 'unsigned char' of different size
64 // vector bool short initialization
65 vbi16_1
= (vector
bool short)(5);
66 // MIXED: <i16 5, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
67 // XL: <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
68 // GCC: error: invalid conversion between vector type '__vector __bool unsigned short' (vector of 8 'unsigned short' values) and integer type 'unsigned short' of different size
70 vbi16_2
= (vector
bool short)(si16
);
71 // MIXED: [[INS:%.*]] = insertelement <8 x i16>
72 // MIXED: store <8 x i16> [[INS:%.*]]
73 // XL: [[INS_ELT:%.*]] = insertelement <8 x i16>
74 // XL: [[SHUFF:%.*]] = shufflevector <8 x i16> [[INS_ELT]], <8 x i16> poison, <8 x i32> zeroinitializer
75 // XL: store <8 x i16> [[SHUFF]]
76 // GCC: error: invalid conversion between vector type '__vector __bool unsigned short' (vector of 8 'unsigned short' values) and integer type 'unsigned short' of different size
78 // vector bool int initialization
79 vbi32_1
= (vector
bool int)(9);
80 // MIXED: <i32 9, i32 0, i32 0, i32 0>
81 // XL: <i32 9, i32 9, i32 9, i32 9>
82 // GCC: error: invalid conversion between vector type '__vector __bool unsigned int' (vector of 4 'unsigned int' values) and integer type 'unsigned int' of different size
84 vbi32_2
= (vector
bool int)(si32
);
85 // MIXED: [[INS:%.*]] = insertelement <4 x i32>
86 // MIXED: store <4 x i32> [[INS:%.*]]
87 // XL: [[INS_ELT:%.*]] = insertelement <4 x i32>
88 // XL: [[SHUFF:%.*]] = shufflevector <4 x i32> [[INS_ELT]], <4 x i32> poison, <4 x i32> zeroinitializer
89 // XL: store <4 x i32> [[SHUFF]]
90 // GCC: error: invalid conversion between vector type '__vector __bool unsigned int' (vector of 4 'unsigned int' values) and integer type 'unsigned int' of different size
92 // vector bool long long initialization
93 vbi64_1
= (vector
bool long long)(13);
94 // MIXED: <i64 13, i64 0>
95 // XL: <i64 13, i64 13>
96 // GCC: error: invalid conversion between vector type '__vector __bool unsigned long long' (vector of 2 'unsigned long long' values) and integer type 'unsigned long long' of different size
97 long long si64
= 1313;
98 vbi64_2
= (vector
bool long long)(si64
);
99 // MIXED: [[INS:%.*]] = insertelement <2 x i64>
100 // MIXED: store <2 x i64> [[INS:%.*]]
101 // XL: [[INS_ELT:%.*]] = insertelement <2 x i64>
102 // XL: [[SHUFF:%.*]] = shufflevector <2 x i64> [[INS_ELT]], <2 x i64> poison, <2 x i32> zeroinitializer
103 // XL: store <2 x i64> [[SHUFF]]
104 // GCC: error: invalid conversion between vector type '__vector __bool unsigned long long' (vector of 2 'unsigned long long' values) and integer type 'unsigned long long' of different size
106 // vector pixel initialization
107 p1
= (vector pixel
)(1);
108 // MIXED: <i16 1, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
109 // XL: <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
110 // GCC: error: invalid conversion between vector type '__vector __pixel ' (vector of 8 'unsigned short' values) and integer type 'unsigned short' of different size