summaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode/vectors.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /clang/test/AST/ByteCode/vectors.cpp
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'clang/test/AST/ByteCode/vectors.cpp')
-rw-r--r--clang/test/AST/ByteCode/vectors.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/clang/test/AST/ByteCode/vectors.cpp b/clang/test/AST/ByteCode/vectors.cpp
index 091caf8c9a27..91fec8f86f61 100644
--- a/clang/test/AST/ByteCode/vectors.cpp
+++ b/clang/test/AST/ByteCode/vectors.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both -flax-vector-conversions=none %s
-// RUN: %clang_cc1 -verify=ref,both -flax-vector-conversions=none %s
+// RUN: %clang_cc1 -Wno-c++20-extensions -fexperimental-new-constant-interpreter -verify=expected,both -flax-vector-conversions=none %s
+// RUN: %clang_cc1 -Wno-c++20-extensions -verify=ref,both -flax-vector-conversions=none %s
typedef int __attribute__((vector_size(16))) VI4;
constexpr VI4 A = {1,2,3,4};
@@ -143,3 +143,28 @@ namespace {
constexpr __m128d v_mm_cvtps_pd = _mm_cvtps_pd(kf1);
static_assert(v_mm_cvtps_pd[0] == -1.0 && v_mm_cvtps_pd[1] == +2.0);
}
+
+namespace Assign {
+ constexpr int a2() {
+ VI a = {0, 0, 0, 0};
+ VI b;
+
+ b = {1,1,1,1};
+ return b[0] + b[1] + b[2] + b[3];
+ }
+
+ static_assert(a2() == 4);
+
+ typedef short v2int16_t __attribute__((ext_vector_type(2)));
+ typedef unsigned short v2int_t __attribute__((ext_vector_type(2)));
+
+
+ constexpr bool invalid() {
+ v2int16_t a = {0, 0};
+ v2int_t b;
+ b = a; // both-error {{incompatible type}}
+
+ return true;
+ }
+ static_assert(invalid()); // both-error {{not an integral constant expression}}
+}