diff options
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 4f66b36e3..d5333847d 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -102,7 +102,7 @@ Literal Literal::castToI64() { } int64_t Literal::getInteger() const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return i32; case Type::i64: @@ -113,7 +113,7 @@ int64_t Literal::getInteger() const { } double Literal::getFloat() const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return getf32(); case Type::f64: @@ -125,7 +125,7 @@ double Literal::getFloat() const { void Literal::getBits(uint8_t (&buf)[16]) const { memset(buf, 0, 16); - switch (type) { + switch (type.getSingle()) { case Type::i32: case Type::f32: memcpy(buf, &i32, sizeof(i32)); @@ -266,7 +266,7 @@ void Literal::printVec128(std::ostream& o, const std::array<uint8_t, 16>& v) { std::ostream& operator<<(std::ostream& o, Literal literal) { prepareMinorColor(o); - switch (literal.type) { + switch (literal.type.getSingle()) { case Type::none: o << "?"; break; @@ -486,7 +486,7 @@ Literal Literal::truncSatToUI64() const { } Literal Literal::eqz() const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return eq(Literal(int32_t(0))); case Type::i64: @@ -508,7 +508,7 @@ Literal Literal::eqz() const { } Literal Literal::neg() const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(-uint32_t(i32)); case Type::i64: @@ -530,7 +530,7 @@ Literal Literal::neg() const { } Literal Literal::abs() const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 & 0x7fffffff); case Type::i64: @@ -552,7 +552,7 @@ Literal Literal::abs() const { } Literal Literal::ceil() const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(std::ceil(getf32())); case Type::f64: @@ -563,7 +563,7 @@ Literal Literal::ceil() const { } Literal Literal::floor() const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(std::floor(getf32())); case Type::f64: @@ -574,7 +574,7 @@ Literal Literal::floor() const { } Literal Literal::trunc() const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(std::trunc(getf32())); case Type::f64: @@ -585,7 +585,7 @@ Literal Literal::trunc() const { } Literal Literal::nearbyint() const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(std::nearbyint(getf32())); case Type::f64: @@ -596,7 +596,7 @@ Literal Literal::nearbyint() const { } Literal Literal::sqrt() const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(std::sqrt(getf32())); case Type::f64: @@ -635,7 +635,7 @@ Literal Literal::demote() const { } Literal Literal::add(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) + uint32_t(other.i32)); case Type::i64: @@ -657,7 +657,7 @@ Literal Literal::add(const Literal& other) const { } Literal Literal::sub(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) - uint32_t(other.i32)); case Type::i64: @@ -750,7 +750,7 @@ Literal Literal::subSatUI16(const Literal& other) const { } Literal Literal::mul(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) * uint32_t(other.i32)); case Type::i64: @@ -772,7 +772,7 @@ Literal Literal::mul(const Literal& other) const { } Literal Literal::div(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: { float lhs = getf32(), rhs = other.getf32(); float sign = std::signbit(lhs) == std::signbit(rhs) ? 0.f : -0.f; @@ -835,7 +835,7 @@ Literal Literal::div(const Literal& other) const { } Literal Literal::divS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 / other.i32); case Type::i64: @@ -846,7 +846,7 @@ Literal Literal::divS(const Literal& other) const { } Literal Literal::divU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) / uint32_t(other.i32)); case Type::i64: @@ -857,7 +857,7 @@ Literal Literal::divU(const Literal& other) const { } Literal Literal::remS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 % other.i32); case Type::i64: @@ -868,7 +868,7 @@ Literal Literal::remS(const Literal& other) const { } Literal Literal::remU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) % uint32_t(other.i32)); case Type::i64: @@ -896,7 +896,7 @@ Literal Literal::avgrUInt(const Literal& other) const { } Literal Literal::and_(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 & other.i32); case Type::i64: @@ -907,7 +907,7 @@ Literal Literal::and_(const Literal& other) const { } Literal Literal::or_(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 | other.i32); case Type::i64: @@ -918,7 +918,7 @@ Literal Literal::or_(const Literal& other) const { } Literal Literal::xor_(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 ^ other.i32); case Type::i64: @@ -929,7 +929,7 @@ Literal Literal::xor_(const Literal& other) const { } Literal Literal::shl(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) << Bits::getEffectiveShifts(other.i32, Type::i32)); @@ -942,7 +942,7 @@ Literal Literal::shl(const Literal& other) const { } Literal Literal::shrS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 >> Bits::getEffectiveShifts(other.i32, Type::i32)); case Type::i64: @@ -953,7 +953,7 @@ Literal Literal::shrS(const Literal& other) const { } Literal Literal::shrU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) >> Bits::getEffectiveShifts(other.i32, Type::i32)); @@ -966,7 +966,7 @@ Literal Literal::shrU(const Literal& other) const { } Literal Literal::rotL(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(RotateLeft(uint32_t(i32), uint32_t(other.i32))); case Type::i64: @@ -977,7 +977,7 @@ Literal Literal::rotL(const Literal& other) const { } Literal Literal::rotR(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(RotateRight(uint32_t(i32), uint32_t(other.i32))); case Type::i64: @@ -988,7 +988,7 @@ Literal Literal::rotR(const Literal& other) const { } Literal Literal::eq(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 == other.i32); case Type::i64: @@ -1010,7 +1010,7 @@ Literal Literal::eq(const Literal& other) const { } Literal Literal::ne(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 != other.i32); case Type::i64: @@ -1032,7 +1032,7 @@ Literal Literal::ne(const Literal& other) const { } Literal Literal::ltS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 < other.i32); case Type::i64: @@ -1043,7 +1043,7 @@ Literal Literal::ltS(const Literal& other) const { } Literal Literal::ltU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) < uint32_t(other.i32)); case Type::i64: @@ -1054,7 +1054,7 @@ Literal Literal::ltU(const Literal& other) const { } Literal Literal::lt(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(getf32() < other.getf32()); case Type::f64: @@ -1065,7 +1065,7 @@ Literal Literal::lt(const Literal& other) const { } Literal Literal::leS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 <= other.i32); case Type::i64: @@ -1076,7 +1076,7 @@ Literal Literal::leS(const Literal& other) const { } Literal Literal::leU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) <= uint32_t(other.i32)); case Type::i64: @@ -1087,7 +1087,7 @@ Literal Literal::leU(const Literal& other) const { } Literal Literal::le(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(getf32() <= other.getf32()); case Type::f64: @@ -1098,7 +1098,7 @@ Literal Literal::le(const Literal& other) const { } Literal Literal::gtS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 > other.i32); case Type::i64: @@ -1109,7 +1109,7 @@ Literal Literal::gtS(const Literal& other) const { } Literal Literal::gtU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) > uint32_t(other.i32)); case Type::i64: @@ -1120,7 +1120,7 @@ Literal Literal::gtU(const Literal& other) const { } Literal Literal::gt(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(getf32() > other.getf32()); case Type::f64: @@ -1131,7 +1131,7 @@ Literal Literal::gt(const Literal& other) const { } Literal Literal::geS(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(i32 >= other.i32); case Type::i64: @@ -1142,7 +1142,7 @@ Literal Literal::geS(const Literal& other) const { } Literal Literal::geU(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::i32: return Literal(uint32_t(i32) >= uint32_t(other.i32)); case Type::i64: @@ -1153,7 +1153,7 @@ Literal Literal::geU(const Literal& other) const { } Literal Literal::ge(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal(getf32() >= other.getf32()); case Type::f64: @@ -1164,7 +1164,7 @@ Literal Literal::ge(const Literal& other) const { } Literal Literal::min(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: { auto l = getf32(), r = other.getf32(); if (l == r && l == 0) { @@ -1207,7 +1207,7 @@ Literal Literal::min(const Literal& other) const { } Literal Literal::max(const Literal& other) const { - switch (type) { + switch (type.getSingle()) { case Type::f32: { auto l = getf32(), r = other.getf32(); if (l == r && l == 0) { @@ -1251,7 +1251,7 @@ Literal Literal::max(const Literal& other) const { Literal Literal::copysign(const Literal& other) const { // operate on bits directly, to avoid signalling bit being set on a float - switch (type) { + switch (type.getSingle()) { case Type::f32: return Literal((i32 & 0x7fffffff) | (other.i32 & 0x80000000)).castToF32(); break; |