diff --git a/tools/qfcc/source/expr_binary.c b/tools/qfcc/source/expr_binary.c index 5386fc7b6..508214f34 100644 --- a/tools/qfcc/source/expr_binary.c +++ b/tools/qfcc/source/expr_binary.c @@ -1369,6 +1369,13 @@ binary_expr (int op, const expr_t *e1, const expr_t *e2) t2 = pt2; } } + // type_width returns 3/4 for vector/quaternion, but their internal + // width is only 1 + if (type_width (t1) != t1->width || type_width (t2) != t2->width) { + et1 = low_level_type (t1); + et2 = low_level_type (t2); + goto vector_or_quaternion; + } int scalar_op = 0; if (type_width (t1) == 1) { // scalar op vec @@ -1415,6 +1422,7 @@ binary_expr (int op, const expr_t *e1, const expr_t *e2) return edag_add_expr (ne); } } +vector_or_quaternion: expr_type = expr_meta[et1][et2]; while (expr_type->op && expr_type->op != op) diff --git a/tools/qfcc/source/options.c b/tools/qfcc/source/options.c index ce1c4cf7b..7dc8db7c8 100644 --- a/tools/qfcc/source/options.c +++ b/tools/qfcc/source/options.c @@ -849,6 +849,7 @@ DecodeArgs (int argc, char **argv) } } else { options.code.promote_float = false; + options.math.vector_mult = QC_DOT; } if (options.code.progsversion == PROG_ID_VERSION) { options.code.promote_float = false;