wasmx / wasm-chisel

Some useful utilities to transform WebAssembly binaries.
Apache License 2.0
56 stars 11 forks source link

Add simple floating-point instruction checker. #118

Closed aarlt closed 5 years ago

aarlt commented 5 years ago

Closes #15

The following instructions where considered as floating point instructions: F32Eq, F32Ne, F32Lt, F32Gt, F32Le, F32Ge, F32Abs, F32Neg, F32Ceil, F32Floor, F32Trunc, F32Nearest, F32Sqrt, F32Add, F32Sub, F32Mul, F32Div, F32Min, F32Max, F32Copysign, I32TruncSF32, I32TruncUF32, I64TruncSF32, I64TruncUF32, F32ConvertSI32, F32ConvertUI32, F32ConvertSI64, F32ConvertUI64, F32DemoteF64, F64PromoteF32, I32ReinterpretF32, F32ReinterpretI32, F32x4Splat, F32x4Eq, F32x4Ne, F32x4Lt, F32x4Le, F32x4Gt, F32x4Ge, F32x4Neg, F32x4Abs, F32x4Min, F32x4Max, F32x4Add, F32x4Sub, F32x4Div, F32x4Mul, F32x4Sqrt, F32x4ConvertSI32x4, F32x4ConvertUI32x4, I32x4TruncSF32x4Sat, I32x4TruncUF32x4Sat, F64Eq, F64Ne, F64Lt, F64Gt, F64Le, F64Ge, F64Abs, F64Neg, F64Ceil, F64Floor, F64Trunc, F64Nearest, F64Sqrt, F64Add, F64Sub, F64Mul, F64Div, F64Min, F64Max, F64Copysign, I32TruncSF64, I32TruncUF64, I64TruncSF64, I64TruncUF64, F32DemoteF64, F64ConvertSI32, F64ConvertUI32, F64ConvertSI64, F64ConvertUI64, F64PromoteF32, I64ReinterpretF64, F64ReinterpretI64, F64x2Splat, F64x2Eq, F64x2Ne, F64x2Lt, F64x2Le, F64x2Gt, F64x2Ge, F64x2Neg, F64x2Abs, F64x2Min, F64x2Max, F64x2Add, F64x2Sub, F64x2Div, F64x2Mul, F64x2Sqrt, F64x2ConvertSI64x2, F64x2ConvertUI64x2, I64x2TruncSF64x2Sat, I64x2TruncUF64x2Sat, F32x4ExtractLane(a), F32x4ReplaceLane(a), F64x2ExtractLane(a), F64x2ReplaceLane(a), F32Const(a), F32Load(a,b), F32Store(a,b), F64Const(a), F64Load(a,b), F64Store(a,b).

EDIT: I thought it makes sense to also check the functions signatures for float types - but it will not make any sense in this PR. I guess this may be interesting for the general module validation.