Compiler generates unaligned access instructions on a TS203

Hello all,

I'm working on a hardware that uses 2 TigerSHARC TS203 revision 2.0. The IDE is the version 5.0 update 10 of Visual DSP++ running on a Windows Vista PC. Optimization settings are at 100% (maximum speed).

Sometimes the optimiser chooses to generate an assembly instruction that accesses 2 adjacent variables (usually members of a C++ class instance) with one single instruction which looks like:

     XR3:2 = L[J3+0];

where J3 contains - I presume - the address of the lowest address word. In some occasion this address is odd (though the address of the C++ object instance is actually aligned on a 4 words boundary). When this instruction is executed the PC jumps to the SIGSEGV handler (sw_handler indeed). It appears that this handler implements the 2 words access and returns to the calling code silently. The drawback however is that it uses a large number of CPU cycles (some hundreds) which is something I cannot afford in the context this code is running in.

Does anyone know about a way to prevent the compiler to generate such instructions?

Thanks.

  • 0
    •  Analog Employees 
    on Mar 20, 2012 11:03 AM

    Hi,

    There isn't any way to tell the compiler to avoid generating such instructions, but simple tests show that the compiler only generates double word loads when it's sure that the data being accessed is aligned on a double word boundary. That would suggest that you *might* be hitting a compiler bug. Is it possible for you to post or send an example that shows the problem, so that we can investigate further? It's most helpful if you can provide:

    - a preprocessed source file, so that we can compile the example, plus the assembly file that is generated

    - a note of the project settings. For example, are you using 8-bit chars or optimization? Are you optimizing for space or speed?

    - the output produced when you add "-v" to the compiler options

    If you're unable or unwilling to post these on a public forum, you can submit a problem report to ADI.

    Kenny

  • 0
    •  Analog Employees 
    on Aug 2, 2018 4:34 PM
    This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin