0

I would like perform SIMD operations, e.g., on a MAC-loop with Hexagon. While there are intrinsics on e.g. multiply-accumulate vector data, I don't find any C-intrinsics on vector memory loads and stores.

Are there any or do I need to write asm code to do so?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Dario Da
  • 37
  • 5
  • Looks like you just cast and deref a pointer, as in : [Enabling HVX in Hexagon DSP by using instruction intrinsics](https://stackoverflow.com/a/49447950) – Peter Cordes Sep 06 '21 at 09:06
  • Thanks. But how do I then increment this pointer and load new values? It seems to me that there are no C-intrinsics for memory loads and stores, and, there is no intrinsic for data alignment, right? – Dario Da Sep 06 '21 at 10:33
  • I don't know HVX; does it even have two kinds of load instructions (alignment required vs. unaligned like x86 `movdqu` vs. `movdqa`)? If not, deref of a vector-pointer can express everything that's possible in asm. As for how to increment a pointer, C supports pointer math in general, on `char*`, `int*` or whatever type you want, and you can cast the result to a vector pointer. So `*(vec_ptr*)(charptr + 64)` or `*(1 + (vec_ptr*)p)`. Same as for pointer math with SSE or NEON intrinsics. – Peter Cordes Sep 06 '21 at 10:43

0 Answers0