/src/WasmEdge/include/executor/engine/simd_ops.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: Copyright The WasmEdge Authors |
3 | | |
4 | | //===-- wasmedge/executor/engine/simd_ops.h - SIMD op free templates ------===// |
5 | | // |
6 | | // Part of the WasmEdge Project. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | /// |
10 | | /// \file |
11 | | /// Free-function template implementations of SIMD operations. Each op |
12 | | /// mutates its first argument (Val or V1) in-place. |
13 | | /// |
14 | | //===----------------------------------------------------------------------===// |
15 | | #pragma once |
16 | | |
17 | | #if !defined(_MSC_VER) || defined(__clang__) |
18 | | |
19 | | #include "common/roundeven.h" |
20 | | #include "common/types.h" |
21 | | #include "executor/engine/vector_helper.h" |
22 | | |
23 | | #include <cmath> |
24 | | #include <cstdint> |
25 | | #include <type_traits> |
26 | | |
27 | | namespace WasmEdge { |
28 | | namespace Executor { |
29 | | namespace simdOps { |
30 | | |
31 | | // --------------------------------------------------------------------------- |
32 | | // Lane-wise binary arithmetic. T is the lane element type |
33 | | // (e.g. uint32_t, float, double). |
34 | | // --------------------------------------------------------------------------- |
35 | | |
36 | | template <typename T> |
37 | 0 | inline void vectorAdd(ValVariant &V1, const ValVariant &V2) noexcept { |
38 | 0 | using VT [[gnu::vector_size(16)]] = T; |
39 | 0 | V1.get<VT>() += V2.get<VT>(); |
40 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAdd<unsigned char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAdd<unsigned short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAdd<unsigned int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAdd<unsigned long>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAdd<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAdd<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
41 | | |
42 | | template <typename T> |
43 | 0 | inline void vectorSub(ValVariant &V1, const ValVariant &V2) noexcept { |
44 | 0 | using VT [[gnu::vector_size(16)]] = T; |
45 | 0 | V1.get<VT>() -= V2.get<VT>(); |
46 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSub<unsigned char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSub<unsigned short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSub<unsigned int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSub<unsigned long>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSub<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSub<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
47 | | |
48 | | template <typename T> |
49 | 0 | inline void vectorMul(ValVariant &V1, const ValVariant &V2) noexcept { |
50 | 0 | using VT [[gnu::vector_size(16)]] = T; |
51 | 0 | V1.get<VT>() *= V2.get<VT>(); |
52 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMul<unsigned short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMul<unsigned int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMul<unsigned long>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMul<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMul<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
53 | | |
54 | | template <typename T> |
55 | 0 | inline void vectorDiv(ValVariant &V1, const ValVariant &V2) noexcept { |
56 | 0 | using VT [[gnu::vector_size(16)]] = T; |
57 | 0 | V1.get<VT>() /= V2.get<VT>(); |
58 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorDiv<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorDiv<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
59 | | |
60 | | // --------------------------------------------------------------------------- |
61 | | // Lane-wise integer min/max. Use signed T for _s ops, unsigned T for _u ops. |
62 | | // --------------------------------------------------------------------------- |
63 | | |
64 | | template <typename T> |
65 | 0 | inline void vectorMin(ValVariant &V1, const ValVariant &V2) noexcept { |
66 | 0 | using VT [[gnu::vector_size(16)]] = T; |
67 | 0 | VT &A = V1.get<VT>(); |
68 | 0 | const VT &B = V2.get<VT>(); |
69 | 0 | A = detail::vectorSelect(A > B, B, A); |
70 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<signed char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<unsigned char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<unsigned short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<unsigned int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMin<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
71 | | |
72 | | template <typename T> |
73 | 0 | inline void vectorMax(ValVariant &V1, const ValVariant &V2) noexcept { |
74 | 0 | using VT [[gnu::vector_size(16)]] = T; |
75 | 0 | VT &A = V1.get<VT>(); |
76 | 0 | const VT &B = V2.get<VT>(); |
77 | 0 | A = detail::vectorSelect(B > A, B, A); |
78 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<signed char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<unsigned char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<unsigned short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<unsigned int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorMax<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
79 | | |
80 | | // --------------------------------------------------------------------------- |
81 | | // Float min/max with NaN propagation. |
82 | | // |
83 | | // fmin: R = bits(A) | bits(B) // merge NaN payloads |
84 | | // if A < B: R = A |
85 | | // if A > B: R = B |
86 | | // if A is NaN: R = A |
87 | | // if B is NaN: R = B |
88 | | // fmax: same but & instead of |, and reversed comparisons. |
89 | | // |
90 | | // NaN check uses (V == V) which is false for NaN lanes, so |
91 | | // vectorSelect(false, R, V) = V. |
92 | | // --------------------------------------------------------------------------- |
93 | | |
94 | | template <typename T> |
95 | 0 | inline void vectorFMin(ValVariant &V1, const ValVariant &V2) noexcept { |
96 | 0 | static_assert(std::is_floating_point_v<T>); |
97 | 0 | using VT [[gnu::vector_size(16)]] = T; |
98 | 0 | VT &A = V1.get<VT>(); |
99 | 0 | const VT &B = V2.get<VT>(); |
100 | 0 | VT R = reinterpret_cast<VT>(reinterpret_cast<uint64x2_t>(A) | |
101 | 0 | reinterpret_cast<uint64x2_t>(B)); |
102 | 0 | R = detail::vectorSelect(A < B, A, R); |
103 | 0 | R = detail::vectorSelect(A > B, B, R); |
104 | | // NOLINTBEGIN(misc-redundant-expression): A==A and B==B are IEEE NaN checks; |
105 | | // for GCC vector types these are lane-wise comparisons, not redundant. |
106 | 0 | R = detail::vectorSelect(A == A, R, A); |
107 | 0 | R = detail::vectorSelect(B == B, R, B); |
108 | | // NOLINTEND(misc-redundant-expression) |
109 | 0 | A = R; |
110 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorFMin<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorFMin<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
111 | | |
112 | | template <typename T> |
113 | 0 | inline void vectorFMax(ValVariant &V1, const ValVariant &V2) noexcept { |
114 | 0 | static_assert(std::is_floating_point_v<T>); |
115 | 0 | using VT [[gnu::vector_size(16)]] = T; |
116 | 0 | VT &A = V1.get<VT>(); |
117 | 0 | const VT &B = V2.get<VT>(); |
118 | 0 | VT R = reinterpret_cast<VT>(reinterpret_cast<uint64x2_t>(A) & |
119 | 0 | reinterpret_cast<uint64x2_t>(B)); |
120 | 0 | R = detail::vectorSelect(A < B, B, R); |
121 | 0 | R = detail::vectorSelect(A > B, A, R); |
122 | | // NOLINTBEGIN(misc-redundant-expression): IEEE NaN checks on vector lanes |
123 | 0 | R = detail::vectorSelect(A == A, R, A); |
124 | 0 | R = detail::vectorSelect(B == B, R, B); |
125 | | // NOLINTEND(misc-redundant-expression) |
126 | 0 | A = R; |
127 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorFMax<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorFMax<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&, WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant> const&) |
128 | | |
129 | | // --------------------------------------------------------------------------- |
130 | | // Lane-wise unary operations. |
131 | | // --------------------------------------------------------------------------- |
132 | | |
133 | 0 | template <typename T> inline void vectorNeg(ValVariant &Val) noexcept { |
134 | 0 | using VT [[gnu::vector_size(16)]] = T; |
135 | 0 | Val.get<VT>() = -Val.get<VT>(); |
136 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNeg<signed char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNeg<short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNeg<int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNeg<long>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNeg<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNeg<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
137 | | |
138 | | /// Integer and float abs. |
139 | | /// Float: clears sign bit via integer mask. |
140 | | /// Integer: vectorSelect(x > 0, x, -x) — wraps at INT_MIN per Wasm spec. |
141 | 0 | template <typename T> inline void vectorAbs(ValVariant &Val) noexcept { |
142 | 0 | using VT [[gnu::vector_size(16)]] = T; |
143 | 0 | VT &Result = Val.get<VT>(); |
144 | 0 | if constexpr (std::is_floating_point_v<T>) { |
145 | 0 | if constexpr (sizeof(T) == 4) { |
146 | 0 | using IVT [[gnu::vector_size(16)]] = uint32_t; |
147 | 0 | IVT Mask = IVT{} + UINT32_C(0x7FFFFFFF); |
148 | 0 | Result = reinterpret_cast<VT>(reinterpret_cast<IVT>(Result) & Mask); |
149 | 0 | } else { |
150 | 0 | using IVT [[gnu::vector_size(16)]] = uint64_t; |
151 | 0 | IVT Mask = IVT{} + UINT64_C(0x7FFFFFFFFFFFFFFF); |
152 | 0 | Result = reinterpret_cast<VT>(reinterpret_cast<IVT>(Result) & Mask); |
153 | 0 | } |
154 | 0 | } else { |
155 | 0 | Result = detail::vectorSelect(Result > VT{}, Result, -Result); |
156 | 0 | } |
157 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAbs<signed char>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAbs<short>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAbs<int>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAbs<long>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAbs<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorAbs<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
158 | | |
159 | | /// Per-lane sqrt. |
160 | 0 | template <typename T> inline void vectorSqrt(ValVariant &Val) noexcept { |
161 | 0 | static_assert(std::is_floating_point_v<T>); |
162 | 0 | using VT [[gnu::vector_size(16)]] = T; |
163 | 0 | VT &Result = Val.get<VT>(); |
164 | 0 | if constexpr (sizeof(T) == 4) { |
165 | 0 | Result = VT{std::sqrt(Result[0]), std::sqrt(Result[1]), |
166 | 0 | std::sqrt(Result[2]), std::sqrt(Result[3])}; |
167 | 0 | } else if constexpr (sizeof(T) == 8) { |
168 | 0 | Result = VT{std::sqrt(Result[0]), std::sqrt(Result[1])}; |
169 | 0 | } |
170 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSqrt<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorSqrt<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
171 | | |
172 | | /// Per-lane ceil. |
173 | 0 | template <typename T> inline void vectorCeil(ValVariant &Val) noexcept { |
174 | 0 | static_assert(std::is_floating_point_v<T>); |
175 | 0 | using VT [[gnu::vector_size(16)]] = T; |
176 | 0 | VT &Result = Val.get<VT>(); |
177 | 0 | if constexpr (sizeof(T) == 4) { |
178 | 0 | Result = VT{std::ceil(Result[0]), std::ceil(Result[1]), |
179 | 0 | std::ceil(Result[2]), std::ceil(Result[3])}; |
180 | 0 | } else if constexpr (sizeof(T) == 8) { |
181 | 0 | Result = VT{std::ceil(Result[0]), std::ceil(Result[1])}; |
182 | 0 | } |
183 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorCeil<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorCeil<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
184 | | |
185 | | /// Per-lane floor. |
186 | 0 | template <typename T> inline void vectorFloor(ValVariant &Val) noexcept { |
187 | 0 | static_assert(std::is_floating_point_v<T>); |
188 | 0 | using VT [[gnu::vector_size(16)]] = T; |
189 | 0 | VT &Result = Val.get<VT>(); |
190 | 0 | if constexpr (sizeof(T) == 4) { |
191 | 0 | Result = VT{std::floor(Result[0]), std::floor(Result[1]), |
192 | 0 | std::floor(Result[2]), std::floor(Result[3])}; |
193 | 0 | } else if constexpr (sizeof(T) == 8) { |
194 | 0 | Result = VT{std::floor(Result[0]), std::floor(Result[1])}; |
195 | 0 | } |
196 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorFloor<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorFloor<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
197 | | |
198 | | /// Per-lane trunc. |
199 | 0 | template <typename T> inline void vectorTrunc(ValVariant &Val) noexcept { |
200 | 0 | static_assert(std::is_floating_point_v<T>); |
201 | 0 | using VT [[gnu::vector_size(16)]] = T; |
202 | 0 | VT &Result = Val.get<VT>(); |
203 | 0 | if constexpr (sizeof(T) == 4) { |
204 | 0 | Result = VT{std::trunc(Result[0]), std::trunc(Result[1]), |
205 | 0 | std::trunc(Result[2]), std::trunc(Result[3])}; |
206 | 0 | } else if constexpr (sizeof(T) == 8) { |
207 | 0 | Result = VT{std::trunc(Result[0]), std::trunc(Result[1])}; |
208 | 0 | } |
209 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorTrunc<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorTrunc<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
210 | | |
211 | | /// Per-lane roundeven (ties-to-even rounding). |
212 | 0 | template <typename T> inline void vectorNearest(ValVariant &Val) noexcept { |
213 | 0 | static_assert(std::is_floating_point_v<T>); |
214 | 0 | using VT [[gnu::vector_size(16)]] = T; |
215 | 0 | VT &Result = Val.get<VT>(); |
216 | 0 | if constexpr (sizeof(T) == 4) { |
217 | 0 | Result = VT{WasmEdge::roundeven(Result[0]), WasmEdge::roundeven(Result[1]), |
218 | 0 | WasmEdge::roundeven(Result[2]), WasmEdge::roundeven(Result[3])}; |
219 | 0 | } else if constexpr (sizeof(T) == 8) { |
220 | 0 | Result = VT{WasmEdge::roundeven(Result[0]), WasmEdge::roundeven(Result[1])}; |
221 | 0 | } |
222 | 0 | } Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNearest<float>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) Unexecuted instantiation: void WasmEdge::Executor::simdOps::vectorNearest<double>(WasmEdge::Variant<unsigned int, int, unsigned long, long, float, double, unsigned __int128, __int128, unsigned long __vector(2), long __vector(2), unsigned int __vector(4), int __vector(4), unsigned short __vector(8), short __vector(8), unsigned char __vector(16), signed char __vector(16), float __vector(4), double __vector(2), WasmEdge::RefVariant>&) |
223 | | |
224 | | /// i8x16.popcnt — per-byte Hamming weight via SWAR. |
225 | 0 | inline void vectorPopcnt(ValVariant &Val) noexcept { |
226 | 0 | auto &Result = Val.get<uint8x16_t>(); |
227 | 0 | Result -= ((Result >> UINT8_C(1)) & UINT8_C(0x55)); |
228 | 0 | Result = (Result & UINT8_C(0x33)) + ((Result >> UINT8_C(2)) & UINT8_C(0x33)); |
229 | 0 | Result += Result >> UINT8_C(4); |
230 | | Result &= UINT8_C(0x0f); |
231 | 0 | } |
232 | | |
233 | | } // namespace simdOps |
234 | | } // namespace Executor |
235 | | } // namespace WasmEdge |
236 | | |
237 | | #endif // !_MSC_VER || __clang__ |