执行按位 AND(SPARC 汇编)时重定位溢出?
我试图在寄存器上执行按位 AND,作为位掩码来删除最高有效位(从 0 开始计数时恰好是位 16)。但是,当我尝试使用 gcc 编译代码时,它会给出以下错误消息:
汇编程序消息: 19:错误:重定位溢出
我的猜测是,这与我应用的位掩码的大小有关,因为当我对两个包含小数字的寄存器执行 AND 时,我不会遇到相同的错误。代码本身看起来像,
.global main
main:
save %sp, -96, %sp
clr %l1
clr %l2
set 0xffff, %l0
set 0xaaaa8c01, %l4
set 0xff001234, %l5
set 0x13579bdf, %l6
set 0xc8b4ae32, %l7
srl %l4, 31, %l1
srl %l0, 15, %l2
xor %l1, %l2, %l1
and %l1, 0x1, %l1
sll %l0, 1, %l0
add %l0, %l1, %l0
and %l0, 0xffff, %l0
mov 1, %g1
ta 0
如果有人能够提供一些关于如何解决这个问题的见解,我们将非常感激。
谢谢,
坏熊猫
I am trying to perform a bitwise AND on a register, as a bitmask to remove the most significant bit (which happens to be bit 16 when counting from 0). However, when I try to compile my code using gcc, it gives me the following error messages:
Assembler messages:
19: Error: relocation overflow
My guess is that this has something to do with the size of the bit mask I am applying, because when I perform the AND with two registers containing small numbers I don't encounter the same error. The code itself looks like,
.global main
main:
save %sp, -96, %sp
clr %l1
clr %l2
set 0xffff, %l0
set 0xaaaa8c01, %l4
set 0xff001234, %l5
set 0x13579bdf, %l6
set 0xc8b4ae32, %l7
srl %l4, 31, %l1
srl %l0, 15, %l2
xor %l1, %l2, %l1
and %l1, 0x1, %l1
sll %l0, 1, %l0
add %l0, %l1, %l0
and %l0, 0xffff, %l0
mov 1, %g1
ta 0
If anyone could offer some insight on how to solve this problem it would be very much appreciated.
Thanks,
badPanda
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最高有效位是位 15(在 16 位整数中,当位从零开始时)。
The most significant bit is bit 15 (in a 16-bit integer, when bits are zero based).