-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
6809Motorola 6809Motorola 6809bugSomething isn't workingSomething isn't workingoptimizationOptimizationOptimization
Milestone
Description
In some algorithms it is possible to carry out the so-called "loop unrolling", that is to avoid introducing a loop by making the operations explicit for a certain number of times.
For example, instead of writing like this:
LDB 4
L1
LDA ,U
STA ,Y
LEAU 1, U
LEAY 1, Y
DECB
BNE L1
can be written like this:
LDA ,U+
STA ,Y+
LDA ,U+
STA ,Y+
LDA ,U+
STA ,Y+
LDA ,U+
STA ,Y+
However, the current optimizer does not recognize that we are in the presence of an automatic increment and this implies the following (incorrect) optimization:
LDA ,U+
; peephole(3): r620 (STORE*,STORE*)->(STORE*)
; STA ,Y+
; peephole(1): r586 (LOAD*,STORE,LOAD*)->(LOAD*,STORE)
; LDA ,U+
; peephole(1): r608 (STORE*,LOAD,STORE*)->(LOAD,STORE*)
; STA ,Y+
; peephole(2): r586 (LOAD*,STORE,LOAD*)->(LOAD*,STORE)
; LDA ,U+
; peephole(2): r620 (STORE*,STORE*)->(STORE*)
; STA ,Y+
; peephole(1): r586 (LOAD*,STORE,LOAD*)->(LOAD*,STORE)
; LDA ,U+
STA ,Y+
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
6809Motorola 6809Motorola 6809bugSomething isn't workingSomething isn't workingoptimizationOptimizationOptimization