Operands of ARM SUB instruction

I work with the llvm-clang compiler, compiling simple C functions up to build on an ARMv7-A processor. I am trying to understand what this instruction does.

SUB sp, sp, #65, 30

Obviously, it puts a stack pointer for some local variables, but I have never seen an ARM SUB instruction with four operands. I guess 30 changes # 65 somehow, but I don't know how, and I couldn't find the details in the ARM Architecture Reference Guide. Any suggestions?

For the curious, this is at the beginning of the program, which creates an 8 x 8 unit matrix of integers, so I expect sp to make room for at least 8 x 8 x 4 bytes on the stack.

+3
source share
3 answers

30 - 65

30 2 , 4. 65 * 4 = 260

, 260 .

+7

12 , 8 4 - ( 0 2 4 ..). 260 8 , 65 * 4.

, 32- , 0 4095

+4

ARM , 8- + 4- ROR -. 1 1 ROR 0, 4 ROR 2, 16 ROR 4 ..

Decoding to this format allows you to uniquely specify the encoding of commands and allows you to reassemble the exact instruction. It may be important to build a bitwise identical binary.

+1
source

Source: https://habr.com/ru/post/1754866/


All Articles