/src/Simd/src/Simd/SimdBaseSynetUnaryOperation.cpp
Line | Count | Source |
1 | | /* |
2 | | * Simd Library (http://ermig1979.github.io/Simd). |
3 | | * |
4 | | * Copyright (c) 2011-2024 Yermalayeu Ihar. |
5 | | * |
6 | | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | | * of this software and associated documentation files (the "Software"), to deal |
8 | | * in the Software without restriction, including without limitation the rights |
9 | | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | | * copies of the Software, and to permit persons to whom the Software is |
11 | | * furnished to do so, subject to the following conditions: |
12 | | * |
13 | | * The above copyright notice and this permission notice shall be included in |
14 | | * all copies or substantial portions of the Software. |
15 | | * |
16 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | | * SOFTWARE. |
23 | | */ |
24 | | #include "Simd/SimdArray.h" |
25 | | #include "Simd/SimdPow.h" |
26 | | #include "Simd/SimdSynet.h" |
27 | | #include "Simd/SimdAlignment.h" |
28 | | #include "Simd/SimdExp.h" |
29 | | #include "Simd/SimdErf.h" |
30 | | #include "Simd/SimdTrigonometric.h" |
31 | | |
32 | | namespace Simd |
33 | | { |
34 | | #if defined(SIMD_SYNET_ENABLE) |
35 | | namespace Base |
36 | | { |
37 | | template<SimdSynetUnaryOperation32fType type> void SynetUnaryOperation32f(const float* src, size_t size, float* dst) |
38 | 0 | { |
39 | 0 | size_t size4 = AlignLo(size, 4); |
40 | 0 | size_t i = 0; |
41 | 0 | for (; i < size4; i += 4) |
42 | 0 | { |
43 | 0 | dst[i + 0] = SynetUnaryOperation32f<type>(src[i + 0]); |
44 | 0 | dst[i + 1] = SynetUnaryOperation32f<type>(src[i + 1]); |
45 | 0 | dst[i + 2] = SynetUnaryOperation32f<type>(src[i + 2]); |
46 | 0 | dst[i + 3] = SynetUnaryOperation32f<type>(src[i + 3]); |
47 | 0 | } |
48 | 0 | for (; i < size; ++i) |
49 | 0 | dst[i] = SynetUnaryOperation32f<type>(src[i]); |
50 | 0 | } Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)0>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)1>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)2>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)3>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)4>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)5>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)6>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)7>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)8>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)9>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)10>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)11>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)12>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)13>(float const*, unsigned long, float*) Unexecuted instantiation: void Simd::Base::SynetUnaryOperation32f<(SimdSynetUnaryOperation32fType)14>(float const*, unsigned long, float*) |
51 | | |
52 | | void SynetUnaryOperation32f(const float * src, size_t size, SimdSynetUnaryOperation32fType type, float * dst) |
53 | 0 | { |
54 | 0 | switch (type) |
55 | 0 | { |
56 | 0 | case SimdSynetUnaryOperation32fAbs: SynetUnaryOperation32f<SimdSynetUnaryOperation32fAbs>(src, size, dst); break; |
57 | 0 | case SimdSynetUnaryOperation32fCeil: SynetUnaryOperation32f<SimdSynetUnaryOperation32fCeil>(src, size, dst); break; |
58 | 0 | case SimdSynetUnaryOperation32fCos: SynetUnaryOperation32f<SimdSynetUnaryOperation32fCos>(src, size, dst); break; |
59 | 0 | case SimdSynetUnaryOperation32fErf: SynetUnaryOperation32f<SimdSynetUnaryOperation32fErf>(src, size, dst); break; |
60 | 0 | case SimdSynetUnaryOperation32fExp: SynetUnaryOperation32f<SimdSynetUnaryOperation32fExp>(src, size, dst); break; |
61 | 0 | case SimdSynetUnaryOperation32fFloor: SynetUnaryOperation32f<SimdSynetUnaryOperation32fFloor>(src, size, dst); break; |
62 | 0 | case SimdSynetUnaryOperation32fLog: SynetUnaryOperation32f<SimdSynetUnaryOperation32fLog>(src, size, dst); break; |
63 | 0 | case SimdSynetUnaryOperation32fNeg: SynetUnaryOperation32f<SimdSynetUnaryOperation32fNeg>(src, size, dst); break; |
64 | 0 | case SimdSynetUnaryOperation32fNot: SynetUnaryOperation32f<SimdSynetUnaryOperation32fNot>(src, size, dst); break; |
65 | 0 | case SimdSynetUnaryOperation32fRcp: SynetUnaryOperation32f<SimdSynetUnaryOperation32fRcp>(src, size, dst); break; |
66 | 0 | case SimdSynetUnaryOperation32fRsqrt: SynetUnaryOperation32f<SimdSynetUnaryOperation32fRsqrt>(src, size, dst); break; |
67 | 0 | case SimdSynetUnaryOperation32fSin: SynetUnaryOperation32f<SimdSynetUnaryOperation32fSin>(src, size, dst); break; |
68 | 0 | case SimdSynetUnaryOperation32fSqrt: SynetUnaryOperation32f<SimdSynetUnaryOperation32fSqrt>(src, size, dst); break; |
69 | 0 | case SimdSynetUnaryOperation32fTanh: SynetUnaryOperation32f<SimdSynetUnaryOperation32fTanh>(src, size, dst); break; |
70 | 0 | case SimdSynetUnaryOperation32fZero: SynetUnaryOperation32f<SimdSynetUnaryOperation32fZero>(src, size, dst); break; |
71 | 0 | default: |
72 | | assert(0); |
73 | 0 | } |
74 | 0 | } |
75 | | } |
76 | | #endif |
77 | | } |