diff options
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 4183d8a23..82a150257 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -860,6 +860,10 @@ Literal Literal::maxUInt(const Literal& other) const { return uint32_t(geti32()) > uint32_t(other.geti32()) ? *this : other; } +Literal Literal::avgrUInt(const Literal& other) const { + return Literal((geti32() + other.geti32() + 1) / 2); +} + Literal Literal::and_(const Literal& other) const { switch (type) { case Type::i32: @@ -1729,6 +1733,9 @@ Literal Literal::maxSI8x16(const Literal& other) const { Literal Literal::maxUI8x16(const Literal& other) const { return binary<16, &Literal::getLanesUI8x16, &Literal::maxInt>(*this, other); } +Literal Literal::avgrUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::avgrUInt>(*this, other); +} Literal Literal::addI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::add>(*this, other); } @@ -1766,6 +1773,9 @@ Literal Literal::maxSI16x8(const Literal& other) const { Literal Literal::maxUI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::maxInt>(*this, other); } +Literal Literal::avgrUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::avgrUInt>(*this, other); +} Literal Literal::addI32x4(const Literal& other) const { return binary<4, &Literal::getLanesI32x4, &Literal::add>(*this, other); } |