I'm learning assembler and I've found this instruction
ADD R0, R0, R0, LSL #1
I know that it multiplies by 3 the contents of R0 but I don't understand how it works (I don't know what LSL does in this case).
Thank you for your time
I'm learning assembler and I've found this instruction
ADD R0, R0, R0, LSL #1
I know that it multiplies by 3 the contents of R0 but I don't understand how it works (I don't know what LSL does in this case).
Thank you for your time
LSL is a left shift operation which is performed by barrel shifter. Barrel shifter is a hardware provided in arm architecture and it is used to combine such operation to increase code density and execution speed.
For example in this case if addition and shifting (first left shift and then addition) is performed by two instruction then it will decrease the code density ( one extra instruction) and also on extra instruction to execute.
In this instruction both the operations are performed in same cycle.