annotate gen/README @ 45:7955bed1d169 default tip

*: add preliminary floating point support no x86 intrinsics just yet, but I did add altivec since it's (arguably) the simplest :)
author Paper <paper@tflc.us>
date Wed, 30 Apr 2025 18:36:38 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
1 These files are used to generate the actual implementation headers in
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
2 `include/vec/impl`.
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
3
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
4 All of them are basically compiled the same way:
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
5 gcc -o genIMPL genIMPL.c genlib.c
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
6
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
7 You can generally base any new implementations off of one of the existing
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
8 ones. Preferably, you would base it off the generic implementation, since
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
9 it actually has all of the operations implemented (and serves as a
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
10 reference as to how these operations *should* work). For example the avg
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
11 operation on integers should be roughly equivalent to:
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
12 ceil((vec1 + vec2) / 2)
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
13
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
14 Note how it always rounds up, rather than truncating towards zero. This
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
15 is an important implementation detail, and stems from roots in AltiVec,
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
16 as it was the inspiration behind much of the vec API.
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
17
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
18 Note however, that avg has a different result with floating points that
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
19 is equivalent to simply
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
20 ((vec1 + vec2) / 2)
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
21 as there is no real way to get around any possible truncation.
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
22
7955bed1d169 *: add preliminary floating point support
Paper <paper@tflc.us>
parents:
diff changeset
23 Any overflow on integer operations should simply wrap around.