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/TMS570LS3137: Strange assembly instruction in the assembler code

Part Number: TMS570LS3137


Tool/software: TI C/C++ Compiler

Hi,

while debugging a problem with TI TMS470 5.1.6 compiler version we had to analyze the assembly code (target arc: mv7R4) as it was creating problems with the code when compiled with opt_level=2 and opt_level=3.

I observed that there is an assembly instruction when opt_level=2 is used which does not have any reference. I could not find any explanation of this instruction.(Note: the assembler code is generated by --keep_asm compiler directive)

It looks like this

;* --------------------------------------------------------------------------*
MOVW V7, var_name+-6 ; [DPU_4_PIPE0]
MOVT V7, var_name+-6 ; [DPU_4_PIPE0]
STRB A1, [V4, #296] ; [DPU_4_PIPE0] |407|
ADD V2, V4, #284 ; [DPU_4_PIPE1]

.....

Notice "+-6" ?? What does that mean? Is it a valid instruction?

The instruction is only present when the code is compiled with the opt_level=2 (with --keep_asm option) and we are observing that the application does not behave as it should. With the opt_level=3, the code behaves as expected that is why we started looking at the assembly. We must figure out what is going wrong at opt_level=2.

Another place in the code where a similar instruction occurs is like this:

MOVW A3, log_msg_len+0 ; [DPU_4_PIPE0] 
MOVS V1, A2, LSR #1 ; [DPU_4_PIPE1] 
MOVWNE V2, log_msg+-2 ; [DPU_4_PIPE0] 
MOVT A3, log_msg_len+0 ; [DPU_4_PIPE1] 
.....
MOV LR, #0 ; [DPU_4_PIPE0] |134| 
MOVTNE V2, log_msg+-2 ; [DPU_4_PIPE1]


Could you please explain what this instruction means?
Compared to opt_level=3, I did not see any such instruction.

BR,
Adnan

  • Hello Muhammad,

    I don't know the answer to your question. I will forward your post to TI CCS/Compiler forum.

  • Please understand this compiler release ...

    Muhammad Adnan said:
    TI TMS470 5.1.6 compiler version

    ... is 6 years old.  It is no longer supported.  I'll try to help.  But, depending on what turns out to be the root cause, there may not be much that can be done.

    Muhammad Adnan said:
    Notice "+-6" ?? What does that mean? Is it a valid instruction?

    It means use the address of var_name-6.  I'm not sure how that happened.  For the source file that generates this assembly code, I'd appreciate if you would follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George