1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-09 05:33:11 +00:00

Optimized 32-bit plus 8-bit constant fragment.

This commit is contained in:
jespergravgaard 2020-01-20 00:30:05 +01:00
parent d28bb8245b
commit 68b4794049
3 changed files with 51 additions and 48 deletions

View File

@ -0,0 +1,11 @@
lda {m1}
clc
adc #{c1}
sta {m1}
bcc !+
inc {m1}+1
bne !+
inc {m1}+2
bne !+
inc {m1}+3
!:

View File

@ -98,18 +98,16 @@ ifunc: {
lda.z xsqr+3
adc.z delta+3
sta.z xsqr+3
lda #2
lda.z delta
clc
adc.z delta
adc #2
sta.z delta
lda.z delta+1
adc #0
sta.z delta+1
lda.z delta+2
adc #0
sta.z delta+2
lda.z delta+3
adc #0
sta.z delta+3
bcc !+
inc.z delta+1
bne !+
inc.z delta+2
bne !+
inc.z delta+3
!:
jmp __b1
}

View File

@ -450,19 +450,17 @@ ifunc: {
adc.z delta+3
sta.z xsqr+3
// [17] (dword) ifunc::delta#1 ← (dword) ifunc::delta#2 + (byte) 2 -- vduz1=vduz1_plus_vbuc1
lda #2
lda.z delta
clc
adc.z delta
adc #2
sta.z delta
lda.z delta+1
adc #0
sta.z delta+1
lda.z delta+2
adc #0
sta.z delta+2
lda.z delta+3
adc #0
sta.z delta+3
bcc !+
inc.z delta+1
bne !+
inc.z delta+2
bne !+
inc.z delta+3
!:
// [11] phi from ifunc::@2 to ifunc::@1 [phi:ifunc::@2->ifunc::@1]
__b1_from___b2:
// [11] phi (dword) ifunc::delta#2 = (dword) ifunc::delta#1 [phi:ifunc::@2->ifunc::@1#0] -- register_copy
@ -500,19 +498,19 @@ Missing ASM fragment Fragment not found vduz1=_dec_vduz2. Attempted variations v
File /Users/jespergravgaard/c64/kickc/src/test/kc/sqr-delta.kc
Line 10
return --x;
Uplifting [ifunc] best 2175 combination zp[4]:10 [ ifunc::delta#2 ifunc::delta#1 ] zp[4]:2 [ ifunc::xsqr#2 ifunc::xsqr#1 ] zp[4]:6 [ ifunc::x#3 ifunc::x#1 ] zp[4]:14 [ ifunc::return#2 ] zp[4]:22 [ ifunc::return#0 ]
Uplifting [ifunc] best 2160 combination zp[4]:10 [ ifunc::delta#2 ifunc::delta#1 ] zp[4]:2 [ ifunc::xsqr#2 ifunc::xsqr#1 ] zp[4]:6 [ ifunc::x#3 ifunc::x#1 ] zp[4]:14 [ ifunc::return#2 ] zp[4]:22 [ ifunc::return#0 ]
Warning! Unknown fragment for statement [13] (dword) ifunc::return#0 ← -- (dword) ifunc::x#3
Missing ASM fragment Fragment not found vduz1=_dec_vduz2. Attempted variations vduz1=_dec_vduz2
File /Users/jespergravgaard/c64/kickc/src/test/kc/sqr-delta.kc
Line 10
return --x;
Uplifting [main] best 2175 combination zp[4]:18 [ main::$0 ]
Uplifting [main] best 2160 combination zp[4]:18 [ main::$0 ]
Warning! Unknown fragment for statement [13] (dword) ifunc::return#0 ← -- (dword) ifunc::x#3
Missing ASM fragment Fragment not found vduz1=_dec_vduz2. Attempted variations vduz1=_dec_vduz2
File /Users/jespergravgaard/c64/kickc/src/test/kc/sqr-delta.kc
Line 10
return --x;
Uplifting [] best 2175 combination
Uplifting [] best 2160 combination
Coalescing zero page register [ zp[4]:6 [ ifunc::x#3 ifunc::x#1 ] ] with [ zp[4]:22 [ ifunc::return#0 ] ] - score: 1
Coalescing zero page register [ zp[4]:14 [ ifunc::return#2 ] ] with [ zp[4]:18 [ main::$0 ] ] - score: 1
Coalescing zero page register [ zp[4]:6 [ ifunc::x#3 ifunc::x#1 ifunc::return#0 ] ] with [ zp[4]:14 [ ifunc::return#2 main::$0 ] ] - score: 1
@ -672,19 +670,17 @@ ifunc: {
adc.z delta+3
sta.z xsqr+3
// [17] (dword) ifunc::delta#1 ← (dword) ifunc::delta#2 + (byte) 2 -- vduz1=vduz1_plus_vbuc1
lda #2
lda.z delta
clc
adc.z delta
adc #2
sta.z delta
lda.z delta+1
adc #0
sta.z delta+1
lda.z delta+2
adc #0
sta.z delta+2
lda.z delta+3
adc #0
sta.z delta+3
bcc !+
inc.z delta+1
bne !+
inc.z delta+2
bne !+
inc.z delta+3
!:
// [11] phi from ifunc::@2 to ifunc::@1 [phi:ifunc::@2->ifunc::@1]
__b1_from___b2:
// [11] phi (dword) ifunc::delta#2 = (dword) ifunc::delta#1 [phi:ifunc::@2->ifunc::@1#0] -- register_copy
@ -759,7 +755,7 @@ zp[4]:10 [ ifunc::delta#2 ifunc::delta#1 ]
FINAL ASSEMBLER
Score: 2080
Score: 2065
// File Comments
// Upstart
@ -905,19 +901,17 @@ ifunc: {
sta.z xsqr+3
// delta += 2
// [17] (dword) ifunc::delta#1 ← (dword) ifunc::delta#2 + (byte) 2 -- vduz1=vduz1_plus_vbuc1
lda #2
lda.z delta
clc
adc.z delta
adc #2
sta.z delta
lda.z delta+1
adc #0
sta.z delta+1
lda.z delta+2
adc #0
sta.z delta+2
lda.z delta+3
adc #0
sta.z delta+3
bcc !+
inc.z delta+1
bne !+
inc.z delta+2
bne !+
inc.z delta+3
!:
// [11] phi from ifunc::@2 to ifunc::@1 [phi:ifunc::@2->ifunc::@1]
// [11] phi (dword) ifunc::delta#2 = (dword) ifunc::delta#1 [phi:ifunc::@2->ifunc::@1#0] -- register_copy
// [11] phi (dword) ifunc::x#3 = (dword) ifunc::x#1 [phi:ifunc::@2->ifunc::@1#1] -- register_copy