diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-12-18 15:28:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-18 15:28:41 -0800 |
commit | 8b15ceea0fdcde214965aea337e887af5129ad88 (patch) | |
tree | 1a384ca739c9badf437ec96eb04b392f7510a055 /src/wasm/literal.cpp | |
parent | 323e475a3ab57fe4ffd0b5826af5f6cbf0061265 (diff) | |
download | binaryen-8b15ceea0fdcde214965aea337e887af5129ad88.tar.gz binaryen-8b15ceea0fdcde214965aea337e887af5129ad88.tar.bz2 binaryen-8b15ceea0fdcde214965aea337e887af5129ad88.zip |
SIMD {i8x16,i16x8}.avgr_u instructions (#2539)
As specified in https://github.com/WebAssembly/simd/pull/126.
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); } |