1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-08-14 08:28:58 +00:00

Fix optimization of ADC on 6502

This commit is contained in:
Karol Stasiak 2018-07-16 00:07:22 +02:00
parent 215d8d92b4
commit ca4ae4ce2e

View File

@ -119,8 +119,8 @@ object AlwaysGoodOptimizations {
(Elidable &
MatchA(0) & MatchParameter(1) &
HasOpcode(ADC) & HasAddrMode(Immediate) &
HasClear(State.D) & HasClear(State.C) & DoesntMatterWhatItDoesWith(State.V)) ~
Where(ctx => (ctx.get[Constant](1) + ctx.get[Int](0)).quickSimplify match {
HasClear(State.D) & HasClear(State.C) & DoesntMatterWhatItDoesWith(State.V, State.C)) ~
Where(ctx => (ctx.get[Constant](1).loByte.quickSimplify + ctx.get[Int](0).&(0xff)).quickSimplify match {
case NumericConstant(x, _) => x == (x & 0xff)
case _ => false
}) ~~> { (code, ctx) =>