Hey, I have a question regarding the listing and asm files that can be generated in a build. It appears that the assembly code in these files does not exactly match the output, when debugging with code composer. I am using version 4.6.4 of the TI ARM Optimizing C/C++ Compiler and code composer v3.3 to build for an ARM7 target. When debugging with code composer it looks like some move instructions end up becoming add immediate value of 0. Basically, I'm counting on the listing files to be an exact representation of what's happening in assembly code, but this doesn't appear to be the case. Here is the code in question:
Listing snipit C code - Some_Function( arg1, arg2, (val1+val2) );
3806 000007b4 18D2 ADD A3, A3, A4 ; val1 + val2
3807 000007b6 1C29 MOV A2, V2 ; Move arg2 to proper register
3808 $C$DW$376 .dwtag DW_TAG_TI_branch
3809 .dwattr $C$DW$376, DW_AT_low_pc(0x00)
3810 .dwattr $C$DW$376, DW_AT_name("Some_Function")
3811 .dwattr $C$DW$376, DW_AT_TI_call
3812 000007b8 F7FF! BL Some_Function ; Call function
Turns into
ADD R2, R2, R3 ; Updates flags in C code, but not asm (must use ADDS)
ADD R1, R5, #0 ; Uses add immediate 0 for register to register operation
BL Some_Function
As far as I can tell, there are critical differences between these instructions. Namely, the MOV instruction doesn't update the overflow flag (why should it), but the ADD instruction does. I'm confused by this also, since the flags should not be updated unless the S suffix (ADDS) is used. This appears to happen anywhere in C code, but not in assembly. ie. ASM(" ADD R1, R5, #0"); updates flag, the same code in a .asm file doesn't. Note: it doesn't matter whether inline assembly is used or the compiler generates code, the flag updates.
Any help sorting out my confusion here would be greatly appreciated. Are the listing files not an accurate representation of the ASM code generated? Is there something I'm missing about the ARM7 architecture and the ADD/MOV instructions? Is there any reason that flags seem to update unconditionally in C code, but not assembly?