We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello
I'm using: mcb32stmf103rb6t The uvision3 V3.62c Realview MDK-ARM Version 3.23
In my program i need to multiply a series of 32bit ints. Very simple code:
int test1 = 0x01002000; int test2 = 0x03004000; test1 = test2*test1;
When i compile it and view the disassembly in debug mode is says: 129: int test1 = 0x01002000; 0x08004788 4D3F LDR r5,[pc,#252] 130: int test2 = 0x03004000; 131: 0x0800478A 4C40 LDR r4,[pc,#256] 132: test1 = test2*test1; 133: 0x0800478C 4365 MULS r5,r4,r5
The question then is: Why does it use "MULS" when the instruction does not exits in the cortex-m3? And why does it choose an instruction where the MSB are thrown away when when I need the MSB?
An explanation will be very much appreciated Regards Henrik
Yup, I have chosen the target to be the mcb32stmf103rb, and the cortex - M3, according to the technical reference does have that instruction.
I tried typecasting with "long long" which is 64bit, same result. The LSB are put into the register instead of the MSB.
However, the main concern is the MULS. I might be mistaken when i say that the instruction does not exists, but I have checked several referances and I am fairly certain. Is there an explanation?
Thank you for your time Regards Henrik Rasmussen