Debian Codegraph @

clang/test/Sema/builtin-masked.cpp

raw
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
2
3 using v8i = int [[clang::ext_vector_type(8)]];
4 using v8b = bool [[clang::ext_vector_type(8)]];
5
6 template <class T, class V>
7 static void load(v8b mask, V value, const T *ptr) {
8 (void)__builtin_masked_load(mask, ptr, value); // expected-error {{2nd argument must be a scalar pointer}}
9 (void)__builtin_masked_expand_load(mask, ptr, value); // expected-error {{2nd argument must be a scalar pointer}}
10 (void)__builtin_masked_gather(mask, value, ptr); // expected-error {{3rd argument must be a scalar pointer}}
11 }
12
13 template <class T, class V>
14 static void store(v8b mask, V value, T *ptr) {
15 (void)__builtin_masked_store(mask, value, ptr); // expected-error {{3rd argument must be a scalar pointer}}
16 (void)__builtin_masked_compress_store(mask, value, ptr); // expected-error {{3rd argument must be a scalar pointer}}
17 (void)__builtin_masked_scatter(mask, value, value, ptr); // expected-error {{4th argument must be a scalar pointer}}
18 }
19
20 void test_masked(v8b mask, v8i v, int *ptr) {
21 load(mask, v, ptr);
22 store(mask, v, ptr);
23 load(mask, v, &v); // expected-note {{in instantiation of function template specialization 'load<int __attribute__((ext_vector_type(8))), int __attribute__((ext_vector_type(8)))>' requested here}}
24 store(mask, v, &v); // expected-note {{in instantiation of function template specialization 'store<int __attribute__((ext_vector_type(8))), int __attribute__((ext_vector_type(8)))>' requested here}}
25 }