[qfcc] Avoid constant folding for vector types

The current code is pretty broken when it comes to vector types (losing
the vector and bogus errors among other issues). The whole thing needs a
rework or even just to be tossed in favor of better DAG processing.
This commit is contained in:
Bill Currie 2023-08-23 21:48:25 +09:00
parent c550ab6b86
commit d7bab4e222

View file

@ -185,6 +185,10 @@ do_op_float (int op, expr_t *e, expr_t *e1, expr_t *e2)
SHL, SHR, AND, OR, LT, GT, LE, GE, EQ, NE, 0
};
if (!is_scalar (get_type (e1)) || !is_scalar (get_type (e2))) {
return e;
}
if (!valid_op (op, valid))
return error (e1, "invalid operator for float");
@ -305,6 +309,10 @@ do_op_double (int op, expr_t *e, expr_t *e1, expr_t *e2)
LT, GT, LE, GE, EQ, NE, 0
};
if (!is_scalar (get_type (e1)) || !is_scalar (get_type (e2))) {
return e;
}
if (!valid_op (op, valid))
return error (e1, "invalid operator for double");
@ -730,6 +738,10 @@ do_op_int (int op, expr_t *e, expr_t *e1, expr_t *e2)
SHL, SHR, AND, OR, LT, GT, LE, GE, EQ, NE, 0
};
if (!is_scalar (get_type (e1)) || !is_scalar (get_type (e2))) {
return e;
}
if (!valid_op (op, valid))
return error (e1, "invalid operator for int");