1 // REQUIRES: powerpc-registered-target
2
3 // RUN: %clang_cc1 -target-feature +vsx -target-cpu pwr10 \
4 // RUN: -triple powerpc64le-unknown-unknown -fsyntax-only %s -verify
5 // RUN: %clang_cc1 -target-feature +vsx -target-cpu pwr10 \
6 // RUN: -triple powerpc64-unknown-unknown -fsyntax-only %s -verify
7
8 #include <altivec.h>
9
10 vector signed int vsia;
11 vector unsigned int vuia;
12 vector signed long long vslla;
13 vector unsigned long long vulla;
14 vector float vfa;
15 vector double vda;
16 signed int sia;
17 unsigned int uia;
18 signed long long slla;
19 unsigned long long ulla;
20 float fa;
21 double da;
22
test_vec_replace_elt_si(void)23 vector signed int test_vec_replace_elt_si(void) {
24 return vec_replace_elt(vsia, sia, 13); // expected-error {{argument value 13 is outside the valid range [0, 12]}}
25 }
26
test_vec_replace_elt_ui(void)27 vector unsigned int test_vec_replace_elt_ui(void) {
28 return vec_replace_elt(vuia, sia, 1); // expected-error {{arguments are of different types ('unsigned int' vs 'int')}}
29 }
30
test_vec_replace_elt_f(void)31 vector float test_vec_replace_elt_f(void) {
32 return vec_replace_elt(vfa, fa, 20); // expected-error {{argument value 20 is outside the valid range [0, 12]}}
33 }
34
test_vec_replace_elt_f_2(void)35 vector float test_vec_replace_elt_f_2(void) {
36 return vec_replace_elt(vfa, da, 0); // expected-error {{arguments are of different types ('float' vs 'double')}}
37 }
38
test_vec_replace_elt_sll(void)39 vector signed long long test_vec_replace_elt_sll(void) {
40 return vec_replace_elt(vslla, slla, 9); // expected-error {{argument value 9 is outside the valid range [0, 8]}}
41 }
42
test_vec_replace_elt_ull(void)43 vector unsigned long long test_vec_replace_elt_ull(void) {
44 return vec_replace_elt(vulla, vda, 0); // expected-error {{arguments are of different types ('unsigned long long' vs '__vector double' (vector of 2 'double' values))}}
45 }
46
test_vec_replace_elt_ull_2(void)47 vector unsigned long long test_vec_replace_elt_ull_2(void) {
48 return vec_replace_elt(vulla, vulla, vsia); // expected-error {{argument to '__builtin_altivec_vec_replace_elt' must be a constant integer}}
49 }
50
test_vec_replace_elt_d(void)51 vector double test_vec_replace_elt_d(void) {
52 return vec_replace_elt(vda, da, 33); // expected-error {{argument value 33 is outside the valid range [0, 8]}}
53 }
54
test_vec_replace_unaligned_si(void)55 vector unsigned char test_vec_replace_unaligned_si(void) {
56 return vec_replace_unaligned(vsia, da, 6); // expected-error {{arguments are of different types ('int' vs 'double')}}
57 }
58
test_vec_replace_unaligned_ui(void)59 vector unsigned char test_vec_replace_unaligned_ui(void) {
60 return vec_replace_unaligned(vuia, uia, 14); // expected-error {{argument value 14 is outside the valid range [0, 12]}}
61 }
62
test_vec_replace_unaligned_f(void)63 vector unsigned char test_vec_replace_unaligned_f(void) {
64 return vec_replace_unaligned(vfa, fa, 19); // expected-error {{argument value 19 is outside the valid range [0, 12]}}
65 }
66
test_vec_replace_unaligned_sll(void)67 vector unsigned char test_vec_replace_unaligned_sll(void) {
68 return vec_replace_unaligned(vslla, fa, 0); // expected-error {{arguments are of different types ('long long' vs 'float')}}
69 }
70
test_vec_replace_unaligned_ull(void)71 vector unsigned char test_vec_replace_unaligned_ull(void) {
72 return vec_replace_unaligned(vulla, ulla, 12); // expected-error {{argument value 12 is outside the valid range [0, 8]}}
73 }
74
test_vec_replace_unaligned_d(void)75 vector unsigned char test_vec_replace_unaligned_d(void) {
76 return vec_replace_unaligned(vda, fa, 8); // expected-error {{arguments are of different types ('double' vs 'float')}}
77 }
78
test_vec_replace_unaligned_d_2(void)79 vector unsigned char test_vec_replace_unaligned_d_2(void) {
80 return vec_replace_unaligned(vda, vda, da); // expected-error {{argument to '__builtin_altivec_vec_replace_unaligned' must be a constant integer}}
81 }
82