mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
2c9cf7c78b
We normalize binary expressions by attempting to group constants together, in order to facilitate further simplification of the expressions. For any binary operator OP, non-constants x, y, and constants a, b, we apply the following rewrite rules: a OP x -> x OP a, if OP is commutative. (x OP a) OP b -> x OP (a OP b), if OP is associative. (x OP a) OP y -> (x OP y) OP a, if OP is associative and commutative. x OP (y OP a) -> (x OP y) OP a, if OP is associative. Note that we consider floating point operations to be non-associative.