public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Can this function be auto vectorized with NEON?
@ 2022-07-22  7:51 Edgar Mobile
  0 siblings, 0 replies; only message in thread
From: Edgar Mobile @ 2022-07-22  7:51 UTC (permalink / raw)
  To: gcc-help

Greetings,

I currently try to have this matrix-vector multiplication function auto-vectorized to Aaarch64 armv8 NEON instructions and a 9.3.0 gcc without success:

https://github.com/g-truc/glm/blob/b3f87720261d623986f164b2a7f6a0a938430271/glm/detail/type_mat4x4.inl#L536
[https://opengraph.githubassets.com/8c183f4120fbe851c5fc8496ce4638436329666708589299a2cdae3043ba4284/g-truc/glm]<https://github.com/g-truc/glm/blob/b3f87720261d623986f164b2a7f6a0a938430271/glm/detail/type_mat4x4.inl#L536>
glm/type_mat4x4.inl at b3f87720261d623986f164b2a7f6a0a938430271 · g-truc/glm<https://github.com/g-truc/glm/blob/b3f87720261d623986f164b2a7f6a0a938430271/glm/detail/type_mat4x4.inl#L536>
OpenGL Mathematics (GLM). Contribute to g-truc/glm development by creating an account on GitHub.
github.com
I also tried replacing it with the explicit version commented out:

return typename mat<4, 4, T, Q>::col_type(
m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0] * v[3],
m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1] * v[3],
m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2] * v[3],
m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3] * v[3]);

I tried -O3 and -ftree-vectorize but it only produces the usual fmadd etc. instructions, no NEON.

Can someone tell me which parameters g++ needs to even consider NEON?

Regards

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-22  7:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22  7:51 Can this function be auto vectorized with NEON? Edgar Mobile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).