From 285aa1b0a633616bfb3b289535a60786390e4d59 Mon Sep 17 00:00:00 2001 From: Greg White Date: Tue, 16 Jan 2007 20:38:25 +0000 Subject: Unroll loops git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12029 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c | 87 +++++++++++++++++++++--- 1 file changed, 77 insertions(+), 10 deletions(-) (limited to 'firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c') diff --git a/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c index 8094ff828f..615b04a26c 100644 --- a/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c @@ -95,6 +95,27 @@ void invalidate_dcache_range(const void *base, unsigned int size) { "mcr p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ "add %0, %0, #32 \n" "cmp %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" + "mcrne p15, 0, %0, c7, c14, 1 \n" /* Clean and invalidate this line */ + "addne %0, %0, #32 \n" + "cmpne %0, %1 \n" "bne inv_start \n" "mov %0, #0\n" "mcr p15,0,%0,c7,c10,4\n" /* Drain write buffer */ @@ -112,6 +133,27 @@ void clean_dcache_range(const void *base, unsigned int size) { "mcr p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ "add %0, %0, #32 \n" "cmp %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" + "mcrlo p15, 0, %0, c7, c10, 1 \n" /* Clean this line */ + "addlo %0, %0, #32 \n" + "cmplo %0, %1 \n" "blo clean_start \n" "mov %0, #0\n" "mcr p15,0,%0,c7,c10,4 \n" /* Drain write buffer */ @@ -143,16 +185,41 @@ void dump_dcache_range(const void *base, unsigned int size) { /* Cleans entire DCache */ void clean_dcache(void) { - unsigned int seg, index, addr; - - /* @@@ This is straight from the manual. It needs to be optimized. */ - for(seg = 0; seg <= 7; seg++) { - for(index = 0; index <= 63; index++) { - addr = (seg << 5) | (index << 26); - asm volatile( - "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ - : : "r" (addr)); - } + unsigned int index, addr; + + for(index = 0; index <= 63; index++) { + addr = (0 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (1 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (2 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (3 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (4 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (5 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (6 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); + addr = (7 << 5) | (index << 26); + asm volatile( + "mcr p15, 0, %0, c7, c10, 2 \n" /* Clean this entry by index */ + : : "r" (addr)); } } -- cgit v1.2.3