簡體   English   中英

如何在不使用 LUI 的情況下將 32 位常量加載到寄存器

[英]How to load 32 bit constant to a register without using LUI

我正在嘗試加載一個 32 位常量 0x1234ABCD 以在 MIPS 程序集中注冊$t0 但是,我無法使用lui這樣做。 我的直覺是使用兩個addi ,但我不知道該怎么做。 我必須需要 2 個或更多才能獲得 32 位信息。 我需要在沒有lui的情況下以某種方式設置高位。 在不使用它的情況下復制lui的好方法是什么?

例如,您可以使用orisll結合在 3 條指令中加載 32 位常量,而無需使用lui

  ori $t1, $zero, 0x1234  # load the upper half in the lower bits of $t1
  sll $t1, $t1, 16        # move them to the upper half
  ori $t1, $t1, 0xABCD    # combine with the lower half

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM