From 31c6f4b2b0d79e7fe1e801432537e627d11f3091 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 22 Jan 2016 10:59:10 -0800 Subject: add more binary opcodes and a kitchen sink test #136 --- src/wasm-binary.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index c5f844f34..a6c388c52 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -252,7 +252,7 @@ enum ASTNodes { F64CopySign = 0x91, F64Ceil = 0x92, F64Floor = 0x93, - F64Trunc = 0x94, + F64Trunc = 0x94, // XXX what is this? trunc f64 to f64? F64NearestInt = 0x95, F64Sqrt = 0x96, F64Eq = 0x97, @@ -789,7 +789,7 @@ public: case Abs: o << int8_t(curr->type == f32 ? BinaryConsts::F32Abs : BinaryConsts::F64Abs); break; case Ceil: o << int8_t(curr->type == f32 ? BinaryConsts::F32Ceil : BinaryConsts::F64Ceil); break; case Floor: o << int8_t(curr->type == f32 ? BinaryConsts::F32Floor : BinaryConsts::F64Floor); break; - case Trunc: o << int8_t(curr->type == f32 ? BinaryConsts::F32Trunc : BinaryConsts::F64Trunc); break;; + case Trunc: o << int8_t(curr->type == f32 ? BinaryConsts::F32Trunc : BinaryConsts::F64Trunc); break; case Nearest: o << int8_t(curr->type == f32 ? BinaryConsts::F32NearestInt : BinaryConsts::F64NearestInt); break; case Sqrt: o << int8_t(curr->type == f32 ? BinaryConsts::F32Sqrt : BinaryConsts::F64Sqrt); break; case ExtendSInt32: o << int8_t(BinaryConsts::I64SConvertI32); break; @@ -1237,6 +1237,7 @@ public: if (maybeVisit(curr, code)) break; if (maybeVisit(curr, code)) break; if (maybeVisit(curr, code)) break; + std::cerr << "bad code 0x" << std::hex << (int)code << std::endl; abort(); } } @@ -1483,6 +1484,9 @@ public: case BinaryConsts::F32SConvertI64: curr->op = TruncSFloat64; curr->type = i32; break; case BinaryConsts::F64SConvertI64: curr->op = TruncSFloat64; curr->type = i64; break; + case BinaryConsts::F32Trunc: curr->op = Trunc; curr->type = f32; break; + case BinaryConsts::F64Trunc: curr->op = Trunc; curr->type = f64; break; + case BinaryConsts::F32ConvertF64: curr->op = DemoteFloat64; curr->type = f32; break; case BinaryConsts::F64ConvertF32: curr->op = PromoteFloat32; curr->type = f64; break; case BinaryConsts::F32ReinterpretI32: curr->op = ReinterpretFloat; curr->type = i32; break; -- cgit v1.2.3