SA
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.
SA
Ramy Essam,
1 is simple C. This allows the Optimizing Compiler to have full control over the selection of instructions and registers and the optimization of both.
2 is the more advanced use of intrinsics in C. _mvd is an intrinsic which tells the compiler exactly which instruction to use. This intrinsic is described in the Optimizing Compiler User's Guide, where it tells you the instruction that is tells the compiler to use. For more information on that instruction, please see the CPU & Instruction Set Reference Guide for the CPU architecture you are using.
For int a, b; both C lines will result in the same logical functionality.
Regards,
RandyP
If you need more help, please reply back. If this answers the question, please click Verify Answer , below.
Ramy Essam,
I cannot think of a situation where the _mvd intrinsic would be good to use in C code.
Ramy Essam said:Which one is faster? (less number of machine cycles)
You are comparing a simple C statement with another simple C statement that includes a specific instruction for the compiler to use. It is not logical to compare the speed of these two C statements with no other context.
If you want to understand the execution behavior of the C64x+ instruction set, please read the CPU & Instruction Set Reference Guide, spru732.. And please be aware that this is a complex Instruction Set Architecture. For now, I recommend against that, however.
Your best plan is to write all of your code in C and use the Optimizing C Compiler's capabilities to improve your code. Use the Debug Build Configuration while debugging your application functionally. Then use the Release Build Configuration to turn on optimization and build your final system. Use measurements of the operation of these to determine how much additional work, if any, needs to go into the process of further optimization. Only then would you need to consider the use of intrinsics, and you would not be comparing the two statements that you have presented here.
Please check out the training information available on the TI Wiki Pages. Search for C6000 Workshop, and start with the C6000 Embedded Design Workshop Using BIOS and after understanding the basics from there you might find value in the TMS320C6000 DSP Optimization Workshop.
I hope I have addressed your question, although I did not answer it. I also hope that I have given you sufficient information to help you move forward.
Regards,
RandyP
If you need more help, please reply back. If this answers the question, please click Verify Answer , below.