Allow basic arithmetic operations for vectors

This commit is contained in:
gingerBill
2019-02-23 18:05:41 +00:00
parent 684945ea57
commit 38ae2e9efa
2 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -1700,7 +1700,7 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) {
case irInstr_BinaryOp: { case irInstr_BinaryOp: {
irInstrBinaryOp *bo = &value->Instr.BinaryOp; irInstrBinaryOp *bo = &value->Instr.BinaryOp;
Type *type = base_type(ir_type(bo->left)); Type *type = base_type(ir_type(bo->left));
Type *elem_type = type; Type *elem_type = base_array_type(type);
ir_fprintf(f, "%%%d = ", value->index); ir_fprintf(f, "%%%d = ", value->index);
+9 -4
View File
@@ -974,11 +974,20 @@ bool is_type_poly_proc(Type *t) {
t = base_type(t); t = base_type(t);
return t->kind == Type_Proc && t->Proc.is_polymorphic; return t->kind == Type_Proc && t->Proc.is_polymorphic;
} }
bool is_type_simd_vector(Type *t) {
t = base_type(t);
return t->kind == Type_SimdVector;
}
Type *base_array_type(Type *t) { Type *base_array_type(Type *t) {
if (is_type_array(t)) { if (is_type_array(t)) {
t = base_type(t); t = base_type(t);
return t->Array.elem; return t->Array.elem;
} }
if (is_type_simd_vector(t)) {
t = base_type(t);
return t->SimdVector.elem;
}
return t; return t;
} }
@@ -987,10 +996,6 @@ bool is_type_generic(Type *t) {
return t->kind == Type_Generic; return t->kind == Type_Generic;
} }
bool is_type_simd_vector(Type *t) {
t = base_type(t);
return t->kind == Type_SimdVector;
}
Type *core_array_type(Type *t) { Type *core_array_type(Type *t) {