Dear all, I am using the Keil 5.23 and running simulation for the STM32F103ZE
I am using optimization Level 0 (-O0)
In C, I have declared two variables i j i = 0x12345678 j = 0x87654321
then I have 2 instructions in C
dummy = i + j;
dummy = i - j;
When I switch to Disassembly and looking to the disassembly code,
the register value
R2 = 0x12345678; R3 = 0x87654321; before executing the ADD r2,r2,r3 the XPSR shows
N = 1, Z = 0, C = 1, V = 0, Q = 0, T = 1; After the ADD instruction, results remains the same.. However, from the addition, there should be NO Carry after the addition, why the status of the xPSR not updated ?
It would be grateful if I can get any help on that.. Thanks, Yours FOX
Dear Nevil,
My apology to you if the word testing offended you in any case.
I agreed with you that
Rather than trying to persuade the compiler to do what you want, you should really understand what the compiler is permitted to do.
and that's why I said before I will solve the problem using assembly language
But at the same time with what the complier output, I can explore if there are any alternatives rather than directly using assembly language that can achieve my goal. May be I can use conducting experiments if you think testing is not a good word.
Thanks for John that he gave me some insights and I can work on it.
As what you said, if it is what compiler permitted to use, I cannot see any fault here and because it is no fault, I will not expect any update on it. But still, the compiler is free to use whatever instructions it wants, what I can do it adapting with the compiler output.
Thanks. Yours WU, Chi Hang