nimble install nimsimd
This repo provides pleasant Nim bindings for various SIMD instructions.
Each SIMD instruction set is in its own file for importing.
This repo is under development. Check back here for the latest status.
Instruction Set | Bindings |
---|---|
SSE | ✅ |
SSE2 | ✅ |
SSE3 | ✅ |
SSSE3 | ✅ |
SSE4.1 | ✅ |
SSE4.2 | ✅ |
AVX | ✅ |
AVX2 | ✅ |
PCLMULQDQ | ✅ |
Some instruction sets require additional compiler flags to compile. I suggest
putting any code that uses these instructions into its own .nim file and adding a localPassc
pragma to the top of that file as needed, such as:
import nimsimd/sse42
when defined(gcc) or defined(clang):
{.localPassc: "-msse4.2".}
...
You can also check if instruction sets are available at runtime:
import nimsimd/runtimecheck
echo checkInstructionSets({SSE41, PCLMULQDQ})
NEON bindings are started but experimental. Much to learn here about versioning and compilers.
nimble test