mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-11 12:29:46 +00:00
6502: Optimize ROL/ROR before AND
This commit is contained in:
parent
635870585e
commit
fa7844e0b8
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
* Fixed several serious bugs related to cartridge-based targets.
|
* Fixed several serious bugs related to cartridge-based targets.
|
||||||
|
|
||||||
|
* 6502: Few minor optimization improvements.
|
||||||
|
|
||||||
## 0.3.6
|
## 0.3.6
|
||||||
|
|
||||||
* **Breaking change!**
|
* **Breaking change!**
|
||||||
|
@ -1583,6 +1583,18 @@ object AlwaysGoodOptimizations {
|
|||||||
(Elidable & HasOpcode(ANC) & MatchImmediate(1)) ~~> { (lines, ctx) =>
|
(Elidable & HasOpcode(ANC) & MatchImmediate(1)) ~~> { (lines, ctx) =>
|
||||||
lines.init.tail :+ AssemblyLine.immediate(ANC, CompoundConstant(MathOperator.And, ctx.get[Constant](0), ctx.get[Constant](1)))
|
lines.init.tail :+ AssemblyLine.immediate(ANC, CompoundConstant(MathOperator.And, ctx.get[Constant](0), ctx.get[Constant](1)))
|
||||||
},
|
},
|
||||||
|
(Elidable & HasOpcode(ROR) & HasAddrMode(Implied)) ~
|
||||||
|
(Linear & Not(ChangesA) & Not(ReadsNOrZ) & Not(ReadsC) & Not(ReadsA)).* ~
|
||||||
|
(HasOpcodeIn(AND, ANC) & MatchNumericImmediate(1)) ~
|
||||||
|
Where(ctx => ctx.get[Int](1).&(0x80) == 0)~~> { (lines, ctx) =>
|
||||||
|
lines.head.copy(opcode = LSR) :: lines.tail
|
||||||
|
},
|
||||||
|
(Elidable & HasOpcode(ROL) & HasAddrMode(Implied)) ~
|
||||||
|
(Linear & Not(ChangesA) & Not(ReadsNOrZ) & Not(ReadsC) & Not(ReadsA)).* ~
|
||||||
|
(HasOpcodeIn(AND, ANC) & MatchNumericImmediate(1)) ~
|
||||||
|
Where(ctx => ctx.get[Int](1).&(1) == 0)~~> { (lines, ctx) =>
|
||||||
|
lines.head.copy(opcode = ASL) :: lines.tail
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
val SimplifiableIndexChanging = new RuleBasedAssemblyOptimization("Simplifiable index changing",
|
val SimplifiableIndexChanging = new RuleBasedAssemblyOptimization("Simplifiable index changing",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user