Noob compiler question. type-punning (via cast) a primitive array (say 64-bit integers) to a SIMD array is technically illegal (strict aliasing) but it's also (seemingly) ubiquitous. Do any of the main compilers (clang/gcc/vc) have a stance on this?
=> More informations about this toot | More toots from mbr@mastodon.gamedev.place
@mbr direct access through the casted pointer, or shoving it into a load/store intrinsic?
A compiler that breaks the load/store intrinsics is straight up trolling.
Direct access.. who knows. Not very interesting IMO since it has another big problem: you cannot portably mark direct access as unaligned.
=> More informations about this toot | More toots from harold@mastodon.gamedev.place
@harold @mbr you can make a typedef of a vector type with reduced alignment: https://godbolt.org/z/9fh5Wqh6h
=> More informations about this toot | More toots from amonakov@mastodon.gamedev.place
@amonakov @mbr yes but not portably
=> More informations about this toot | More toots from harold@mastodon.gamedev.place
@harold @mbr I'm not sure what you're implying? We do not have portable vector types in the first place. If this is about immintrin.h intrinsics on MSVC, from what I see you cannot even write vec1 + vec2, and the point of using C-style access when you need to write out all computations via intrinsics escapes me.
=> More informations about this toot | More toots from amonakov@mastodon.gamedev.place
@amonakov @mbr Isn't the thing we're talking about here, writing *(__m128i*)&something
(direct access) or _mm_load(u)_si128((__m128i*)&something)
?
Sure, doing it the first way isn't particularly of any use, since you could just do it the second way. But that first is somewhat used in practice too. And at least it can be talked about in a hypothetical sense
=> More informations about this toot | More toots from harold@mastodon.gamedev.place
@harold @mbr ah, fair — thanks
=> More informations about this toot | More toots from amonakov@mastodon.gamedev.place This content has been proxied by September (3851b).Proxy Information
text/gemini