diff options
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 7f0c9fa6b..f4ddf69cc 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -847,6 +847,19 @@ Literal Literal::remU(const Literal& other) const { } } +Literal Literal::minInt(const Literal& other) const { + return geti32() < other.geti32() ? *this : other; +} +Literal Literal::maxInt(const Literal& other) const { + return geti32() > other.geti32() ? *this : other; +} +Literal Literal::minUInt(const Literal& other) const { + return uint32_t(geti32()) < uint32_t(other.geti32()) ? *this : other; +} +Literal Literal::maxUInt(const Literal& other) const { + return uint32_t(geti32()) > uint32_t(other.geti32()) ? *this : other; +} + Literal Literal::and_(const Literal& other) const { switch (type) { case Type::i32: @@ -1703,6 +1716,18 @@ Literal Literal::subSaturateUI8x16(const Literal& other) const { Literal Literal::mulI8x16(const Literal& other) const { return binary<16, &Literal::getLanesUI8x16, &Literal::mul>(*this, other); } +Literal Literal::minSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::minInt>(*this, other); +} +Literal Literal::minUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::minInt>(*this, other); +} +Literal Literal::maxSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::maxInt>(*this, other); +} +Literal Literal::maxUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::maxInt>(*this, other); +} Literal Literal::addI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::add>(*this, other); } @@ -1728,6 +1753,18 @@ Literal Literal::subSaturateUI16x8(const Literal& other) const { Literal Literal::mulI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::mul>(*this, other); } +Literal Literal::minSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::minInt>(*this, other); +} +Literal Literal::minUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::minInt>(*this, other); +} +Literal Literal::maxSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::maxInt>(*this, other); +} +Literal Literal::maxUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::maxInt>(*this, other); +} Literal Literal::addI32x4(const Literal& other) const { return binary<4, &Literal::getLanesI32x4, &Literal::add>(*this, other); } @@ -1737,6 +1774,18 @@ Literal Literal::subI32x4(const Literal& other) const { Literal Literal::mulI32x4(const Literal& other) const { return binary<4, &Literal::getLanesI32x4, &Literal::mul>(*this, other); } +Literal Literal::minSI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::minInt>(*this, other); +} +Literal Literal::minUI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::minUInt>(*this, other); +} +Literal Literal::maxSI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::maxInt>(*this, other); +} +Literal Literal::maxUI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::maxUInt>(*this, other); +} Literal Literal::addI64x2(const Literal& other) const { return binary<2, &Literal::getLanesI64x2, &Literal::add>(*this, other); } |