signed char ch;
short int a = 220;
I have return the above c program to assign a short int to a signed char as below.
ch = a; //assigning short int to signed char variable ch;
Below is the assembly code generated for the assignment statement.
MOV R2, R6, LSL 24 R6 contain a which is 220
MOV R0, R0
MOV R2, R2, ASR 24
STRB R2,[SP,3]
I have understood that R6 is Left shifted by 24 bit and Aritmetic right shift by 24 bit to get the signed byte value which is stored in the stack.
But i don't understood why a NOP kind of instruction is generated in between the two MOV operaation.
Generally NOP instruction is used to introduce some delay in programming to wait until some operation has completed.
But here why MOV R0,R0 is generated what is the significance?
Please some one clarify.