| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s |
| 2 |
|
| 3 |
typedef int v8i __attribute__((ext_vector_type(8))); |
| 4 |
typedef _Bool v8b __attribute__((ext_vector_type(8))); |
| 5 |
typedef _Bool v2b __attribute__((ext_vector_type(2))); |
| 6 |
typedef float v8f __attribute__((ext_vector_type(8))); |
| 7 |
|
| 8 |
void test_masked_load(int *pf, v8b mask, v2b mask2, v2b thru) { |
| 9 |
(void)__builtin_masked_load(mask); // expected-error {{too few arguments to function call, expected 2, have 1}} |
| 10 |
(void)__builtin_masked_load(mask, pf, pf, pf); // expected-error {{too many arguments to function call, expected at most 3, have 4}} |
| 11 |
(void)__builtin_masked_load(mask, mask); // expected-error {{2nd argument must be a scalar pointer}} |
| 12 |
(void)__builtin_masked_load(mask2, pf, thru); // expected-error {{3rd argument must be a 'int __attribute__((ext_vector_type(2)))' (vector of 2 'int' values)}} |
| 13 |
} |
| 14 |
|
| 15 |
void test_masked_store(int *pf, v8f *pf2, v8b mask, v2b mask2) { |
| 16 |
__builtin_masked_store(mask); // expected-error {{too few arguments to function call, expected 3, have 1}} |
| 17 |
__builtin_masked_store(mask, 0, 0, 0); // expected-error {{too many arguments to function call, expected 3, have 4}} |
| 18 |
__builtin_masked_store(0, 0, pf); // expected-error {{1st argument must be a vector of boolean types (was 'int')}} |
| 19 |
__builtin_masked_store(mask, 0, pf); // expected-error {{2nd argument must be a vector}} |
| 20 |
__builtin_masked_store(mask, *pf, 0); // expected-error {{3rd argument must be a scalar pointer}} |
| 21 |
} |
| 22 |
|
| 23 |
void test_masked_expand_load(int *pf, v8b mask, v2b mask2, v2b thru) { |
| 24 |
(void)__builtin_masked_expand_load(mask); // expected-error {{too few arguments to function call, expected 2, have 1}} |
| 25 |
(void)__builtin_masked_expand_load(mask, pf, pf, pf); // expected-error {{too many arguments to function call, expected at most 3, have 4}} |
| 26 |
(void)__builtin_masked_expand_load(mask, mask); // expected-error {{2nd argument must be a scalar pointer}} |
| 27 |
(void)__builtin_masked_expand_load(mask2, pf, thru); // expected-error {{3rd argument must be a 'int __attribute__((ext_vector_type(2)))' (vector of 2 'int' values)}} |
| 28 |
} |
| 29 |
|
| 30 |
void test_masked_compress_store(int *pf, v8f *pf2, v8b mask, v2b mask2) { |
| 31 |
__builtin_masked_compress_store(mask); // expected-error {{too few arguments to function call, expected 3, have 1}} |
| 32 |
__builtin_masked_compress_store(mask, 0, 0, 0); // expected-error {{too many arguments to function call, expected 3, have 4}} |
| 33 |
__builtin_masked_compress_store(0, 0, pf); // expected-error {{1st argument must be a vector of boolean types (was 'int')}} |
| 34 |
__builtin_masked_compress_store(mask, 0, pf); // expected-error {{2nd argument must be a vector}} |
| 35 |
__builtin_masked_compress_store(mask, *pf, 0); // expected-error {{3rd argument must be a scalar pointer}} |
| 36 |
} |
| 37 |
|
| 38 |
void test_masked_gather(int *p, v8i idx, v8b mask, v2b mask2, v2b thru) { |
| 39 |
__builtin_masked_gather(mask); // expected-error {{too few arguments to function call, expected 3, have 1}} |
| 40 |
__builtin_masked_gather(mask, p, p, p, p, p); // expected-error {{too many arguments to function call, expected at most 4, have 6}} |
| 41 |
__builtin_masked_gather(p, p, p); // expected-error {{1st argument must be a vector of boolean types (was 'int *')}} |
| 42 |
__builtin_masked_gather(mask, p, p); // expected-error {{1st argument must be a vector of integer types (was 'int *')}} |
| 43 |
__builtin_masked_gather(mask2, idx, p); // expected-error {{all arguments to '__builtin_masked_gather' must have the same number of elements (was 'v2b'}} |
| 44 |
__builtin_masked_gather(mask, idx, p, thru); // expected-error {{4th argument must be a 'int __attribute__((ext_vector_type(8)))' (vector of 8 'int' values)}} |
| 45 |
__builtin_masked_gather(mask, idx, &idx); // expected-error {{3rd argument must be a scalar pointer}} |
| 46 |
} |
| 47 |
|
| 48 |
void test_masked_scatter(int *p, v8i idx, v8b mask, v2b mask2, v8i val) { |
| 49 |
__builtin_masked_scatter(mask); // expected-error {{too few arguments to function call, expected 4, have 1}} |
| 50 |
__builtin_masked_scatter(mask, p, p, p, p, p); // expected-error {{too many arguments to function call, expected 4, have 6}} |
| 51 |
__builtin_masked_scatter(p, p, p, p); // expected-error {{1st argument must be a vector of boolean types (was 'int *')}} |
| 52 |
__builtin_masked_scatter(mask, p, p, p); // expected-error {{2nd argument must be a vector of integer types (was 'int *')}} |
| 53 |
__builtin_masked_scatter(mask, idx, mask, p); // expected-error {{last two arguments to '__builtin_masked_scatter' must have the same type}} |
| 54 |
__builtin_masked_scatter(mask, idx, val, idx); // expected-error {{4th argument must be a scalar pointer}} |
| 55 |
__builtin_masked_scatter(mask, idx, val, &idx); // expected-error {{4th argument must be a scalar pointer}} |
| 56 |
} |
| 57 |
|
| 58 |
void a(v8b mask, v8i v, const int *ptr) { |
| 59 |
__builtin_masked_load(mask, ptr, v); |
| 60 |
(void)__builtin_masked_load(mask, (volatile int *)ptr, v); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 61 |
} |
| 62 |
|
| 63 |
void b(v8b mask, v8i idx, const int *ptr) { |
| 64 |
(void)__builtin_masked_gather(mask, idx, ptr); |
| 65 |
(void)__builtin_masked_gather(mask, idx, (volatile int *)ptr); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 66 |
} |
| 67 |
|
| 68 |
void c(v8b mask, const v8i v, int *ptr) { |
| 69 |
__builtin_masked_store(mask, v, ptr); |
| 70 |
} |
| 71 |
|
| 72 |
void readonly(v8b mask, v8i v, const int *ptr, const int *s) { |
| 73 |
(void)__builtin_masked_store(mask, v, ptr); // expected-error {{sending 'const int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('const int *' vs 'int *')}} |
| 74 |
(void)__builtin_masked_compress_store(mask, v, ptr); // expected-error {{sending 'const int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('const int *' vs 'int *')}} |
| 75 |
(void)__builtin_masked_scatter(mask, v, v, s); // expected-error {{sending 'const int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('const int *' vs 'int *')}} |
| 76 |
} |
| 77 |
|
| 78 |
void vol(v8b mask, v8i v, volatile int *ptr, volatile int *s) { |
| 79 |
(void)__builtin_masked_load(mask, ptr); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 80 |
(void)__builtin_masked_store(mask, v, ptr); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 81 |
(void)__builtin_masked_expand_load(mask, ptr); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 82 |
(void)__builtin_masked_compress_store(mask, v, ptr); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 83 |
(void)__builtin_masked_gather(mask, v, ptr);// expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 84 |
(void)__builtin_masked_scatter(mask, v, v, s); // expected-error {{sending 'volatile int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('volatile int *' vs 'int *')}} |
| 85 |
} |
| 86 |
|
| 87 |
void as(v8b mask, int [[clang::address_space(999)]] * ptr, v8i v) { |
| 88 |
(void)__builtin_masked_load(mask, ptr); |
| 89 |
(void)__builtin_masked_store(mask, v, ptr); |
| 90 |
(void)__builtin_masked_expand_load(mask, ptr); // expected-error {{sending '__attribute__((address_space(999))) int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('__attribute__((address_space(999))) int *' vs 'int *')}} |
| 91 |
(void)__builtin_masked_compress_store(mask, v, ptr); // expected-error {{sending '__attribute__((address_space(999))) int *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('__attribute__((address_space(999))) int *' vs 'int *')}} |
| 92 |
(void)__builtin_masked_gather(mask, v, ptr); |
| 93 |
(void)__builtin_masked_scatter(mask, v, v, ptr); |
| 94 |
} |
| 95 |
|
| 96 |
void atom(v8b mask, _Atomic int * ptr, v8i v) { |
| 97 |
(void)__builtin_masked_load(mask, ptr); // expected-error {{'_Atomic(int) *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('_Atomic(int) *' vs 'int *')}} |
| 98 |
(void)__builtin_masked_store(mask, v, ptr); // expected-error {{'_Atomic(int) *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('_Atomic(int) *' vs 'int *')}} |
| 99 |
(void)__builtin_masked_expand_load(mask, ptr); // expected-error {{'_Atomic(int) *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('_Atomic(int) *' vs 'int *')}} |
| 100 |
(void)__builtin_masked_compress_store(mask, v, ptr); // expected-error {{'_Atomic(int) *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('_Atomic(int) *' vs 'int *')}} |
| 101 |
(void)__builtin_masked_gather(mask, v, ptr); // expected-error {{'_Atomic(int) *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('_Atomic(int) *' vs 'int *')}} |
| 102 |
(void)__builtin_masked_scatter(mask, v, v, ptr); // expected-error {{'_Atomic(int) *' to parameter of incompatible type 'int *': type mismatch at 2nd parameter ('_Atomic(int) *' vs 'int *')}} |
| 103 |
} |