mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[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:
parent
c550ab6b86
commit
d7bab4e222
1 changed files with 12 additions and 0 deletions
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue