[libc-commits] [libc] [Clang] Add __builtin_vectorelements to get number of elements in vector (PR #69010)
Lawrence Benson via libc-commits
libc-commits at lists.llvm.org
Tue Oct 17 04:21:24 PDT 2023
================
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple aarch64 -fsyntax-only -verify %s
+
+void test_builtin_vectorelements() {
+ __builtin_vectorelements(int); // expected-error {{'__builtin_vectorelements' argument must be a vector}}
+ __builtin_vectorelements(float); // expected-error {{'__builtin_vectorelements' argument must be a vector}}
+ __builtin_vectorelements(long*); // expected-error {{'__builtin_vectorelements' argument must be a vector}}
+
+ int a;
+ __builtin_vectorelements(a); // expected-error {{'__builtin_vectorelements' argument must be a vector}}
+
+ typedef int veci4 __attribute__((vector_size(16)));
+ (void) __builtin_vectorelements(veci4);
+
+ veci4 vec;
+ (void) __builtin_vectorelements(vec);
+
+ typedef veci4 some_other_vec;
+ (void) __builtin_vectorelements(some_other_vec);
+
+ struct Foo { int a; };
+ __builtin_vectorelements(struct Foo); // expected-error {{'__builtin_vectorelements' argument must be a vector}}
----------------
lawben wrote:
just FYI: its `CCEDiag`
https://github.com/llvm/llvm-project/pull/69010
More information about the libc-commits
mailing list