This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/ARM-CGT: Additional Information CODEGEN-1445

Part Number: ARM-CGT


Tool/software: TI C/C++ Compiler

In order that I can better understand the implication of this defect I would appreciate additional information, specifically details of a test case or enough information as to precisely when this defect occurs so I can put a test case together.

  • Use ARM compiler version 16.9.7.LTS.  

    Build this code ...

    #include <stdint.h>
    typedef uint32_t array_t[16];
    #define L 12
    #define M 13
    
    void fxn(array_t array, uint64_t count)
    {
       array[L] = (uint32_t) count;
       array[M] = (uint32_t) (count >> 32);
    }

    ... with this command ...

    % armcl -o4 -s -mv7m3 file.c

    Inspect the resulting file.asm to see these lines ...

    ;** 8   -----------------------    array[12] = count;
    ;** 9   -----------------------    array[13] = count>>32;
    ;**     -----------------------    return;
            .dwpsn  file "file.c",line 8,column 4,is_stmt,isa 1
            STR       A4, [A1, #48]         ; [DPU_3_PIPE] |8|
            .dwpsn  file "file.c",line 9,column 4,is_stmt,isa 1
            MOVS      A2, A3                ; [DPU_3_PIPE] |9|
            STR       A2, [A1, #52]         ; [DPU_3_PIPE] |9|

    This code is not wrong.  But it is better if the last two instructions were replaced with ...

            STR       A3, [A1, #52]

    Thanks and regards,

    -George

  • George,

    Thanks for the response, one related question:

    Will the compiler only insert this unnecessary register copy if optimisation of a particular level is specified (for instance -o4 as in your example), or could the compiler potentially do this even if no optimisation is requested?

    Regards,

    Paulo.

  • PauloP said:
    Will the compiler only insert this unnecessary register copy if optimisation of a particular level is specified

    It only happens at optimization level 4.

    PauloP said:
    could the compiler potentially do this even if no optimisation is requested?

    When no optimization is used (--opt_level=off), the code generated is quite a bit different.  It is both larger and slower.  So, while the compiler does not commit that particular error, it is because the chance to commit that error is entirely avoided.

    Thanks and regards,

    -George