Mercurial > vec
annotate src/vec.c @ 23:e26874655738
*: huge refactor, new major release (hahaha)
I keep finding things that are broken...
The problem NOW was that vec would unintentionally build some
functions with extended instruction sets, which is Bad and would
mean that for all intents and purposes the CPU detection was
completely broken.
Now vec is no longer header only either. Boohoo. However this gives
a lot more flexibility to vec since we no longer want or need to
care about C++ crap.
The NEON and Altivec implementations have not been updated which
means they won't compile hence why they're commented out in the
cmake build file.
author | Paper <paper@tflc.us> |
---|---|
date | Sun, 24 Nov 2024 02:52:40 -0500 |
parents | e05c257c6a23 |
children | 92156fe32755 |
rev | line source |
---|---|
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
1 /** |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
2 * vec - a tiny SIMD vector library in C99 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
3 * |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
4 * Copyright (c) 2024 Paper |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
5 * |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
6 * Permission is hereby granted, free of charge, to any person obtaining a copy |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
7 * of this software and associated documentation files (the "Software"), to deal |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
8 * in the Software without restriction, including without limitation the rights |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
10 * copies of the Software, and to permit persons to whom the Software is |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
11 * furnished to do so, subject to the following conditions: |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
12 * |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
13 * The above copyright notice and this permission notice shall be included in all |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
14 * copies or substantial portions of the Software. |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
15 * |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
22 * SOFTWARE. |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
23 **/ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
24 |
8
6e0eb3aa12ab
build: add files to build vec as an external library
Paper <paper@tflc.us>
parents:
diff
changeset
|
25 #include "vec/vec.h" |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
26 #include "vec/cpu.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
27 #include "vec/impl/generic.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
28 #include "vec/impl/fallback.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
29 #ifdef VEC_COMPILER_HAS_MMX |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
30 # include "vec/impl/x86/mmx.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
31 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
32 #ifdef VEC_COMPILER_HAS_SSE2 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
33 # include "vec/impl/x86/sse2.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
34 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
35 #ifdef VEC_COMPILER_HAS_SSE41 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
36 # include "vec/impl/x86/sse41.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
37 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
38 #ifdef VEC_COMPILER_HAS_AVX2 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
39 # include "vec/impl/x86/avx2.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
40 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
41 #ifdef VEC_COMPILER_HAS_AVX512F |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
42 # include "vec/impl/x86/avx512f.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
43 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
44 #ifdef VEC_COMPILER_HAS_ALTIVEC |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
45 # include "vec/impl/ppc/altivec.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
46 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
47 #ifdef VEC_COMPILER_HAS_NEON |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
48 # include "vec/impl/arm/neon.h" |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
49 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
50 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
51 extern inline vec_uintmax vec_lrshift(vec_uintmax x, unsigned int y); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
52 extern inline vec_uintmax vec_llshift(vec_uintmax x, unsigned int y); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
53 extern inline vec_uintmax vec_urshift(vec_uintmax x, unsigned int y); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
54 extern inline vec_uintmax vec_ulshift(vec_uintmax x, unsigned int y); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
55 extern inline vec_intmax vec_rshift(vec_intmax x, unsigned int y); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
56 extern inline vec_intmax vec_lshift(vec_intmax x, unsigned int y); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
57 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
58 // 16-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
59 const vint8x2_impl *vint8x2_impl_cpu = &vint8x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
60 const vuint8x2_impl *vuint8x2_impl_cpu = &vuint8x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
61 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
62 // 32-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
63 const vint8x4_impl *vint8x4_impl_cpu = &vint8x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
64 const vuint8x4_impl *vuint8x4_impl_cpu = &vuint8x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
65 const vint16x2_impl *vint16x2_impl_cpu = &vint16x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
66 const vuint16x2_impl *vuint16x2_impl_cpu = &vuint16x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
67 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
68 // 64-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
69 const vint8x8_impl *vint8x8_impl_cpu = &vint8x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
70 const vuint8x8_impl *vuint8x8_impl_cpu = &vuint8x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
71 const vint16x4_impl *vint16x4_impl_cpu = &vint16x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
72 const vuint16x4_impl *vuint16x4_impl_cpu = &vuint16x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
73 const vint32x2_impl *vint32x2_impl_cpu = &vint32x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
74 const vuint32x2_impl *vuint32x2_impl_cpu = &vuint32x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
75 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
76 // 128-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
77 const vint8x16_impl *vint8x16_impl_cpu = &vint8x16_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
78 const vuint8x16_impl *vuint8x16_impl_cpu = &vuint8x16_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
79 const vint16x8_impl *vint16x8_impl_cpu = &vint16x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
80 const vuint16x8_impl *vuint16x8_impl_cpu = &vuint16x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
81 const vint32x4_impl *vint32x4_impl_cpu = &vint32x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
82 const vuint32x4_impl *vuint32x4_impl_cpu = &vuint32x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
83 const vint64x2_impl *vint64x2_impl_cpu = &vint64x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
84 const vuint64x2_impl *vuint64x2_impl_cpu = &vuint64x2_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
85 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
86 // 256-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
87 const vint8x32_impl *vint8x32_impl_cpu = &vint8x32_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
88 const vuint8x32_impl *vuint8x32_impl_cpu = &vuint8x32_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
89 const vint16x16_impl *vint16x16_impl_cpu = &vint16x16_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
90 const vuint16x16_impl *vuint16x16_impl_cpu = &vuint16x16_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
91 const vint32x8_impl *vint32x8_impl_cpu = &vint32x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
92 const vuint32x8_impl *vuint32x8_impl_cpu = &vuint32x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
93 const vint64x4_impl *vint64x4_impl_cpu = &vint64x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
94 const vuint64x4_impl *vuint64x4_impl_cpu = &vuint64x4_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
95 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
96 // 512-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
97 const vint8x64_impl *vint8x64_impl_cpu = &vint8x64_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
98 const vuint8x64_impl *vuint8x64_impl_cpu = &vuint8x64_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
99 const vint16x32_impl *vint16x32_impl_cpu = &vint16x32_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
100 const vuint16x32_impl *vuint16x32_impl_cpu = &vuint16x32_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
101 const vint32x16_impl *vint32x16_impl_cpu = &vint32x16_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
102 const vuint32x16_impl *vuint32x16_impl_cpu = &vuint32x16_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
103 const vint64x8_impl *vint64x8_impl_cpu = &vint64x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
104 const vuint64x8_impl *vuint64x8_impl_cpu = &vuint64x8_impl_generic; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
105 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
106 static int vec_init_spinner = 0; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
107 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
108 // returns 0 or a negative error code on failure |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
109 int vec_init(void) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
110 { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
111 // This function is NOT thread safe. However, once vec |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
112 // is initialized, all of the vector functions are thread-safe. |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
113 // |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
114 // In fact, it's possible to use vec without calling |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
115 // vec_init() at all, but it would be completely useless since |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
116 // it would just use a generic implementation without any |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
117 // vectorization whatsoever (unless maybe the compiler is |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
118 // smart enough to optimize it into vectors) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
119 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
120 if (vec_init_spinner) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
121 return 0; // already initialized, do nothing |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
122 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
123 vec_uint32 cpu = vec_get_CPU_features(); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
124 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
125 #ifdef VEC_COMPILER_HAS_ALTIVEC |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
126 if (cpu & VEC_CPU_HAS_ALTIVEC) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
127 vint8x16_impl_cpu = &vint8x16_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
128 vuint8x16_impl_cpu = &vuint8x16_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
129 vint16x8_impl_cpu = &vint16x8_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
130 vuint16x8_impl_cpu = &vuint16x8_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
131 vint32x4_impl_cpu = &vint32x4_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
132 vuint32x4_impl_cpu = &vuint32x4_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
133 #ifdef VEC_COMPILER_HAS_ALTIVEC_VSX |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
134 if (cpu & VEC_CPU_HAS_ALTIVEC_VSX) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
135 vint64x2_impl_cpu = &vint64x2_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
136 vuint64x2_impl_cpu = &vuint64x2_impl_altivec; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
137 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
138 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
139 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
140 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
141 #ifdef VEC_COMPILER_HAS_AVX512F |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
142 if (cpu & VEC_CPU_HAS_AVX512F) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
143 vint8x64_impl_cpu = &vint8x64_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
144 vuint8x64_impl_cpu = &vuint8x64_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
145 vint16x32_impl_cpu = &vint16x32_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
146 vuint16x32_impl_cpu = &vuint16x32_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
147 vint32x16_impl_cpu = &vint32x16_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
148 vuint32x16_impl_cpu = &vuint32x16_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
149 vint64x8_impl_cpu = &vint64x8_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
150 vuint64x8_impl_cpu = &vuint64x8_impl_avx512f; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
151 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
152 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
153 #ifdef VEC_COMPILER_HAS_AVX2 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
154 if (cpu & VEC_CPU_HAS_AVX2) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
155 vint8x32_impl_cpu = &vint8x32_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
156 vuint8x32_impl_cpu = &vuint8x32_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
157 vint16x16_impl_cpu = &vint16x16_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
158 vuint16x16_impl_cpu = &vuint16x16_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
159 vint32x8_impl_cpu = &vint32x8_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
160 vuint32x8_impl_cpu = &vuint32x8_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
161 vint64x4_impl_cpu = &vint64x4_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
162 vuint64x4_impl_cpu = &vuint64x4_impl_avx2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
163 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
164 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
165 #ifdef VEC_COMPILER_HAS_SSE2 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
166 if (cpu & VEC_CPU_HAS_SSE2) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
167 vint8x16_impl_cpu = &vint8x16_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
168 vuint8x16_impl_cpu = &vuint8x16_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
169 vint16x8_impl_cpu = &vint16x8_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
170 vuint16x8_impl_cpu = &vuint16x8_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
171 # ifdef VEC_COMPILER_HAS_SSE41 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
172 if (cpu & VEC_CPU_HAS_SSE41) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
173 vint32x4_impl_cpu = &vint32x4_impl_sse41; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
174 vuint32x4_impl_cpu = &vuint32x4_impl_sse41; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
175 } else |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
176 # endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
177 { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
178 vint32x4_impl_cpu = &vint32x4_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
179 vuint32x4_impl_cpu = &vuint32x4_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
180 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
181 vint64x2_impl_cpu = &vint64x2_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
182 vuint64x2_impl_cpu = &vuint64x2_impl_sse2; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
183 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
184 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
185 #ifdef VEC_COMPILER_HAS_MMX |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
186 if (cpu & VEC_CPU_HAS_MMX) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
187 vint8x8_impl_cpu = &vint8x8_impl_mmx; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
188 vuint8x8_impl_cpu = &vuint8x8_impl_mmx; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
189 vint16x4_impl_cpu = &vint16x4_impl_mmx; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
190 vuint16x4_impl_cpu = &vuint16x4_impl_mmx; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
191 vint32x2_impl_cpu = &vint32x2_impl_mmx; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
192 vuint32x2_impl_cpu = &vuint32x2_impl_mmx; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
193 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
194 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
195 #ifdef VEC_COMPILER_HAS_NEON |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
196 if (cpu & VEC_CPU_HAS_NEON) { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
197 // 64-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
198 vint8x8_impl_cpu = &vint8x8_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
199 vuint8x8_impl_cpu = &vuint8x8_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
200 vint16x4_impl_cpu = &vint16x4_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
201 vuint16x4_impl_cpu = &vuint16x4_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
202 vint32x2_impl_cpu = &vint32x2_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
203 vuint32x2_impl_cpu = &vuint32x2_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
204 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
205 // 128-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
206 vint8x16_impl_cpu = &vint8x16_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
207 vuint8x16_impl_cpu = &vuint8x16_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
208 vint16x8_impl_cpu = &vint16x8_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
209 vuint16x8_impl_cpu = &vuint16x8_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
210 vint32x4_impl_cpu = &vint32x4_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
211 vuint32x4_impl_cpu = &vuint32x4_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
212 vint64x2_impl_cpu = &vint64x2_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
213 vuint64x2_impl_cpu = &vuint64x2_impl_neon; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
214 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
215 #endif |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
216 { |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
217 // do nothing, they're already set to generics |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
218 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
219 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
220 vec_init_spinner++; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
221 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
222 return 0; |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
223 } |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
224 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
225 /* ---------------------------------------------------------------- */ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
226 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
227 #define VEC_DEFINE_OPERATIONS_SIGN(sign, bits, size) \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
228 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_splat(vec_##sign##int##bits x); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
229 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_load_aligned(const vec_##sign##int##bits in[size]); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
230 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_load(const vec_##sign##int##bits in[size]); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
231 extern inline void v##sign##int##bits##x##size##_store_aligned(v##sign##int##bits##x##size vec, vec_##sign##int##bits out[size]); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
232 extern inline void v##sign##int##bits##x##size##_store(v##sign##int##bits##x##size vec, vec_##sign##int##bits out[size]); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
233 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_add(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
234 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_sub(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
235 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_mul(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
236 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_div(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
237 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_avg(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
238 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_and(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
239 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_or(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
240 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_xor(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
241 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_not(v##sign##int##bits##x##size vec); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
242 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_cmplt(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
243 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_cmple(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
244 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_cmpeq(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
245 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_cmpge(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
246 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_cmpgt(v##sign##int##bits##x##size vec1, v##sign##int##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
247 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_lshift(v##sign##int##bits##x##size vec1, vuint##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
248 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_rshift(v##sign##int##bits##x##size vec1, vuint##bits##x##size vec2); \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
249 extern inline v##sign##int##bits##x##size v##sign##int##bits##x##size##_lrshift(v##sign##int##bits##x##size vec1, vuint##bits##x##size vec2); |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
250 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
251 #define VEC_DEFINE_OPERATIONS(bits, size) \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
252 VEC_DEFINE_OPERATIONS_SIGN( , bits, size) \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
253 VEC_DEFINE_OPERATIONS_SIGN(u, bits, size) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
254 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
255 // 16-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
256 VEC_DEFINE_OPERATIONS(8, 2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
257 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
258 // 32-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
259 VEC_DEFINE_OPERATIONS(8, 4) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
260 VEC_DEFINE_OPERATIONS(16, 2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
261 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
262 // 64-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
263 VEC_DEFINE_OPERATIONS(8, 8) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
264 VEC_DEFINE_OPERATIONS(16, 4) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
265 VEC_DEFINE_OPERATIONS(32, 2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
266 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
267 // 128-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
268 VEC_DEFINE_OPERATIONS(8, 16) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
269 VEC_DEFINE_OPERATIONS(16, 8) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
270 VEC_DEFINE_OPERATIONS(32, 4) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
271 VEC_DEFINE_OPERATIONS(64, 2) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
272 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
273 // 256-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
274 VEC_DEFINE_OPERATIONS(8, 32) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
275 VEC_DEFINE_OPERATIONS(16, 16) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
276 VEC_DEFINE_OPERATIONS(32, 8) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
277 VEC_DEFINE_OPERATIONS(64, 4) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
278 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
279 // 512-bit |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
280 VEC_DEFINE_OPERATIONS(8, 64) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
281 VEC_DEFINE_OPERATIONS(16, 32) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
282 VEC_DEFINE_OPERATIONS(32, 16) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
283 VEC_DEFINE_OPERATIONS(64, 8) |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
284 |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
285 #undef VEC_DEFINE_OPERATIONS |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
286 #undef VEC_DEFINE_OPERATIONS_SIGN |