mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-03-12 13:30:41 +00:00
Generating fast multiply table in both ASM and KC.
This commit is contained in:
parent
bb0aeb9e3b
commit
389b6042ed
@ -20,7 +20,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class AsmFragmentManager {
|
||||
|
||||
static boolean verboseFragmentLog = false;
|
||||
static boolean verboseFragmentLog = true;
|
||||
|
||||
/**
|
||||
* Cache for fragment files. Maps signature to the parsed file.
|
||||
|
@ -0,0 +1,6 @@
|
||||
clc
|
||||
adc {z2}
|
||||
sta {z1}
|
||||
lda #0
|
||||
adc {z2}+1
|
||||
sta {z1}+1
|
@ -15,7 +15,26 @@ byte[512] mul_sqr_lo;
|
||||
byte[512] mul_sqr_hi;
|
||||
|
||||
void init_mul_tables() {
|
||||
// If f(x) = x*x then f(x+1) = f(x) + 2*x + 1
|
||||
// If f(x) = x*x/4 then f(x+1) = f(x) + x/2 + 1/4
|
||||
word sqr = 0;
|
||||
// First do bytes 1-255 - byte 0 is already zero
|
||||
for(byte i : 1..255) {
|
||||
// sqr++ on even numbers because 1 = 2*1/4 (from the two previous numbers) + 1/2 (half of the previous uneven number)
|
||||
if((i&1)==0) sqr++;
|
||||
mul_sqr_lo[i] = <sqr;
|
||||
mul_sqr_hi[i] = >sqr;
|
||||
// sqr = sqr + i/2 (when uneven 1/2 is not added here)
|
||||
sqr = sqr + i>>1;
|
||||
}
|
||||
// Then do bytes 256-511
|
||||
for(i : 0..255) {
|
||||
// sqr++ on even numbers because 1 = 2*1/4 (from the two previous numbers) + 1/2 (half of the previous uneven number)
|
||||
if((i&1)==0) sqr++;
|
||||
(mul_sqr_lo+$100)[i] = <sqr;
|
||||
(mul_sqr_hi+$100)[i] = >sqr;
|
||||
// sqr = sqr + i/2 (when uneven 1/2 is not added here)
|
||||
sqr = sqr + 128 + i>>1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,16 +70,20 @@ void init_mul_tables_asm() {
|
||||
iny
|
||||
bne lb1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Compare the ASM-based mul tables with the KC-based mul tables
|
||||
// Red screen on failure - green on success
|
||||
void mul_tables_compare() {
|
||||
*BGCOL = 5;
|
||||
for( byte i: 0..255) {
|
||||
if(mul_sqr_lo[i]!=asm_mul_sqr_lo[i]) {
|
||||
if(mul_sqr_lo[i] != asm_mul_sqr_lo[i])
|
||||
*BGCOL = 2;
|
||||
}
|
||||
if(mul_sqr_hi[i]!=asm_mul_sqr_hi[i]) {
|
||||
if((mul_sqr_hi+$100)[i] != (asm_mul_sqr_hi+$100)[i])
|
||||
*BGCOL = 2;
|
||||
if(mul_sqr_lo[i] != asm_mul_sqr_lo[i])
|
||||
*BGCOL = 2;
|
||||
if((mul_sqr_hi+$100)[i] != (asm_mul_sqr_hi+$100)[i])
|
||||
*BGCOL = 2;
|
||||
}
|
||||
}
|
||||
}
|
143
src/main/java/dk/camelot64/kickc/test/ref/multiply.asm
Normal file
143
src/main/java/dk/camelot64/kickc/test/ref/multiply.asm
Normal file
@ -0,0 +1,143 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.const BGCOL = $d021
|
||||
mul_sqr_lo: .fill 512, 0
|
||||
mul_sqr_hi: .fill 512, 0
|
||||
asm_mul_sqr_lo: .fill 512, 0
|
||||
asm_mul_sqr_hi: .fill 512, 0
|
||||
jsr main
|
||||
main: {
|
||||
jsr init_mul_tables
|
||||
jsr init_mul_tables_asm
|
||||
jsr mul_tables_compare
|
||||
rts
|
||||
}
|
||||
mul_tables_compare: {
|
||||
lda #5
|
||||
sta BGCOL
|
||||
ldx #0
|
||||
b1:
|
||||
lda mul_sqr_lo,x
|
||||
cmp asm_mul_sqr_lo,x
|
||||
beq b2
|
||||
lda #2
|
||||
sta BGCOL
|
||||
b2:
|
||||
lda mul_sqr_hi+$100,x
|
||||
cmp asm_mul_sqr_hi+$100,x
|
||||
beq b3
|
||||
lda #2
|
||||
sta BGCOL
|
||||
b3:
|
||||
lda mul_sqr_lo,x
|
||||
cmp asm_mul_sqr_lo,x
|
||||
beq b4
|
||||
lda #2
|
||||
sta BGCOL
|
||||
b4:
|
||||
lda mul_sqr_hi+$100,x
|
||||
cmp asm_mul_sqr_hi+$100,x
|
||||
beq b5
|
||||
lda #2
|
||||
sta BGCOL
|
||||
b5:
|
||||
inx
|
||||
cpx #0
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
init_mul_tables_asm: {
|
||||
ldx #0
|
||||
txa
|
||||
.byte $c9
|
||||
lb1:
|
||||
tya
|
||||
adc #0
|
||||
ml1:
|
||||
sta asm_mul_sqr_hi,x
|
||||
tay
|
||||
cmp #$40
|
||||
txa
|
||||
ror
|
||||
ml9:
|
||||
adc #0
|
||||
sta ml9+1
|
||||
inx
|
||||
ml0:
|
||||
sta asm_mul_sqr_lo,x
|
||||
bne lb1
|
||||
inc ml0+2
|
||||
inc ml1+2
|
||||
clc
|
||||
iny
|
||||
bne lb1
|
||||
rts
|
||||
}
|
||||
init_mul_tables: {
|
||||
.label _15 = 2
|
||||
.label sqr = 2
|
||||
lda #0
|
||||
sta sqr
|
||||
sta sqr+1
|
||||
ldx #1
|
||||
b1:
|
||||
txa
|
||||
and #1
|
||||
cmp #0
|
||||
bne b2
|
||||
inc sqr
|
||||
bne !+
|
||||
inc sqr+1
|
||||
!:
|
||||
b2:
|
||||
lda sqr
|
||||
sta mul_sqr_lo,x
|
||||
lda sqr+1
|
||||
sta mul_sqr_hi,x
|
||||
txa
|
||||
lsr
|
||||
clc
|
||||
adc sqr
|
||||
sta sqr
|
||||
bcc !+
|
||||
inc sqr+1
|
||||
!:
|
||||
inx
|
||||
cpx #0
|
||||
bne b1
|
||||
ldx #0
|
||||
b3:
|
||||
txa
|
||||
and #1
|
||||
cmp #0
|
||||
bne b4
|
||||
inc sqr
|
||||
bne !+
|
||||
inc sqr+1
|
||||
!:
|
||||
b4:
|
||||
lda sqr
|
||||
sta mul_sqr_lo+$100,x
|
||||
lda sqr+1
|
||||
sta mul_sqr_hi+$100,x
|
||||
lda _15
|
||||
clc
|
||||
adc #<$80
|
||||
sta _15
|
||||
bcc !+
|
||||
inc _15+1
|
||||
!:
|
||||
txa
|
||||
lsr
|
||||
clc
|
||||
adc sqr
|
||||
sta sqr
|
||||
bcc !+
|
||||
inc sqr+1
|
||||
!:
|
||||
inx
|
||||
cpx #0
|
||||
bne b3
|
||||
rts
|
||||
}
|
112
src/main/java/dk/camelot64/kickc/test/ref/multiply.cfg
Normal file
112
src/main/java/dk/camelot64/kickc/test/ref/multiply.cfg
Normal file
@ -0,0 +1,112 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@4
|
||||
@4: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @4
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @4
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call init_mul_tables param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[6] phi() [ ] ( main:2 [ ] )
|
||||
[7] call init_mul_tables_asm param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
[8] phi() [ ] ( main:2 [ ] )
|
||||
[9] call mul_tables_compare param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@2
|
||||
[10] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
||||
mul_tables_compare: scope:[mul_tables_compare] from main::@2
|
||||
[11] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word) 5 [ ] ( main:2::mul_tables_compare:9 [ ] )
|
||||
to:mul_tables_compare::@1
|
||||
mul_tables_compare::@1: scope:[mul_tables_compare] from mul_tables_compare mul_tables_compare::@5
|
||||
[12] (byte) mul_tables_compare::i#10 ← phi( mul_tables_compare/(byte/signed byte/word/signed word) 0 mul_tables_compare::@5/(byte) mul_tables_compare::i#1 ) [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
[13] if(*((const byte[512]) mul_sqr_lo#0 + (byte) mul_tables_compare::i#10)==*((const byte[512]) asm_mul_sqr_lo#0 + (byte) mul_tables_compare::i#10)) goto mul_tables_compare::@2 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@6
|
||||
mul_tables_compare::@6: scope:[mul_tables_compare] from mul_tables_compare::@1
|
||||
[14] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word) 2 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@2
|
||||
mul_tables_compare::@2: scope:[mul_tables_compare] from mul_tables_compare::@1 mul_tables_compare::@6
|
||||
[15] if(*((const byte[512]) mul_sqr_hi#0+(word/signed word) 256 + (byte) mul_tables_compare::i#10)==*((const byte[512]) asm_mul_sqr_hi#0+(word/signed word) 256 + (byte) mul_tables_compare::i#10)) goto mul_tables_compare::@3 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@7
|
||||
mul_tables_compare::@7: scope:[mul_tables_compare] from mul_tables_compare::@2
|
||||
[16] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word) 2 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@3
|
||||
mul_tables_compare::@3: scope:[mul_tables_compare] from mul_tables_compare::@2 mul_tables_compare::@7
|
||||
[17] if(*((const byte[512]) mul_sqr_lo#0 + (byte) mul_tables_compare::i#10)==*((const byte[512]) asm_mul_sqr_lo#0 + (byte) mul_tables_compare::i#10)) goto mul_tables_compare::@4 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@8
|
||||
mul_tables_compare::@8: scope:[mul_tables_compare] from mul_tables_compare::@3
|
||||
[18] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word) 2 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@4
|
||||
mul_tables_compare::@4: scope:[mul_tables_compare] from mul_tables_compare::@3 mul_tables_compare::@8
|
||||
[19] if(*((const byte[512]) mul_sqr_hi#0+(word/signed word) 256 + (byte) mul_tables_compare::i#10)==*((const byte[512]) asm_mul_sqr_hi#0+(word/signed word) 256 + (byte) mul_tables_compare::i#10)) goto mul_tables_compare::@5 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@9
|
||||
mul_tables_compare::@9: scope:[mul_tables_compare] from mul_tables_compare::@4
|
||||
[20] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word) 2 [ mul_tables_compare::i#10 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#10 ] )
|
||||
to:mul_tables_compare::@5
|
||||
mul_tables_compare::@5: scope:[mul_tables_compare] from mul_tables_compare::@4 mul_tables_compare::@9
|
||||
[21] (byte) mul_tables_compare::i#1 ← ++ (byte) mul_tables_compare::i#10 [ mul_tables_compare::i#1 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#1 ] )
|
||||
[22] if((byte) mul_tables_compare::i#1!=(byte/signed byte/word/signed word) 0) goto mul_tables_compare::@1 [ mul_tables_compare::i#1 ] ( main:2::mul_tables_compare:9 [ mul_tables_compare::i#1 ] )
|
||||
to:mul_tables_compare::@return
|
||||
mul_tables_compare::@return: scope:[mul_tables_compare] from mul_tables_compare::@5
|
||||
[23] return [ ] ( main:2::mul_tables_compare:9 [ ] )
|
||||
to:@return
|
||||
init_mul_tables_asm: scope:[init_mul_tables_asm] from main::@1
|
||||
asm { ldx#$00txa.byte$c9lb1:tyaadc#$00ml1:staasm_mul_sqr_hi,xtaycmp#$40txarorml9:adc#$00staml9+1inxml0:staasm_mul_sqr_lo,xbnelb1incml0+2incml1+2clcinybnelb1 }
|
||||
to:init_mul_tables_asm::@return
|
||||
init_mul_tables_asm::@return: scope:[init_mul_tables_asm] from init_mul_tables_asm
|
||||
[25] return [ ] ( main:2::init_mul_tables_asm:7 [ ] )
|
||||
to:@return
|
||||
init_mul_tables: scope:[init_mul_tables] from main
|
||||
[26] phi() [ ] ( main:2::init_mul_tables:5 [ ] )
|
||||
to:init_mul_tables::@1
|
||||
init_mul_tables::@1: scope:[init_mul_tables] from init_mul_tables init_mul_tables::@2
|
||||
[27] (word) init_mul_tables::sqr#6 ← phi( init_mul_tables/(byte/signed byte/word/signed word) 0 init_mul_tables::@2/(word) init_mul_tables::sqr#1 ) [ init_mul_tables::i#4 init_mul_tables::sqr#6 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#6 ] )
|
||||
[27] (byte) init_mul_tables::i#4 ← phi( init_mul_tables/(byte/signed byte/word/signed word) 1 init_mul_tables::@2/(byte) init_mul_tables::i#1 ) [ init_mul_tables::i#4 init_mul_tables::sqr#6 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#6 ] )
|
||||
[28] (byte~) init_mul_tables::$0 ← (byte) init_mul_tables::i#4 & (byte/signed byte/word/signed word) 1 [ init_mul_tables::i#4 init_mul_tables::sqr#6 init_mul_tables::$0 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#6 init_mul_tables::$0 ] )
|
||||
[29] if((byte~) init_mul_tables::$0!=(byte/signed byte/word/signed word) 0) goto init_mul_tables::@2 [ init_mul_tables::i#4 init_mul_tables::sqr#6 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#6 ] )
|
||||
to:init_mul_tables::@5
|
||||
init_mul_tables::@5: scope:[init_mul_tables] from init_mul_tables::@1
|
||||
[30] (word) init_mul_tables::sqr#2 ← ++ (word) init_mul_tables::sqr#6 [ init_mul_tables::i#4 init_mul_tables::sqr#2 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#2 ] )
|
||||
to:init_mul_tables::@2
|
||||
init_mul_tables::@2: scope:[init_mul_tables] from init_mul_tables::@1 init_mul_tables::@5
|
||||
[31] (word) init_mul_tables::sqr#5 ← phi( init_mul_tables::@1/(word) init_mul_tables::sqr#6 init_mul_tables::@5/(word) init_mul_tables::sqr#2 ) [ init_mul_tables::i#4 init_mul_tables::sqr#5 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 ] )
|
||||
[32] (byte~) init_mul_tables::$3 ← < (word) init_mul_tables::sqr#5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 init_mul_tables::$3 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 init_mul_tables::$3 ] )
|
||||
[33] *((const byte[512]) mul_sqr_lo#0 + (byte) init_mul_tables::i#4) ← (byte~) init_mul_tables::$3 [ init_mul_tables::i#4 init_mul_tables::sqr#5 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 ] )
|
||||
[34] (byte~) init_mul_tables::$4 ← > (word) init_mul_tables::sqr#5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 init_mul_tables::$4 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 init_mul_tables::$4 ] )
|
||||
[35] *((const byte[512]) mul_sqr_hi#0 + (byte) init_mul_tables::i#4) ← (byte~) init_mul_tables::$4 [ init_mul_tables::i#4 init_mul_tables::sqr#5 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 ] )
|
||||
[36] (byte~) init_mul_tables::$5 ← (byte) init_mul_tables::i#4 >> (byte/signed byte/word/signed word) 1 [ init_mul_tables::i#4 init_mul_tables::sqr#5 init_mul_tables::$5 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#5 init_mul_tables::$5 ] )
|
||||
[37] (word) init_mul_tables::sqr#1 ← (word) init_mul_tables::sqr#5 + (byte~) init_mul_tables::$5 [ init_mul_tables::i#4 init_mul_tables::sqr#1 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#4 init_mul_tables::sqr#1 ] )
|
||||
[38] (byte) init_mul_tables::i#1 ← ++ (byte) init_mul_tables::i#4 [ init_mul_tables::i#1 init_mul_tables::sqr#1 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#1 init_mul_tables::sqr#1 ] )
|
||||
[39] if((byte) init_mul_tables::i#1!=(byte/signed byte/word/signed word) 0) goto init_mul_tables::@1 [ init_mul_tables::i#1 init_mul_tables::sqr#1 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#1 init_mul_tables::sqr#1 ] )
|
||||
to:init_mul_tables::@3
|
||||
init_mul_tables::@3: scope:[init_mul_tables] from init_mul_tables::@2 init_mul_tables::@4
|
||||
[40] (word) init_mul_tables::sqr#10 ← phi( init_mul_tables::@4/(word) init_mul_tables::sqr#3 init_mul_tables::@2/(word) init_mul_tables::sqr#1 ) [ init_mul_tables::i#6 init_mul_tables::sqr#10 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#10 ] )
|
||||
[40] (byte) init_mul_tables::i#6 ← phi( init_mul_tables::@4/(byte) init_mul_tables::i#3 init_mul_tables::@2/(byte/signed byte/word/signed word) 0 ) [ init_mul_tables::i#6 init_mul_tables::sqr#10 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#10 ] )
|
||||
[41] (byte~) init_mul_tables::$8 ← (byte) init_mul_tables::i#6 & (byte/signed byte/word/signed word) 1 [ init_mul_tables::i#6 init_mul_tables::sqr#10 init_mul_tables::$8 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#10 init_mul_tables::$8 ] )
|
||||
[42] if((byte~) init_mul_tables::$8!=(byte/signed byte/word/signed word) 0) goto init_mul_tables::@4 [ init_mul_tables::i#6 init_mul_tables::sqr#10 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#10 ] )
|
||||
to:init_mul_tables::@7
|
||||
init_mul_tables::@7: scope:[init_mul_tables] from init_mul_tables::@3
|
||||
[43] (word) init_mul_tables::sqr#4 ← ++ (word) init_mul_tables::sqr#10 [ init_mul_tables::i#6 init_mul_tables::sqr#4 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#4 ] )
|
||||
to:init_mul_tables::@4
|
||||
init_mul_tables::@4: scope:[init_mul_tables] from init_mul_tables::@3 init_mul_tables::@7
|
||||
[44] (word) init_mul_tables::sqr#7 ← phi( init_mul_tables::@3/(word) init_mul_tables::sqr#10 init_mul_tables::@7/(word) init_mul_tables::sqr#4 ) [ init_mul_tables::i#6 init_mul_tables::sqr#7 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#7 ] )
|
||||
[45] (byte~) init_mul_tables::$12 ← < (word) init_mul_tables::sqr#7 [ init_mul_tables::i#6 init_mul_tables::sqr#7 init_mul_tables::$12 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#7 init_mul_tables::$12 ] )
|
||||
[46] *((const byte[512]) mul_sqr_lo#0+(word/signed word) 256 + (byte) init_mul_tables::i#6) ← (byte~) init_mul_tables::$12 [ init_mul_tables::i#6 init_mul_tables::sqr#7 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#7 ] )
|
||||
[47] (byte~) init_mul_tables::$14 ← > (word) init_mul_tables::sqr#7 [ init_mul_tables::i#6 init_mul_tables::sqr#7 init_mul_tables::$14 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#7 init_mul_tables::$14 ] )
|
||||
[48] *((const byte[512]) mul_sqr_hi#0+(word/signed word) 256 + (byte) init_mul_tables::i#6) ← (byte~) init_mul_tables::$14 [ init_mul_tables::i#6 init_mul_tables::sqr#7 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#7 ] )
|
||||
[49] (word~) init_mul_tables::$15 ← (word) init_mul_tables::sqr#7 + (byte/word/signed word) 128 [ init_mul_tables::i#6 init_mul_tables::$15 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::$15 ] )
|
||||
[50] (byte~) init_mul_tables::$16 ← (byte) init_mul_tables::i#6 >> (byte/signed byte/word/signed word) 1 [ init_mul_tables::i#6 init_mul_tables::$15 init_mul_tables::$16 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::$15 init_mul_tables::$16 ] )
|
||||
[51] (word) init_mul_tables::sqr#3 ← (word~) init_mul_tables::$15 + (byte~) init_mul_tables::$16 [ init_mul_tables::i#6 init_mul_tables::sqr#3 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#6 init_mul_tables::sqr#3 ] )
|
||||
[52] (byte) init_mul_tables::i#3 ← ++ (byte) init_mul_tables::i#6 [ init_mul_tables::i#3 init_mul_tables::sqr#3 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#3 init_mul_tables::sqr#3 ] )
|
||||
[53] if((byte) init_mul_tables::i#3!=(byte/signed byte/word/signed word) 0) goto init_mul_tables::@3 [ init_mul_tables::i#3 init_mul_tables::sqr#3 ] ( main:2::init_mul_tables:5 [ init_mul_tables::i#3 init_mul_tables::sqr#3 ] )
|
||||
to:init_mul_tables::@return
|
||||
init_mul_tables::@return: scope:[init_mul_tables] from init_mul_tables::@4
|
||||
[54] return [ ] ( main:2::init_mul_tables:5 [ ] )
|
||||
to:@return
|
4942
src/main/java/dk/camelot64/kickc/test/ref/multiply.log
Normal file
4942
src/main/java/dk/camelot64/kickc/test/ref/multiply.log
Normal file
File diff suppressed because it is too large
Load Diff
77
src/main/java/dk/camelot64/kickc/test/ref/multiply.sym
Normal file
77
src/main/java/dk/camelot64/kickc/test/ref/multiply.sym
Normal file
@ -0,0 +1,77 @@
|
||||
(label) @4
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(const byte*) BGCOL#0 BGCOL = ((byte*))(word) 53281
|
||||
(byte[512]) asm_mul_sqr_hi
|
||||
(const byte[512]) asm_mul_sqr_hi#0 asm_mul_sqr_hi = { fill( 512, 0) }
|
||||
(byte[512]) asm_mul_sqr_lo
|
||||
(const byte[512]) asm_mul_sqr_lo#0 asm_mul_sqr_lo = { fill( 512, 0) }
|
||||
(void()) init_mul_tables()
|
||||
(byte~) init_mul_tables::$0 reg byte a 22.0
|
||||
(byte~) init_mul_tables::$12 reg byte a 22.0
|
||||
(byte~) init_mul_tables::$14 reg byte a 22.0
|
||||
(word~) init_mul_tables::$15 $15 zp ZP_WORD:2 11.0
|
||||
(byte~) init_mul_tables::$16 reg byte a 22.0
|
||||
(byte~) init_mul_tables::$3 reg byte a 22.0
|
||||
(byte~) init_mul_tables::$4 reg byte a 22.0
|
||||
(byte~) init_mul_tables::$5 reg byte a 22.0
|
||||
(byte~) init_mul_tables::$8 reg byte a 22.0
|
||||
(label) init_mul_tables::@1
|
||||
(label) init_mul_tables::@2
|
||||
(label) init_mul_tables::@3
|
||||
(label) init_mul_tables::@4
|
||||
(label) init_mul_tables::@5
|
||||
(label) init_mul_tables::@7
|
||||
(label) init_mul_tables::@return
|
||||
(byte) init_mul_tables::i
|
||||
(byte) init_mul_tables::i#1 reg byte x 16.5
|
||||
(byte) init_mul_tables::i#3 reg byte x 16.5
|
||||
(byte) init_mul_tables::i#4 reg byte x 6.0
|
||||
(byte) init_mul_tables::i#6 reg byte x 5.5
|
||||
(word) init_mul_tables::sqr
|
||||
(word) init_mul_tables::sqr#1 sqr zp ZP_WORD:2 11.0
|
||||
(word) init_mul_tables::sqr#10 sqr zp ZP_WORD:2 14.666666666666666
|
||||
(word) init_mul_tables::sqr#2 sqr zp ZP_WORD:2 22.0
|
||||
(word) init_mul_tables::sqr#3 sqr zp ZP_WORD:2 7.333333333333333
|
||||
(word) init_mul_tables::sqr#4 sqr zp ZP_WORD:2 22.0
|
||||
(word) init_mul_tables::sqr#5 sqr zp ZP_WORD:2 9.166666666666666
|
||||
(word) init_mul_tables::sqr#6 sqr zp ZP_WORD:2 11.0
|
||||
(word) init_mul_tables::sqr#7 sqr zp ZP_WORD:2 11.0
|
||||
(void()) init_mul_tables_asm()
|
||||
(label) init_mul_tables_asm::@return
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte[512]) mul_sqr_hi
|
||||
(const byte[512]) mul_sqr_hi#0 mul_sqr_hi = { fill( 512, 0) }
|
||||
(byte[512]) mul_sqr_lo
|
||||
(const byte[512]) mul_sqr_lo#0 mul_sqr_lo = { fill( 512, 0) }
|
||||
(void()) mul_tables_compare()
|
||||
(label) mul_tables_compare::@1
|
||||
(label) mul_tables_compare::@2
|
||||
(label) mul_tables_compare::@3
|
||||
(label) mul_tables_compare::@4
|
||||
(label) mul_tables_compare::@5
|
||||
(label) mul_tables_compare::@6
|
||||
(label) mul_tables_compare::@7
|
||||
(label) mul_tables_compare::@8
|
||||
(label) mul_tables_compare::@9
|
||||
(label) mul_tables_compare::@return
|
||||
(byte) mul_tables_compare::i
|
||||
(byte) mul_tables_compare::i#1 reg byte x 16.5
|
||||
(byte) mul_tables_compare::i#10 reg byte x 12.222222222222221
|
||||
|
||||
reg byte x [ mul_tables_compare::i#10 mul_tables_compare::i#1 ]
|
||||
reg byte x [ init_mul_tables::i#4 init_mul_tables::i#1 ]
|
||||
reg byte x [ init_mul_tables::i#6 init_mul_tables::i#3 ]
|
||||
zp ZP_WORD:2 [ init_mul_tables::sqr#7 init_mul_tables::sqr#10 init_mul_tables::sqr#3 init_mul_tables::sqr#5 init_mul_tables::sqr#6 init_mul_tables::sqr#1 init_mul_tables::sqr#2 init_mul_tables::sqr#4 init_mul_tables::$15 ]
|
||||
reg byte a [ init_mul_tables::$0 ]
|
||||
reg byte a [ init_mul_tables::$3 ]
|
||||
reg byte a [ init_mul_tables::$4 ]
|
||||
reg byte a [ init_mul_tables::$5 ]
|
||||
reg byte a [ init_mul_tables::$8 ]
|
||||
reg byte a [ init_mul_tables::$12 ]
|
||||
reg byte a [ init_mul_tables::$14 ]
|
||||
reg byte a [ init_mul_tables::$16 ]
|
Loading…
x
Reference in New Issue
Block a user