针对缓存未命中优化Mips

时间:2013-12-09 18:57:02

标签: caching assembly project mips

我正在尝试优化/修复Eratosthenes算法筛,以最大限度地减少缓存未命中。目前我已经停止了大部分但是我在特定循环上遇到了麻烦。出于某种原因,在保存字命令上它会获得缓存未命中,我已经尝试更改为存储字节,但这会产生有趣的结果,我想我在找出导致错误的原因时遇到了一些麻烦,因此难以修复它。

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

可在此处找到完整代码http://www.marcell-dietl.de/downloads/eratosthenes.s

0 个答案:

没有答案