Mercurial > vec
comparison README @ 15:e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
ALSO!! now intrinsics are enabled at runtime, depending on what is
detected. altivec *should* still work but I only tested compiling
it.
the major version has been updated to 2.0 for this...
| author | Paper <paper@tflc.us> |
|---|---|
| date | Wed, 20 Nov 2024 04:10:37 -0500 |
| parents | f12b5dd4e18c |
| children | e26874655738 |
comparison
equal
deleted
inserted
replaced
| 14:981cf0bc7f3a | 15:e05c257c6a23 |
|---|---|
| 1 vec - a tiny SIMD vector header-only library written in C99 | 1 vec - a tiny SIMD vector header-only library written in C99 |
| 2 | 2 |
| 3 it comes with an extremely basic (and somewhat lacking) API, | 3 it comes with an extremely basic API that is similar to other intrinsics |
| 4 where there are eight supported vector types, all 128-bit: | 4 libraries; each type is in the exact same format: |
| 5 | 5 |
| 6 vint8x16 - 16 signed 8-bit integers | 6 v[sign][bits]x[size] |
| 7 vint16x8 - 8 signed 16-bit integers | 7 where `sign' is either nothing (for signed) or `u' (for unsigned), |
| 8 vint32x4 - 4 signed 32-bit integers | 8 `bits' is the bit size of the integer format, |
| 9 vint64x2 - 2 signed 64-bit integers | 9 and `size' is the how many integers are in the vector |
| 10 vuint8x16 - 16 unsigned 8-bit integers | |
| 11 vuint16x8 - 8 unsigned 16-bit integers | |
| 12 vuint32x4 - 4 unsigned 32-bit integers | |
| 13 vuint32x4 - 2 unsigned 64-bit integers | |
| 14 | 10 |
| 15 all of these have many operations that are prefixed with the | 11 vec provides types for 64-bit, 128-bit, 256-bit, and 512-bit SIMD intrinsics |
| 16 name of the type and an underscore, for example: | 12 on processors where vec has an implementation and falls back to array-based |
| 13 implementations where they are not. | |
| 14 | |
| 15 all of these have many operations that are prefixed with the name of the | |
| 16 type and an underscore, for example: | |
| 17 | 17 |
| 18 vint8x16 vint8x16_splat(uint8_t x) | 18 vint8x16 vint8x16_splat(uint8_t x) |
| 19 - creates a vint8x16 where all of the values are filled | 19 - creates a vint8x16 where all of the values are filled |
| 20 with the value of `x' | 20 with the value of `x' |
| 21 | 21 |
| 104 v[u]intAxB cmpge(v[u]intAxB vec1, v[u]intAxB vec2) | 104 v[u]intAxB cmpge(v[u]intAxB vec1, v[u]intAxB vec2) |
| 105 turns on all bits of the corresponding value in | 105 turns on all bits of the corresponding value in |
| 106 the result vector if the value in `vec1' is greater | 106 the result vector if the value in `vec1' is greater |
| 107 than or equal to the corresponding value in `vec2', | 107 than or equal to the corresponding value in `vec2', |
| 108 else all of the bits are turned off. | 108 else all of the bits are turned off. |
| 109 | |
| 110 to initialize vec, you MUST call `vec_init()' when your programs starts up. | |
| 111 | |
| 112 note that `vec_init()' is NOT thread-safe, and things can and will | |
| 113 blow up if you call it simultaneously from different threads (i.e. you | |
| 114 try to only initialize it when you need to... please just initialize | |
| 115 it on startup so you don't have to worry about that!!!) |
