有什么用ori和阿迪初始化在MIPS值之间的差异? [英] What's the difference between using ori and addi to initialize a value in MIPS?

查看:590
本文介绍了有什么用ori和阿迪初始化在MIPS值之间的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想存储在MIPS的地址的值,比如在$ A0值3,我通常只用阿迪$ A0,$ 0 3.有时我的人做到这一点使用ORI A0,$ 0,3见。 这个比那个好吗?有什么区别?

When I want to store a value in an address in MIPS, say the value 3 in $a0, I usually just use addi $a0, $0, 3. Sometimes I see people do this using ori $a0, $0, 3. Is one better than the other? What's the difference?

推荐答案

有一些细微的差异之二:

There are some subtle differences between the two:

ADDI


  • 登录 -extends眼前。

  • 可导致整数溢出异常(可通过避免 ADDIU 来代替)。

  • Sign-extends the immediate.
  • Can result in integer overflow exceptions (can be avoided by using ADDIU instead).

ORI


  • -extends眼前。

  • 不容易受到整数溢出。

  • Zero-extends the immediate.
  • Not susceptible to integer overflow.

这篇关于有什么用ori和阿迪初始化在MIPS值之间的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆