Electronic – RSBMI instruction in ARM

armassembly

as an exercise problem in ARM assembly program, I had to convert a number x to its absolute value. now seeing the problem as a simple problem of removing the sign of the respective number, I used BIC instruction to clear the MSB sign bit. later on I found out that RSBMI instruction is present in ARM to compute the absolute value of any number.

my query is that what is the difference between these two methods employed, does BIC and RSBMI present any different result in some cases? or if it can be done by just BIC then why add an RSBMI in RISC instruction set?

Best Answer

I had to convert a number x to its absolute value. now seeing the problem as a simple problem of removing the sign of the respective number

Which yields wrong results, of course. Example (in 8 Bit): -1 = 0xFF, sign bit set to zero: 0x7F => +127 instead of +1.

Related Topic