https://www.godbolt.org/z/7zbxnncv6
...maybe one day there will also be a @Matrix builtin.
https://www.godbolt.org/z/v8Ta8hEbv
Zig is exactly the kind of language where you'd want to build a performance-oriented primitive like that, but AFAICT the language doesn't let you do it ergonomically.
@Matrix makes less sense because when it gets big, where are you getting memory from?
vec2..4 and matching matrix types up to 4x4 is basically also what's provided in GPU shading languages as primitive types, and personally I would prefer such a set of "SIMD-y" primitive types for Zig (maybe a bit more luxurious than @Vector, e.g. with things like component swizzling syntax - basically what this Clang extension offers: https://clang.llvm.org/docs/LanguageExtensions.html#vectors-...).
In C++ (EVE, Vc, Highway, xsimd, stdlib), you can specify the ABI of a vector, which allows you to make platform specific optimizations in multifunctions. Or you can write vector code of a lowest-common-denominator width (like 16 bytes, rather than specifying the number of lanes), which runs the same on NEON and SSE2. Or you can write SIMD that is automatically natively optimized for just a single platform. These features are available on every notable C++ SIMD library, and they're basically indispensable for serious performance code.
https://odin-lang.org/docs/overview/#swizzle-operations
Matrix types are also built in:
https://odin-lang.org/docs/overview/#matrix-type
I’ve thought for a little while that Odin could be a secret weapon for game dev and similar pieces of software.
https://github.com/floooh/sokol-odin
It's a very enjoyable language!