Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10264

Eliminate redundant loads of constants for C2000 with FPU

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Medium Medium

      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.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: