Closed nippur72 closed 5 years ago
I've added an additional optimization step for this, which covers these cases under some circumstances, i.e. it relies on all other optimizations to trigger (especially the "Simplified conditional branch" one) and it works only for "equal" and "not equal" but given that these should be the majority of cases and that it doesn't really improve that much anyway, it should be fine this way.
I'm looking into how an
IF
is compiled down to assembly.I noticed the optimizer rule "Highly simplified loading for CMP/6" uses the integer values
#0
and#1
instead ofREAL_CONST_ZERO
andREAL_CONST_MINUS_ONE
which is good, but I think the loading intoA
is not necessary and it could be further optimized avoiding it, doing the BRANCHES directly.Example (current):
Suggested (something like this):
I guess it's much more complex than this because all operators (
<=
,>=
etc..) should be taken into account, perhaps that can be optimized as an additional step in the optimizer?Also notice that
can be shortened by one byte with