brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 748c899 Raw
26 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s2 3using v8i = int [[clang::ext_vector_type(8)]];4using v8b = bool [[clang::ext_vector_type(8)]];5 6template <class T, class V>7static 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 13template <class T, class V>14static 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 20void 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}26