开发者

Why do my MIPS crosscompiler works like this for NOT operation?

I setup my crosscompiler for making MIPS instructions.

And it compiles C code well.

but I found a weird thing for NOT operations.

if i mak开发者_如何学Ce code like

   int a;
   func(!a);

and i studied MIPS instructions with text book that says "MIPS converts NOT operation to 'nor with zero'"

So i thought it would converted like

 nor a a $zero

but my compiler converts

xori a a 0x0
sltu a 1

/////////////////////////////////////// i compiled the code with 'myaccount>> mipsel-unknown-linux-gnu-gcc -S myfilename.c' and it makes myfilename.s file..

what am i missing??


You are confusing "not" operations. The "nor with 0" operation is ~a (1's complement), while you wrote !a (which returns 1 if the operand is 0 or 0 otherwise).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜