Skip to content

Commit d3e111b

Browse files
gyrovorbisQuzarDC
authored andcommitted
Gainz for dcache_purge_all_with_buffer().
The instruction scheduling for the hot inner loop portion of dcache_purge_all_with_buffer() was suboptimal. I was just able to shave off over a second of total runtime from the SH4ZAM unit test scenario by simply reordering instructions for better superscalar dispatch and by spacing the movca.l and the ocbi further away from one-another.
1 parent 18d052f commit d3e111b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • kernel/arch/dreamcast/kernel

kernel/arch/dreamcast/kernel/cache.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ _dcache_purge_all_with_buffer:
299299
.dpurge_all_buffer_loop:
300300
! Allocate and then invalidate the dcache line
301301
movca.l r0, @r4
302+
cmp/hi r4, r5
302303
ocbi @r4
304+
bt.s .dpurge_all_buffer_loop
303305
add #32, r4 ! Move on to next cache block
304-
cmp/hi r4, r5
305-
bt .dpurge_all_buffer_loop
306306

307307
rts
308308
nop

0 commit comments

Comments
 (0)