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.

TMS570LC4357: Compiler 5.2.2 optimization illegal operand error

Part Number: TMS570LC4357

I am compiling a source file with Interprocedure Optimizations. The compiler is failing to assemble with the following errors

1259 00000c98 E04CC000 SUB V9, V9, D0, LSR #1 ; [DPU_4_PIPE0] |106|
"C:\Users\Txxx\AppData\Local\Temp\1874410", ERROR! at line 1259: [E0001] Undefined symbol
"C:\Users\Txxx\AppData\Local\Temp\1874410", ERROR! at line 1259: [E0003] Unexpected trailing operand(s)
"C:\Users\Txxx\AppData\Local\Temp\1874410", ERROR! at line 1259: [E0004] Illegal operand

The compiler version is ti-cgt-arm_5.2.2 with options

-mv7R5 --code_state=32 --float_support=VFPv3D16 --abi=eabi -O2 --opt_for_speed=5 --symdebug:none --c99 --strict_ansi --define=_INLINE --define=RELEASE --define=_INTERRUPT_CONTROL_ --define=_TMS570LC43x_ --define=DWD_ENABLE --define=ALL_COV_OFF --define=_VFP_SUPPORT_=1 --define=ALG2 --define=CAL_ONLY --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --display_error_number --diag_warning=225 --diag_wrap=off --enum_type=packed --asm_listing --preproc_with_compile 

  • The optimizer is unable to successfully compile the following function:

    static inline float32_t FastInvSqrtf( float32_t aValue );
    static inline float32_t FastInvSqrtf( float32_t aValue )
    {
    /*
    * Precondition analysis: This condition is not explicitely checked because
    * this function must operate in a very high speed loop, 60 kHz sample per
    * 8 channel rate and the throughput hit would not be acceptable.
    */

    const float32_t X_HALF = 0.5F * aValue;

    /* Initial Guess */
    typedef union F32U32_u
    {
    uint32_t asU32;
    float32_t asF32;
    } F32U32_t;

    F32U32_t xUnion; /*lint !e9018 [MISRA 2012 Rule 19.2, advisory] Declaration of union is ok in this context */
    xUnion.asF32 = aValue;

    const uint32_t I = xUnion.asU32;
    xUnion.asU32 = ( 0x5F375A86U - ( I >> 1U ) );
    float32_t x = xUnion.asF32;

    /* Two Iterations of Newton's Approximation */
    x = x * ( 1.5F - ( ( X_HALF * x ) * x ) );
    x = x * ( 1.5F - ( ( X_HALF * x ) * x ) );
    return x;
    }

    it fails on the xUnion.asU32 = ( 0x5F375A86U - ( I >> 1U ) ) lne

  • I compiled your code with TI ARM compiler: TI v16.9.11.LTS and TI v20.2.6.LTS, and I didn't see the issue.

    Please check if the TEMP and TMP environment variables are defined.

  • The compiler version is ti-cgt-arm_5.2.2 with options

    With CCS 11.2 under Linux I pasted your code into a project, and tried compiling using your optimisation settings with different versions of the TI ARM compiler. The results are:

    TI ARM compiler version Result
    ti-cgt-arm_5.2.2 5 Assembly Errors, No Assembly Warnings
    ti-cgt-arm_5.2.9 5 Assembly Errors, No Assembly Warnings
    ti-cgt-arm_15.9.0.STS 5 Assembly Errors, No Assembly Warnings
    ti-cgt-arm_15.12.7.LTS No compiler errors or warnings

    For reference the example project is attached.

    Are you able to change to a later compiler version to resolve the error?

    I started with 5.2.2, and after re-creating the error just advanced the compiler version to try and find the first compiler version which no longer reported the error.

    TMS570LC4357_inter_procedural_error.zip