1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-04-06 05:38:16 +00:00

8080: optimize loads to HL

This commit is contained in:
Karol Stasiak 2019-06-24 15:18:44 +02:00
parent 15475b6886
commit 8ea3957023

View File

@ -61,6 +61,20 @@ object LaterI80Optimizations {
List(ZLine.ldImm16(BC, h.asl(8).+(l).quickSimplify).pos(code.map(_.source)))
},
(Elidable & Is8BitLoadTo(H) & Match8BitImmediate(1)) ~
(Elidable & Is8BitLoadTo(L) & Match8BitImmediate(0)) ~~> { (code, ctx) =>
val l = ctx.get[Constant](0)
val h = ctx.get[Constant](1)
List(ZLine.ldImm16(HL, h.asl(8).+(l).quickSimplify).pos(code.map(_.source)))
},
(Elidable & Is8BitLoadTo(L) & Match8BitImmediate(0)) ~
(Elidable & Is8BitLoadTo(H) & Match8BitImmediate(1)) ~~> { (code, ctx) =>
val l = ctx.get[Constant](0)
val h = ctx.get[Constant](1)
List(ZLine.ldImm16(HL, h.asl(8).+(l).quickSimplify).pos(code.map(_.source)))
},
(Elidable & Is8BitLoadTo(D) & Match8BitImmediate(1)) ~
(Elidable & Is8BitLoadTo(E) & Match8BitImmediate(0)) ~~> { (code, ctx) =>
val l = ctx.get[Constant](0)