mirror of
https://github.com/irmen/prog8.git
synced 2026-10-22 05:02:58 +00:00
verafx: fix copy() and clear() unrolling
This commit is contained in:
1 parent
10fd321537
commit
e2e0992d02
4 files changed
+41
-54
No files matched your search
@@ -42,25 +42,19 @@ verafx {
|
||||
cx16.VERA_FX_MULT = 0
|
||||
cx16.VERA_FX_CTRL = %01000000 ; cache write enable
|
||||
|
||||
if (num_longwords & %1111110000000011) == 0 {
|
||||
repeat lsb(num_longwords >> 2)
|
||||
unroll 4 cx16.VERA_DATA0=0 ; write 4*4 bytes at a time, unrolled
|
||||
cx16.r0 = num_longwords>>3
|
||||
if cx16.r0H==0 {
|
||||
repeat cx16.r0L {
|
||||
unroll 8 cx16.VERA_DATA0=0 ; write 8*4 bytes at a time, unrolled
|
||||
}
|
||||
} else {
|
||||
repeat cx16.r0 {
|
||||
unroll 8 cx16.VERA_DATA0=0 ; write 8*4 bytes at a time, unrolled
|
||||
}
|
||||
}
|
||||
else if (num_longwords & %1111111000000001) == 0 {
|
||||
repeat lsb(num_longwords >> 1)
|
||||
unroll 2 cx16.VERA_DATA0=0 ; write 2*4 bytes at a time, unrolled
|
||||
}
|
||||
else if (lsb(num_longwords) & 3) == 0 {
|
||||
repeat num_longwords >> 2
|
||||
unroll 4 cx16.VERA_DATA0=0 ; write 4*4 bytes at a time, unrolled
|
||||
}
|
||||
else if (lsb(num_longwords) & 1) == 0 {
|
||||
repeat num_longwords >> 1
|
||||
unroll 2 cx16.VERA_DATA0=0 ; write 2*4 bytes at a time, unrolled
|
||||
}
|
||||
else {
|
||||
repeat num_longwords
|
||||
cx16.VERA_DATA0=0 ; write 4 bytes at a time
|
||||
|
||||
repeat lsb(num_longwords) & 7 {
|
||||
cx16.VERA_DATA0=0 ; write 4 bytes at a time (remaining longs)
|
||||
}
|
||||
|
||||
cx16.VERA_FX_CTRL = 0 ; cache write disable
|
||||
@@ -81,35 +75,41 @@ verafx {
|
||||
cx16.VERA_CTRL = 2<<1 ; dcsel = 2
|
||||
cx16.VERA_FX_MULT = 0
|
||||
cx16.VERA_FX_CTRL = %01100000 ; cache write enable + cache fill enable
|
||||
cx16.r0 = num_longwords
|
||||
|
||||
if (cx16.r0L & 1) == 0 {
|
||||
repeat cx16.r0>>1 {
|
||||
%asm {{
|
||||
lda cx16.VERA_DATA1 ; fill cache with 4 source bytes...
|
||||
cx16.r0 = num_longwords>>1
|
||||
|
||||
if cx16.r0H==0 {
|
||||
repeat cx16.r0L {
|
||||
unroll 2 %asm {{
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
stz cx16.VERA_DATA0 ; write 4 bytes at once.
|
||||
lda cx16.VERA_DATA1 ; fill cache with 4 source bytes...
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
stz cx16.VERA_DATA0 ; write 4 bytes at once.
|
||||
stz cx16.VERA_DATA0
|
||||
}}
|
||||
}
|
||||
} else {
|
||||
repeat cx16.r0 {
|
||||
%asm {{
|
||||
lda cx16.VERA_DATA1 ; fill cache with 4 source bytes...
|
||||
unroll 2 %asm {{
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
stz cx16.VERA_DATA0 ; write 4 bytes at once.
|
||||
lda cx16.VERA_DATA1
|
||||
stz cx16.VERA_DATA0
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
if lsb(num_longwords) & 1 == 1 {
|
||||
%asm {{
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
lda cx16.VERA_DATA1
|
||||
stz cx16.VERA_DATA0
|
||||
}}
|
||||
}
|
||||
|
||||
cx16.VERA_FX_CTRL = 0 ; cache write disable
|
||||
cx16.VERA_CTRL = 0
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class TestCompilerOnExamplesCx16: FunSpec({
|
||||
ExampleSizes("charfade", cx16SizeOptimized=1054, cx16SizeUnoptimized=1371),
|
||||
ExampleSizes("charsets", cx16SizeOptimized=1125, cx16SizeUnoptimized=1417),
|
||||
ExampleSizes("circles", cx16SizeOptimized=2409, cx16SizeUnoptimized=5209),
|
||||
ExampleSizes("cobramk3-gfx", cx16SizeOptimized=7842, cx16SizeUnoptimized=11048),
|
||||
ExampleSizes("cobramk3-gfx", cx16SizeOptimized=7722, cx16SizeUnoptimized=10930),
|
||||
ExampleSizes("colorbars", cx16SizeOptimized=1606, cx16SizeUnoptimized=1904),
|
||||
ExampleSizes("cxlogo", cx16SizeOptimized=599, cx16SizeUnoptimized=895),
|
||||
ExampleSizes("diskspeed", cx16SizeOptimized=6298, cx16SizeUnoptimized=8376),
|
||||
|
||||
@@ -81,7 +81,6 @@ Libraries
|
||||
Optimizations
|
||||
-------------
|
||||
|
||||
- repeat 256 {...} doesn't use STZ on the 65C02 (maybe other repeat values too?)
|
||||
- inliner: extend multi-value return inlining to support parameterized subroutines. Currently only works for parameterless subroutines. (Void calls with parameters already work if the parameters are unused in the body.)
|
||||
- bind types in the Ast much sooner than the simplifiedAst creation, so that we maybe could get rid of InferredType ?
|
||||
- Port more benchmarks from https://thred.github.io/c-bench-64/ to prog8 and see how it stacks up. (see benchmark-c/ directory)
|
||||
|
||||
+9
-21
@@ -1,26 +1,14 @@
|
||||
%import textio
|
||||
|
||||
plane {
|
||||
struct Point {
|
||||
ubyte x
|
||||
ubyte y
|
||||
}
|
||||
}
|
||||
|
||||
txt {
|
||||
%option merge
|
||||
sub print_pt(^^plane.Point p) {
|
||||
txt.chrout('(')
|
||||
txt.print_ub(p.x)
|
||||
txt.chrout(',')
|
||||
txt.print_ub(p.y)
|
||||
txt.chrout(')')
|
||||
}
|
||||
}
|
||||
%import monogfx
|
||||
%import verafx
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
^^plane.Point origin = ^^plane.Point:[0,0]
|
||||
txt.print_pt(origin)
|
||||
monogfx.lores()
|
||||
monogfx.circle(160, 60, 59, true)
|
||||
|
||||
verafx.clear(0, 0, 255, 320*10/8/4)
|
||||
verafx.copy(0,0, 0, 320*120/8, 320*120/8/4)
|
||||
|
||||
repeat {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user