mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Merge pull request #4601 from Barinzaya/simd_vector_broadcasting
Implicit broadcasting for SIMD arrays
This commit is contained in:
@@ -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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4556,6 +4563,19 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar
|
|||||||
break;
|
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: {
|
case Type_Matrix: {
|
||||||
Type *elem = base_array_type(t);
|
Type *elem = base_array_type(t);
|
||||||
if (check_is_assignable_to(c, operand, elem)) {
|
if (check_is_assignable_to(c, operand, elem)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user