annotate README @ 1:1d9d2308c1d2

*: fixup formatting ew
author Paper <paper@tflc.us>
date Tue, 22 Oct 2024 01:28:48 -0400
parents 02a517e4c492
children f12b5dd4e18c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 vec - a tiny SIMD vector header-only library written in C99
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3 it comes with an extremely basic (and somewhat lacking) API,
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 where there are eight supported vector types, all 128-bit:
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
6 vint8x16 - 16 signed 8-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
7 vint16x8 - 8 signed 16-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 vint32x4 - 4 signed 32-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9 vint64x2 - 2 signed 64-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
10 vuint8x16 - 16 unsigned 8-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
11 vuint16x8 - 8 unsigned 16-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
12 vuint32x4 - 4 unsigned 32-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
13 vuint32x4 - 2 unsigned 64-bit integers
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
14
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
15 all of these have many operations that are prefixed with the
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
16 name of the type and an underscore, for example:
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
17
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
18 vint8x16 vint8x16_splat(uint8_t x)
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
19 - creates a vint8x16 where all of the values are filled
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
20 with the value of `x'
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
21
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
22 the current supported operations are:
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
23
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
24 v[u]intAxB splat([u]intA_t x)
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
25 creates a vector with all of the values are filled with
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26 the value of `x'
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
27
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
28 v[u]intAxB load(const [u]intA_t x[B])
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
29 copies the values from the memory address stored at `x';
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
30 the address is NOT required to be aligned
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
31
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
32 void store(v[u]intAxB vec, [u]intA_t x[B])
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
33 copies the values from the vector into the memory address
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
34 stored at `x'
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
35
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
36 like with load(), this does not require address alignment
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
37
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
38 v[u]intAxB add(v[u]intAxB vec1, v[u]intAxB vec2)
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
39 adds the value of `vec1' and `vec2' and returns it
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
40
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
41 v[u]intAxB sub(v[u]intAxB vec1, v[u]intAxB vec2)
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
42 subtracts the value of `vec2' from `vec1' and returns it
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
43
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
44 v[u]intAxB mul(v[u]intAxB vec1, v[u]intAxB vec2)
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
45 multiplies the values of `vec1' and `vec2' together and
02a517e4c492 *: initial commit
Paper <paper@paper.us.eu.org>
parents:
diff changeset
46 returns it