[英]Mips and cisc assembly langue
does anyone have a simple program with source code run in both assembly langue mips and cisc to explan mips run with less cpu cycle than cisc ? 有没有人有一个简单的程序,其源代码在汇编语言mips和cisc中运行,以解释mips的运行时间比cisc小?
simple program do not require large one 简单的程序不需要大一个
thank you 谢谢
A simple example would be the comparing two strings against each others: 一个简单的例子是将两个字符串相互比较:
MIPS MIPS
; string pointers in $a0 and $a1
more:
ld $r0,($a0)
ld $r1,($a1)
add 1, $a0
add 1, $a1
cmp $r0,$0
je eos
cmp $r1,$0
je eos
cmp $r0,$r1
je more
eos:
cmp $r0, $r1
; cmp result defines whether a0 < a1, a0 == a1, a0 > a1
CISC (Intel) CISC(英特尔)
; start with strings in edi and esi
more:
cmps (edi), (esi)
loopnz more
; cmps result defines whether a0 < a1, a0 == a1, a0 > a1
I do not guarantee the validity of this code. 我不保证此代码的有效性。 However, we can see that the CISC does the same thing as the MIPS in 2 instructions (although initialization may require more code in CISC...).
但是,我们可以看到CISC在2条指令中与MIPS的作用相同(尽管初始化可能需要CISC中的更多代码...)。 However, they are likely taking about the same amount of time.
但是,它们可能花费大约相同的时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.