aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-25 21:17:21 +0100
committergingerBill <bill@gingerbill.org>2022-05-25 21:17:21 +0100
commit1549d01bf76e8c5e13626e57b1f976330a9cdd50 (patch)
treef57a02094dc02bed45d6d814b094a24b75939ae0 /src/check_expr.cpp
parentb168bf9460491a101f3a7d41c28500a45898ecbf (diff)
Restrict `swizzle` to a power of two for #simd
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 9fd6acefd..a30f83e7e 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -4119,7 +4119,11 @@ ExactValue get_constant_field(CheckerContext *c, Operand const *operand, Selecti
Type *determine_swizzle_array_type(Type *original_type, Type *type_hint, isize new_count) {
Type *array_type = base_type(type_deref(original_type));
- GB_ASSERT(array_type->kind == Type_Array);
+ GB_ASSERT(array_type->kind == Type_Array || array_type->kind == Type_SimdVector);
+ if (array_type->kind == Type_SimdVector) {
+ Type *elem_type = array_type->SimdVector.elem;
+ return alloc_type_simd_vector(new_count, elem_type);
+ }
Type *elem_type = array_type->Array.elem;
Type *swizzle_array_type = nullptr;