Optimizing Mips for cache misses
I am trying to optimize / fix sieve of Eratosthenes algorithm to minimize cache misses. currently I have stopped most of them but I am having trouble on a specific loop. For some reason on the save word command it gets a cache miss, I have tried changing to store byte but that creates interesting results, I guess I am having some trouble figuring out why its causing the miss so its making it difficult to fix it.
inner: add $t2, $s2, 0 # save the bottom of stack address to $t2 sll $t3, $t1, 2 # calculate the number of bytes to jump over sub $t2, $t2, $t3 # subtract them from bottom of stack address add $t2, $t2, 8 # add 2 words - we started counting at 2! sw $s0, 0($t2) # store 0's -> it's not a prime number! add $t1, $t1, $t0 # do this for every multiple of $t0
Full code can be found here http://www.marcell-dietl.de/downloads/eratosthenes.s