mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix bit or / xor / and on bool vectors.
This commit is contained in:
@@ -3708,6 +3708,11 @@ void llvm_emit_binary(GenContext *c, BEValue *be_value, Expr *expr, BEValue *lhs
|
||||
llvm_value_set_bool(be_value, val);
|
||||
return;
|
||||
}
|
||||
if (lhs.kind == BE_BOOLVECTOR)
|
||||
{
|
||||
llvm_value_set_bool_vector(be_value, val, expr->type);
|
||||
return;
|
||||
}
|
||||
llvm_value_set(be_value, val, expr->type);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ void expr_insert_widening_type(Expr *expr, Type *infer_type);
|
||||
static Expr *expr_access_inline_member(Expr *parent, Decl *parent_decl);
|
||||
static inline int64_t expr_get_index_max(Expr *expr);
|
||||
static inline bool expr_both_any_integer_or_integer_vector(Expr *left, Expr *right);
|
||||
static inline bool expr_both_any_integer_or_integer_bool_vector(Expr *left, Expr *right);
|
||||
static inline bool expr_both_const(Expr *left, Expr *right);
|
||||
static inline bool sema_identifier_find_possible_inferred(Type *to, Expr *expr);
|
||||
static inline bool sema_expr_analyse_enum_constant(Expr *expr, const char *name, Decl *decl);
|
||||
@@ -313,6 +314,16 @@ static inline bool expr_both_any_integer_or_integer_vector(Expr *left, Expr *rig
|
||||
return type_is_integer(flatten_left->array.base) && type_is_integer(flatten_right->array.base);
|
||||
}
|
||||
|
||||
static inline bool expr_both_any_integer_or_integer_bool_vector(Expr *left, Expr *right)
|
||||
{
|
||||
Type *flatten_left = type_flatten(left->type);
|
||||
Type *flatten_right = type_flatten(right->type);
|
||||
if (type_is_integer(flatten_left) && type_is_integer(flatten_right)) return true;
|
||||
|
||||
if (flatten_left->type_kind != TYPE_VECTOR || flatten_right->type_kind != TYPE_VECTOR) return false;
|
||||
|
||||
return type_is_integer_or_bool_kind(flatten_left->array.base) && type_is_integer_or_bool_kind(flatten_right->array.base);
|
||||
}
|
||||
|
||||
static void expr_binary_unify_failability(Expr *expr, Expr *left, Expr *right)
|
||||
{
|
||||
@@ -4680,7 +4691,7 @@ static bool sema_expr_analyse_bit(SemaContext *context, Expr *expr, Expr *left,
|
||||
|
||||
// 2. Check that both are integers or bools.
|
||||
bool is_bool = left->type->canonical == type_bool;
|
||||
if (!is_bool && !expr_both_any_integer_or_integer_vector(left, right))
|
||||
if (!is_bool && !expr_both_any_integer_or_integer_bool_vector(left, right))
|
||||
{
|
||||
return sema_type_error_on_binop(expr);
|
||||
}
|
||||
|
||||
@@ -758,10 +758,9 @@ static inline void sema_update_const_initializer_with_designator(
|
||||
sema_update_const_initializer_with_designator_union(const_init, curr, end, value);
|
||||
return;
|
||||
case TYPE_ARRAY:
|
||||
case TYPE_VECTOR:
|
||||
sema_update_const_initializer_with_designator_array(const_init, curr, end, value);
|
||||
return;
|
||||
case TYPE_VECTOR:
|
||||
TODO
|
||||
default:
|
||||
UNREACHABLE
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.3.122"
|
||||
#define COMPILER_VERSION "0.3.123"
|
||||
Reference in New Issue
Block a user