diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-01-06 11:15:28 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-06 11:15:28 +0000 |
| commit | 3d8bde954924f99a095e59bf295dd637efb6b204 (patch) | |
| tree | b1c64fe2a7b96d93a7f0f464308d0a28f0db4082 /src/check_expr.cpp | |
| parent | f160ba4fa6639bebeb90f11a9a0b962b608ea662 (diff) | |
| parent | 14216ebf5169581a738e9c235ef8119a95271b12 (diff) | |
Merge pull request #4601 from Barinzaya/simd_vector_broadcasting
Implicit broadcasting for SIMD arrays
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index ba021a98c..231ece2f4 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3672,6 +3672,13 @@ gb_internal bool check_binary_array_expr(CheckerContext *c, Token op, Operand *x } } } + if (is_type_simd_vector(x->type) && !is_type_simd_vector(y->type)) { + if (check_is_assignable_to(c, y, x->type)) { + if (check_binary_op(c, x, op)) { + return true; + } + } + } return false; } @@ -4556,6 +4563,19 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar break; } + case Type_SimdVector: { + Type *elem = base_array_type(t); + if (check_is_assignable_to(c, operand, elem)) { + operand->mode = Addressing_Value; + } else { + operand->mode = Addressing_Invalid; + convert_untyped_error(c, operand, target_type); + return; + } + + break; + } + case Type_Matrix: { Type *elem = base_array_type(t); if (check_is_assignable_to(c, operand, elem)) { |