-
Enhancement
-
Resolution: Unresolved
-
Medium
-
Code Generation Tools
-
CODEGEN-8693
-
-
C2000_20.2.4.LTS
-
C2000_NEXT
-
default
The attached test case contains two functions. Each one shows one way that optimizing the code can make it slower and larger.
The first one has a small structure with type double members. The code zeros them out ...
ts1.a = 0; ts1.b = 0; ts1.c = 0; ts1.d = 0;
The second one has a very large structure with type float members. The float members are in two groups, more than a data page apart in the structure. The code adds members from different pages together ...
ts2.pageA_a += ts2.pageB_a; ts2.pageA_b += ts2.pageB_b; ts2.pageA_c += ts2.pageB_c;
Build it with optimization disabled ...
% cl2000 --src_interlist --float_support=fpu32 --opt_level=off testcase.c
Inspect the assembly code file testcase.asm to see that f1 has 8 instructions and f2 has 79 instructions.
Build it with optimization level 2 ...
% cl2000 --src_interlist --float_support=fpu32 --opt_level=2 testcase.c
Note that f1 has 11 instructions and f2 has 109 instructions.