[EXT_EP-10264] Eliminate redundant loads of constants for C2000 with FPU Created: 11/Mar/21 Updated: 27/Mar/25 |
|
| Status: | Planned |
| Project: | Embedded Software & Tools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Medium |
| Reporter: | TI User | Assignee: | TI User |
| Resolution: | Unresolved | Votes: | 0 |
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Product: | Code Generation Tools |
| Internal ID: | CODEGEN-8693 |
| Forum URL: | https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/984910/tms320f280049-strange-optimized-code-output---much-slower-than-no-optimization |
| Found In Release: | C2000_20.2.4.LTS |
| Fix In Release: | C2000_NEXT |
| Affected Platform/Device: | default |
| Description |
|
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. |