/src/WasmEdge/include/executor/engine/binary_numeric.ipp
Line | Count | Source (jump to first uncovered line) |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: 2019-2024 Second State INC |
3 | | |
4 | | #include "executor/executor.h" |
5 | | |
6 | | #include <cmath> |
7 | | |
8 | | namespace WasmEdge { |
9 | | namespace Executor { |
10 | | |
11 | | template <typename T> |
12 | 0 | TypeN<T> Executor::runAddOp(ValVariant &Val1, const ValVariant &Val2) const { |
13 | | // Integer case: Return the result of (v1 + v2) modulo 2^N. |
14 | | // Floating case: NaN, inf, and zeros are handled. |
15 | 0 | Val1.get<T>() += Val2.get<T>(); |
16 | 0 | return {}; |
17 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runAddOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runAddOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runAddOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runAddOp<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&) const |
18 | | |
19 | | template <typename T> |
20 | 0 | TypeN<T> Executor::runSubOp(ValVariant &Val1, const ValVariant &Val2) const { |
21 | | // Integer case: Return the result of (v1 - v2) modulo 2^N. |
22 | | // Floating case: NaN, inf, and zeros are handled. |
23 | 0 | Val1.get<T>() -= Val2.get<T>(); |
24 | 0 | return {}; |
25 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runSubOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runSubOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runSubOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runSubOp<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&) const |
26 | | |
27 | | template <typename T> |
28 | 0 | TypeN<T> Executor::runMulOp(ValVariant &Val1, const ValVariant &Val2) const { |
29 | | // Integer case: Return the result of (v1 * v2) modulo 2^N. |
30 | | // Floating case: NaN, inf, and zeros are handled. |
31 | 0 | Val1.get<T>() *= Val2.get<T>(); |
32 | 0 | return {}; |
33 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMulOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMulOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMulOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNativeNumV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMulOp<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&) const |
34 | | |
35 | | template <typename T> |
36 | | TypeT<T> Executor::runDivOp(const AST::Instruction &Instr, ValVariant &Val1, |
37 | 0 | const ValVariant &Val2) const { |
38 | 0 | T &V1 = Val1.get<T>(); |
39 | 0 | const T &V2 = Val2.get<T>(); |
40 | 0 | if constexpr (!std::is_floating_point_v<T>) { |
41 | 0 | if (V2 == 0) { |
42 | | // Integer case: If v2 is 0, then the result is undefined. |
43 | 0 | spdlog::error(ErrCode::Value::DivideByZero); |
44 | 0 | spdlog::error(ErrInfo::InfoInstruction( |
45 | 0 | Instr.getOpCode(), Instr.getOffset(), {Val1, Val2}, |
46 | 0 | {ValTypeFromType<T>(), ValTypeFromType<T>()}, std::is_signed_v<T>)); |
47 | 0 | return Unexpect(ErrCode::Value::DivideByZero); |
48 | 0 | } |
49 | 0 | if (std::is_signed_v<T> && V1 == std::numeric_limits<T>::min() && |
50 | 0 | V2 == static_cast<T>(-1)) { |
51 | | // Signed Integer case: If signed(v1) / signed(v2) is 2^(N − 1), then the |
52 | | // result is undefined. |
53 | 0 | spdlog::error(ErrCode::Value::IntegerOverflow); |
54 | 0 | spdlog::error(ErrInfo::InfoInstruction( |
55 | 0 | Instr.getOpCode(), Instr.getOffset(), {Val1, Val2}, |
56 | 0 | {ValTypeFromType<T>(), ValTypeFromType<T>()}, true)); |
57 | 0 | return Unexpect(ErrCode::Value::IntegerOverflow); |
58 | 0 | } |
59 | 0 | } else { |
60 | 0 | static_assert(std::numeric_limits<T>::is_iec559, "Unsupported platform!"); |
61 | 0 | } |
62 | | // Else, return the result of v1 / v2. |
63 | | // Integer case: truncated toward zero. |
64 | | // Floating case: +-0.0, NaN, and Inf case are handled. |
65 | 0 | V1 /= V2; |
66 | 0 | return {}; |
67 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runDivOp<int>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runDivOp<unsigned int>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runDivOp<long>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runDivOp<unsigned long>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runDivOp<float>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmNumV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runDivOp<double>(WasmEdge::AST::Instruction const&, 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&) const |
68 | | |
69 | | template <typename T> |
70 | | TypeI<T> Executor::runRemOp(const AST::Instruction &Instr, ValVariant &Val1, |
71 | 0 | const ValVariant &Val2) const { |
72 | 0 | T &I1 = Val1.get<T>(); |
73 | 0 | const T &I2 = Val2.get<T>(); |
74 | | // If i2 is 0, then the result is undefined. |
75 | 0 | if (I2 == 0) { |
76 | 0 | spdlog::error(ErrCode::Value::DivideByZero); |
77 | 0 | spdlog::error(ErrInfo::InfoInstruction( |
78 | 0 | Instr.getOpCode(), Instr.getOffset(), {Val1, Val2}, |
79 | 0 | {ValTypeFromType<T>(), ValTypeFromType<T>()}, std::is_signed_v<T>)); |
80 | 0 | return Unexpect(ErrCode::Value::DivideByZero); |
81 | 0 | } |
82 | | // Else, return the i1 % i2. Signed case is handled. |
83 | 0 | if (std::is_signed_v<T> && I2 == static_cast<T>(-1)) { |
84 | | // Signed Integer case: If signed(v2) is -1, then the result 0. |
85 | 0 | I1 = 0; |
86 | 0 | } else { |
87 | 0 | I1 %= I2; |
88 | 0 | } |
89 | 0 | return {}; |
90 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRemOp<int>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRemOp<unsigned int>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRemOp<long>(WasmEdge::AST::Instruction const&, 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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRemOp<unsigned long>(WasmEdge::AST::Instruction const&, 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&) const |
91 | | |
92 | | template <typename T> |
93 | 0 | TypeU<T> Executor::runAndOp(ValVariant &Val1, const ValVariant &Val2) const { |
94 | | // Return the bitwise conjunction of i1 and i2. |
95 | 0 | Val1.get<T>() &= Val2.get<T>(); |
96 | 0 | return {}; |
97 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runAndOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runAndOp<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&) const |
98 | | |
99 | | template <typename T> |
100 | 0 | TypeU<T> Executor::runOrOp(ValVariant &Val1, const ValVariant &Val2) const { |
101 | | // Return the bitwise disjunction of i1 and i2. |
102 | 0 | Val1.get<T>() |= Val2.get<T>(); |
103 | 0 | return {}; |
104 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runOrOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runOrOp<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&) const |
105 | | |
106 | | template <typename T> |
107 | 0 | TypeU<T> Executor::runXorOp(ValVariant &Val1, const ValVariant &Val2) const { |
108 | | // Return the bitwise exclusive disjunction of i1 and i2. |
109 | 0 | Val1.get<T>() ^= Val2.get<T>(); |
110 | 0 | return {}; |
111 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runXorOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runXorOp<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&) const |
112 | | |
113 | | template <typename T> |
114 | 0 | TypeU<T> Executor::runShlOp(ValVariant &Val1, const ValVariant &Val2) const { |
115 | | // Return the result of i1 << (i2 modulo N), modulo 2^N. |
116 | 0 | Val1.get<T>() <<= (Val2.get<T>() % static_cast<T>(sizeof(T) * 8)); |
117 | 0 | return {}; |
118 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runShlOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runShlOp<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&) const |
119 | | |
120 | | template <typename T> |
121 | 0 | TypeI<T> Executor::runShrOp(ValVariant &Val1, const ValVariant &Val2) const { |
122 | | // Return the result of i1 >> (i2 modulo N). |
123 | | // In signed case, extended with the sign bit of i1. |
124 | | // In unsigned case, extended with 0 bits. |
125 | 0 | using UT = std::make_unsigned_t<T>; |
126 | 0 | Val1.get<T>() >>= (Val2.get<UT>() % static_cast<T>(sizeof(T) * 8)); |
127 | 0 | return {}; |
128 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runShrOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runShrOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runShrOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmIntV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runShrOp<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&) const |
129 | | |
130 | | template <typename T> |
131 | 0 | TypeU<T> Executor::runRotlOp(ValVariant &Val1, const ValVariant &Val2) const { |
132 | 0 | T &I1 = Val1.get<T>(); |
133 | | // Let k be i2 modulo N. |
134 | 0 | const T K = Val2.get<T>() % static_cast<T>(sizeof(T) * 8); |
135 | | // Return the result of rotating i1 left by k bits. |
136 | 0 | if (likely(K != 0)) { |
137 | 0 | I1 = (I1 << K) | (I1 >> static_cast<T>(sizeof(T) * 8 - K)); |
138 | 0 | } |
139 | 0 | return {}; |
140 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRotlOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRotlOp<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&) const |
141 | | |
142 | | template <typename T> |
143 | 0 | TypeU<T> Executor::runRotrOp(ValVariant &Val1, const ValVariant &Val2) const { |
144 | 0 | T &I1 = Val1.get<T>(); |
145 | | // Let k be i2 modulo N. |
146 | 0 | const T K = Val2.get<T>() % static_cast<T>(sizeof(T) * 8); |
147 | | // Return the result of rotating i1 left by k bits. |
148 | 0 | if (likely(K != 0)) { |
149 | 0 | I1 = (I1 >> K) | (I1 << static_cast<T>(sizeof(T) * 8 - K)); |
150 | 0 | } |
151 | 0 | return {}; |
152 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned int>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRotrOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmUnsignV<unsigned long>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runRotrOp<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&) const |
153 | | |
154 | | template <typename T> |
155 | 0 | TypeF<T> Executor::runMinOp(ValVariant &Val1, const ValVariant &Val2) const { |
156 | 0 | T &Z1 = Val1.get<T>(); |
157 | 0 | const T &Z2 = Val2.get<T>(); |
158 | 0 | const T kZero = 0.0; |
159 | 0 | if (std::isnan(Z1) || std::isnan(Z2)) { |
160 | 0 | if (!std::isnan(Z1)) { |
161 | 0 | Z1 = Z2; |
162 | 0 | } |
163 | | // Set the most significant bit of the payload to 1. |
164 | 0 | if constexpr (sizeof(T) == sizeof(uint32_t)) { |
165 | 0 | uint32_t I32; |
166 | 0 | std::memcpy(&I32, &Z1, sizeof(T)); |
167 | 0 | I32 |= static_cast<uint32_t>(0x01U) << 22; |
168 | 0 | std::memcpy(&Z1, &I32, sizeof(T)); |
169 | 0 | } else if constexpr (sizeof(T) == sizeof(uint64_t)) { |
170 | 0 | uint64_t I64; |
171 | 0 | std::memcpy(&I64, &Z1, sizeof(T)); |
172 | 0 | I64 |= static_cast<uint64_t>(0x01U) << 51; |
173 | 0 | std::memcpy(&Z1, &I64, sizeof(T)); |
174 | 0 | } |
175 | 0 | } else if (Z1 == kZero && Z2 == kZero && |
176 | 0 | std::signbit(Z1) != std::signbit(Z2)) { |
177 | | // If both z1 and z2 are zeroes of opposite signs, then return -0.0. |
178 | 0 | Z1 = -kZero; |
179 | 0 | } else { |
180 | | // Else return the min of z1 and z2. (Inf case are handled.) |
181 | 0 | Z1 = std::min(Z1, Z2); |
182 | 0 | } |
183 | 0 | return {}; |
184 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmFloatV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMinOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmFloatV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMinOp<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&) const |
185 | | |
186 | | template <typename T> |
187 | 0 | TypeF<T> Executor::runMaxOp(ValVariant &Val1, const ValVariant &Val2) const { |
188 | 0 | T &Z1 = Val1.get<T>(); |
189 | 0 | const T &Z2 = Val2.get<T>(); |
190 | 0 | const T kZero = 0.0; |
191 | 0 | if (std::isnan(Z1) || std::isnan(Z2)) { |
192 | 0 | if (!std::isnan(Z1)) { |
193 | 0 | Z1 = Z2; |
194 | 0 | } |
195 | | // Set the most significant bit of the payload to 1. |
196 | 0 | if constexpr (sizeof(T) == sizeof(uint32_t)) { |
197 | 0 | uint32_t I32; |
198 | 0 | std::memcpy(&I32, &Z1, sizeof(T)); |
199 | 0 | I32 |= static_cast<uint32_t>(0x01U) << 22; |
200 | 0 | std::memcpy(&Z1, &I32, sizeof(T)); |
201 | 0 | } else if constexpr (sizeof(T) == sizeof(uint64_t)) { |
202 | 0 | uint64_t I64; |
203 | 0 | std::memcpy(&I64, &Z1, sizeof(T)); |
204 | 0 | I64 |= static_cast<uint64_t>(0x01U) << 51; |
205 | 0 | std::memcpy(&Z1, &I64, sizeof(T)); |
206 | 0 | } |
207 | 0 | } else if (Z1 == kZero && Z2 == kZero && |
208 | 0 | std::signbit(Z1) != std::signbit(Z2)) { |
209 | | // If both z1 and z2 are zeroes of opposite signs, then return +0.0. |
210 | 0 | Z1 = kZero; |
211 | 0 | } else { |
212 | | // Else return the max of z1 and z2. (Inf case are handled.) |
213 | 0 | Z1 = std::max(Z1, Z2); |
214 | 0 | } |
215 | 0 | return {}; |
216 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmFloatV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMaxOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmFloatV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runMaxOp<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&) const |
217 | | |
218 | | template <typename T> |
219 | | TypeF<T> Executor::runCopysignOp(ValVariant &Val1, |
220 | 0 | const ValVariant &Val2) const { |
221 | 0 | T &Z1 = Val1.get<T>(); |
222 | 0 | const T &Z2 = Val2.get<T>(); |
223 | | // Return z1 with the same sign with z2. |
224 | 0 | Z1 = std::copysign(Z1, Z2); |
225 | 0 | return {}; |
226 | 0 | } Unexecuted instantiation: std::__1::enable_if<IsWasmFloatV<float>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runCopysignOp<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&) const Unexecuted instantiation: std::__1::enable_if<IsWasmFloatV<double>, cxx20::expected<void, WasmEdge::ErrCode> >::type WasmEdge::Executor::Executor::runCopysignOp<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&) const |
227 | | |
228 | | } // namespace Executor |
229 | | } // namespace WasmEdge |
230 | | |
231 | | #if defined(_MSC_VER) && !defined(__clang__) // MSVC |
232 | | #include "executor/engine/binary_numeric_vector_msvc.ipp" |
233 | | #else |
234 | | #include "executor/engine/binary_numeric_vector.ipp" |
235 | | #endif // MSVC |