108 lines · c
1// RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \2// RUN: -faltivec-src-compat=mixed -triple powerpc-unknown-unknown \3// RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=MIXED-ERR4// RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \5// RUN: -faltivec-src-compat=mixed -triple powerpc64le-unknown-unknown \6// RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=MIXED-ERR7// RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \8// RUN: -faltivec-src-compat=gcc -triple powerpc-unknown-unknown \9// RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC-ERR10// RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx \11// RUN: -faltivec-src-compat=gcc -triple powerpc64le-unknown-unknown \12// RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=GCC-ERR13// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \14// RUN: -faltivec-src-compat=xl -triple powerpc-unknown-unknown \15// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=XL16// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \17// RUN: -faltivec-src-compat=xl -triple powerpc64le-unknown-unknown \18// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=XL19// 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-ERR21// 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-ERR23// 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-ERR25// 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-ERR27// RUN: %clang -mcpu=pwr8 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \28// RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL29// RUN: %clang -mcpu=pwr9 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \30// RUN: -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL31 32// Vector bool type33vector bool char vbi8_1;34vector bool char vbi8_2;35 36vector bool short vbi16_1;37vector bool short vbi16_2;38 39vector bool int vbi32_1;40vector bool int vbi32_2;41 42vector bool long long vbi64_1;43vector bool long long vbi64_2;44 45// Vector pixel type46vector pixel p1;47 48////////////////////////////////////////////////////////////////////////////////49void test_vector_bool_pixel_init_no_parentheses(void) {50 // vector bool char initialization51 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 size54 // XL: splat (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 size59 // XL: [[INS_ELT:%.*]] = insertelement <16 x i8>60 // XL: [[SHUFF:%.*]] = shufflevector <16 x i8> [[INS_ELT]], <16 x i8> poison, <16 x i32> zeroinitializer61 // XL: store <16 x i8> [[SHUFF]]62 63 // vector bool short initialization64 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 size67 // XL: splat (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 size72 // XL: [[INS_ELT:%.*]] = insertelement <8 x i16>73 // XL: [[SHUFF:%.*]] = shufflevector <8 x i16> [[INS_ELT]], <8 x i16> poison, <8 x i32> zeroinitializer74 // XL: store <8 x i16> [[SHUFF]]75 76 // vector bool int initialization77 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 size80 // XL: splat (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 size85 // XL: [[INS_ELT:%.*]] = insertelement <4 x i32>86 // XL: [[SHUFF:%.*]] = shufflevector <4 x i32> [[INS_ELT]], <4 x i32> poison, <4 x i32> zeroinitializer87 // XL: store <4 x i32> [[SHUFF]]88 89 // vector bool long long initialization90 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 size93 // XL: splat (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 size98 // XL: [[INS_ELT:%.*]] = insertelement <2 x i64>99 // XL: [[SHUFF:%.*]] = shufflevector <2 x i64> [[INS_ELT]], <2 x i64> poison, <2 x i32> zeroinitializer100 // XL: store <2 x i64> [[SHUFF]]101 102 // vector pixel initialization103 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 size106 // XL: splat (i16 1)107}108