simulink c/c++ code generator use multimedia functions for optimizing execution (such as _mm_loadu_pd etc.), how to avoid it ad generate sugar & cannella code?
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
if the dimension of the vectors on opearting variables is even, the simulink c/c++ code generator uses the multi media functions _mm_loadu_pd
_mm_mul_pd _mm_add_pd, _mm_storeu_pd, etc. Apparently pairs of two successive values in the vector are stored in an unique register of 64 bits ad operated together.
It is annoing to rewrite the code avoiding those functions.
Which option on the code generation force to not use those functions, and generate plain code?
Giuseppe
0 comentarios
Respuestas (1)
Aiswarya
el 18 de Oct. de 2023
Hi,
I understand that you want to prevent the Simulink C/C++ coder from automatically generating functions like _mm_loadu_pd for optimizing execution, and instead generate plain code. The functions that you observed in your code, which starts with _mm are basically SIMD instructions (https://www.mathworks.com/help/rtw/ug/generate-simd-code-from-simulink-blocks.html?searchHighlight=disable%20simd&s_tid=srchtitle_support_results_1_disable%2520simd ). They are generated to speed up the execution time, by vectorization, and use SSE2 instruction set.
To disable generation of SIMD code and obtain plain code instead, follow these steps : In the Modelling Toolbar in Simulink , go to Model Settings. This opens up the Configuration Parameters window. Navigate to Code Generation > Optimization > Target specific optimizations. In the Leverage target hardware instruction set extensions option, choose None in the drop down list. By default it is SSE2. On generating code with these settings, you can obtain plain code without SIMD instructions.
The image below shows the corresponding option in the Configuration Parameters window:
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!