I am trying to map source code to object code. I am creating new constructs, building these constructs in Code Composer for Different code Optimization levels and comparing them with the source code.
The issue I am facing is, when the DSP generated the assembly code, it has inserted a couple of OR Statements for Optimization Level 2 which is hard to understand given that there are no OR statements in the construct. Appreciate any help on this. I have added Construct and 2 dissasembly files below. Thank you.
Here is how my construct looks like
void Construct157_While_If(Int32 param157_input1, Int32 param157_input2)
{
Int32 var157_local1 = NUM_ZERO ;
Int32 var157_local2 = NUM_ZERO ;
var157_local1 = param157_input1 ;
var157_local2 = param157_input2 ;
while( (!var157_local1) && (var157_local2 == NUM_ZERO ))
{
if(var157_local2 == NUM_ONE)
{
var157_local2++;
var157_local1++;
}
}
}
Here is how the dissasembly looks like for Optimization OFF
TEXT Section .text (Little Endian), 0x60 bytes at 0x0
00000000 _Construct157_While_If__FiT1:
00000000 .text:
00000000 8cf7 SUBAW.D2 B15,0x4,B15
00000002 7246 MV.L1X B4,A3
00000004 ac45 || STW.D2T1 A4,*B15[1]
00000006 cc35 STW.D2T1 A3,*B15[2]
00000008 0627 MVK.L2 0,B4
0000000a fc45 STW.D2T2 B4,*B15[3]
0000000c 9cc5 STW.D2T2 B4,*B15[4]
0000000e 9247 MV.L2X A4,B4
00000010 fc45 STW.D2T2 B4,*B15[3]
00000012 91c7 MV.L2X A3,B4
00000014 9cc5 STW.D2T2 B4,*B15[4]
00000016 3247 MV.L2X A4,B1
00000018 40288120 [ B1] BNOP.S1 $C$L3 (PC+80 = 0x00000050),4
0000001c e7e00002 .fphead n, l, W, BU, nobr, nosat, 0111111b
00000020 00100fda MV.L2 B4,B0
00000024 2018a120 [ B0] BNOP.S1 $C$L3 (PC+48 = 0x00000050),5
00000028 $C$L1:
00000028 $C$DW$L$_Construct157_While_If__FiT1$3$B:
00000028 804f MV.S2 B0,B4
0000002a 2027 || CMPEQ.L2 1,B0,B0
0000002c 300da120 [!B0] BNOP.S1 $C$DW$L$_Construct157_While_If__FiT1$4$E (PC+26 = 0x0000003a),5
00000030 $C$DW$L$_Construct157_While_If__FiT1$3$E:
00000030 $C$DW$L$_Construct157_While_If__FiT1$4$B:
00000030 2641 ADD.L2 B4,1,B4
00000032 9cc5 STW.D2T2 B4,*B15[4]
00000034 fc4d LDW.D2T2 *B15[3],B4
00000036 2641 ADD.L2 B4,1,B4
00000038 fc45 STW.D2T2 B4,*B15[3]
0000003a $C$DW$L$_Construct157_While_If__FiT1$4$E:
0000003a $C$L2:
0000003a $C$DW$L$_Construct157_While_If__FiT1$5$B:
0000003a fc0d LDW.D2T2 *B15[3],B0
0000003c ee900010 .fphead p, l, W, BU, nobr, nosat, 1110100b
00000040 2004a120 [ B0] BNOP.S1 $C$L3 (PC+16 = 0x00000050),5
00000044 $C$DW$L$_Construct157_While_If__FiT1$5$E:
00000044 $C$DW$L$_Construct157_While_If__FiT1$6$B:
00000044 003c82e6 LDW.D2T2 *+B15[4],B0
00000048 00006000 NOP 4
0000004c 3ffaa120 [!B0] BNOP.S1 $C$L1 (PC-24 = 0x00000028),5
00000050 $C$L3:
00000050 $C$DW$L$_Construct157_While_If__FiT1$6$E:
00000050 07800852 ADDK.S2 16,B15
00000054 008ca362 BNOP.S2 B3,5
00000058 00000000 NOP
0000005c 00000000 NOP
Here is how the dissasembly for Optimization Level 2 looks like
TEXT Section .text (Little Endian), 0x40 bytes at 0x0
00000000 _Construct157_While_If__FiT1:
00000000 .text:
00000000 9628 OR.L1X A4,B4,A0
00000002 6866 [!A0] MVK.L1 1,A0
00000004 c01aa120 || [ A0] BNOP.S1 $C$DW$L$_Construct157_While_If__FiT1$3$E (PC+52 = 0x00000034),5
00000008 $C$L1:
00000008 c083e001 [ A0] SPLOOPW 2
0000000c a247 || MV.L2 B4,B5
0000000e $C$L2:
0000000e $C$DW$L$_Construct157_While_If__FiT1$3$B:
0000000e 2e66 SPMASK S2
00000010 924f ||^ MV.S2X A4,B4
00000012 2aa7 || CMPEQ.L2 1,B5,B1
00000014 4210205b [ B1] ADD.L2 1,B4,B4
00000018 4280012a || [ B1] MVK.S2 0x0002,B5
0000001c e3200182 .fphead n, l, W, BU, nobr, nosat, 0011001b
00000020 0010a6e2 OR.S2 B5,B4,B0
00000024 2000a358 [ B0] MVK.L1 0,A0
00000028 00002000 NOP 2
0000002c 00000000 NOP
00000030 00034000 SPKERNEL 0,0
00000034 $C$DW$L$_Construct157_While_If__FiT1$3$E:
User contributions licensed under CC BY-SA 3.0