]>
git.rm.cloudns.org Git - xonotic/gmqcc.git/commit
ir: fix generation of multi-op vinstrs
Do not assume that the destination is a temporary location,
as our peephole optimizer will break this. For example, the
following IR code (generated via from `x ^= gety()`):
(0) binst6 <- BITXOR x, call5
(0) x <- STORE_F binst6
after peephole optimization becomes:
(7) x <- BITXOR x, call5
Therefore we cannot assume that the output of the virtual
xor instruction can be utilized as a temporary value.
BITXOR becomes `(x | y) - (x & y)`, which would wrongly be
generated as:
x = x | y;
temp0 = x & y;
x = x - temp0;
While this particular case can be fixed by using temp0 first
and then x, the cross-product case would not be so simple.
Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
Fixes #190