Qualcomm Hexagon Inline Assembly

472 Views Asked by At

I am new to QC Hexagon and I need to optimise lots of loops of a C code. I installed the Hexagon tools and had a look at the manual. My general question is:

Do I need to write inline assembly code or can I use the Hexagon intrinsics simply in the C code? Is there anything special needed to optimise the for loop itself, i.e. the loop counter etc.? Or can I simply write the definition of the for-loop and execute Hexagon intrinsics inside?

I inline assembly code is required, where do I find a good manual how to write such code? I only find excerpts of code, but no real manual on how to write it.

1

There are 1 best solutions below

4
On

Do I need to write inline assembly code or can I use the Hexagon intrinsics simply in the C code? Is there anything special needed to optimise the for loop itself, i.e. the loop counter etc.? Or can I simply write the definition of the for-loop and execute Hexagon intrinsics inside?

If you're just starting out, you should probably consider using the intrinsics before jumping into assembly. Either way, the PRM is a great starting point -- for example, the v66 PRM.

You absolutely can use intrinsics inside a C/C++ for loop. The compiler is responsible for bundling the instructions into packets and optimizing the instructions specified by the intrinsics.