I have written one code in the assembly language for mixing C and assembly. The compiler is not properly generating the code for one instruction. I have written the following code,
LDR r0,[pc, #74]
here I want to load a word value from the PC+offset. Here I want the 16 bit LDR instruction should be used by the compiler. But compiler is taking LDR.W instruction, which is general instruction for +/- offset and which is 32 bit. But I want to instruct the compiler for the usage of the 16 bit instructions, how to do this? Also if I want to use the LDR.W instruction I will write the same, but why the compiler is generating a different instruction, although syntax of both instruction is different?
John, basically my question was different and you have added a different context. I wasn't discussing about the register usage. Although the references given by you are correct, keil has provided another way to use the registers in the code. The details of it are present at following path, www.keil.com/.../armcc_chr1359125006491.htm Also if you can give information about the abnormal behavior of compiler, it will be beneficial.
You need to read the documentation