Author: Mehdi Amini Date: 2025-08-19T14:04:34+02:00 New Revision: 8acdd2007bb69c69166ed64848127a9ca0735dce
URL: https://github.com/llvm/llvm-project/commit/8acdd2007bb69c69166ed64848127a9ca0735dce DIFF: https://github.com/llvm/llvm-project/commit/8acdd2007bb69c69166ed64848127a9ca0735dce.diff LOG: Revert "[MLIR][WASM] Extending the Wasm binary to WasmSSA dialect importer (#…" This reverts commit df57bb8c4945ec9039107f5e4efb281faf49b5db. Added: Modified: mlir/include/mlir/Target/Wasm/WasmBinaryEncoding.h mlir/lib/Target/Wasm/TranslateFromWasm.cpp Removed: mlir/test/Target/Wasm/abs.mlir mlir/test/Target/Wasm/and.mlir mlir/test/Target/Wasm/clz.mlir mlir/test/Target/Wasm/const.mlir mlir/test/Target/Wasm/copysign.mlir mlir/test/Target/Wasm/ctz.mlir mlir/test/Target/Wasm/div.mlir mlir/test/Target/Wasm/global.mlir mlir/test/Target/Wasm/inputs/abs.yaml.wasm mlir/test/Target/Wasm/inputs/and.yaml.wasm mlir/test/Target/Wasm/inputs/clz.yaml.wasm mlir/test/Target/Wasm/inputs/const.yaml.wasm mlir/test/Target/Wasm/inputs/copysign.yaml.wasm mlir/test/Target/Wasm/inputs/ctz.yaml.wasm mlir/test/Target/Wasm/inputs/div.yaml.wasm mlir/test/Target/Wasm/inputs/global.yaml.wasm mlir/test/Target/Wasm/inputs/local.yaml.wasm mlir/test/Target/Wasm/inputs/max.yaml.wasm mlir/test/Target/Wasm/inputs/min.yaml.wasm mlir/test/Target/Wasm/inputs/neg.yaml.wasm mlir/test/Target/Wasm/inputs/or.yaml.wasm mlir/test/Target/Wasm/inputs/popcnt.yaml.wasm mlir/test/Target/Wasm/inputs/rem.yaml.wasm mlir/test/Target/Wasm/inputs/rotl.yaml.wasm mlir/test/Target/Wasm/inputs/rotr.yaml.wasm mlir/test/Target/Wasm/inputs/shl.yaml.wasm mlir/test/Target/Wasm/inputs/shr_s.yaml.wasm mlir/test/Target/Wasm/inputs/shr_u.yaml.wasm mlir/test/Target/Wasm/inputs/sqrt.yaml.wasm mlir/test/Target/Wasm/inputs/sub.yaml.wasm mlir/test/Target/Wasm/inputs/xor.yaml.wasm mlir/test/Target/Wasm/local.mlir mlir/test/Target/Wasm/max.mlir mlir/test/Target/Wasm/min.mlir mlir/test/Target/Wasm/neg.mlir mlir/test/Target/Wasm/or.mlir mlir/test/Target/Wasm/popcnt.mlir mlir/test/Target/Wasm/rem.mlir mlir/test/Target/Wasm/rotl.mlir mlir/test/Target/Wasm/rotr.mlir mlir/test/Target/Wasm/shl.mlir mlir/test/Target/Wasm/shr_s.mlir mlir/test/Target/Wasm/shr_u.mlir mlir/test/Target/Wasm/sqrt.mlir mlir/test/Target/Wasm/sub.mlir mlir/test/Target/Wasm/xor.mlir ################################################################################ diff --git a/mlir/include/mlir/Target/Wasm/WasmBinaryEncoding.h b/mlir/include/mlir/Target/Wasm/WasmBinaryEncoding.h index 21adde878994e..3280432b5f038 100644 --- a/mlir/include/mlir/Target/Wasm/WasmBinaryEncoding.h +++ b/mlir/include/mlir/Target/Wasm/WasmBinaryEncoding.h @@ -20,79 +20,10 @@ struct WasmBinaryEncoding { /// Byte encodings for Wasm instructions. struct OpCode { // Locals, globals, constants. - static constexpr std::byte localGet{0x20}; - static constexpr std::byte localSet{0x21}; - static constexpr std::byte localTee{0x22}; - static constexpr std::byte globalGet{0x23}; static constexpr std::byte constI32{0x41}; static constexpr std::byte constI64{0x42}; static constexpr std::byte constFP32{0x43}; static constexpr std::byte constFP64{0x44}; - - // Numeric operations. - static constexpr std::byte clzI32{0x67}; - static constexpr std::byte ctzI32{0x68}; - static constexpr std::byte popcntI32{0x69}; - static constexpr std::byte addI32{0x6A}; - static constexpr std::byte subI32{0x6B}; - static constexpr std::byte mulI32{0x6C}; - static constexpr std::byte divSI32{0x6d}; - static constexpr std::byte divUI32{0x6e}; - static constexpr std::byte remSI32{0x6f}; - static constexpr std::byte remUI32{0x70}; - static constexpr std::byte andI32{0x71}; - static constexpr std::byte orI32{0x72}; - static constexpr std::byte xorI32{0x73}; - static constexpr std::byte shlI32{0x74}; - static constexpr std::byte shrSI32{0x75}; - static constexpr std::byte shrUI32{0x76}; - static constexpr std::byte rotlI32{0x77}; - static constexpr std::byte rotrI32{0x78}; - static constexpr std::byte clzI64{0x79}; - static constexpr std::byte ctzI64{0x7A}; - static constexpr std::byte popcntI64{0x7B}; - static constexpr std::byte addI64{0x7C}; - static constexpr std::byte subI64{0x7D}; - static constexpr std::byte mulI64{0x7E}; - static constexpr std::byte divSI64{0x7F}; - static constexpr std::byte divUI64{0x80}; - static constexpr std::byte remSI64{0x81}; - static constexpr std::byte remUI64{0x82}; - static constexpr std::byte andI64{0x83}; - static constexpr std::byte orI64{0x84}; - static constexpr std::byte xorI64{0x85}; - static constexpr std::byte shlI64{0x86}; - static constexpr std::byte shrSI64{0x87}; - static constexpr std::byte shrUI64{0x88}; - static constexpr std::byte rotlI64{0x89}; - static constexpr std::byte rotrI64{0x8A}; - static constexpr std::byte absF32{0x8B}; - static constexpr std::byte negF32{0x8C}; - static constexpr std::byte ceilF32{0x8D}; - static constexpr std::byte floorF32{0x8E}; - static constexpr std::byte truncF32{0x8F}; - static constexpr std::byte sqrtF32{0x91}; - static constexpr std::byte addF32{0x92}; - static constexpr std::byte subF32{0x93}; - static constexpr std::byte mulF32{0x94}; - static constexpr std::byte divF32{0x95}; - static constexpr std::byte minF32{0x96}; - static constexpr std::byte maxF32{0x97}; - static constexpr std::byte copysignF32{0x98}; - static constexpr std::byte absF64{0x99}; - static constexpr std::byte negF64{0x9A}; - static constexpr std::byte ceilF64{0x9B}; - static constexpr std::byte floorF64{0x9C}; - static constexpr std::byte truncF64{0x9D}; - static constexpr std::byte sqrtF64{0x9F}; - static constexpr std::byte addF64{0xA0}; - static constexpr std::byte subF64{0xA1}; - static constexpr std::byte mulF64{0xA2}; - static constexpr std::byte divF64{0xA3}; - static constexpr std::byte minF64{0xA4}; - static constexpr std::byte maxF64{0xA5}; - static constexpr std::byte copysignF64{0xA6}; - static constexpr std::byte wrap{0xA7}; }; /// Byte encodings of types in Wasm binaries diff --git a/mlir/lib/Target/Wasm/TranslateFromWasm.cpp b/mlir/lib/Target/Wasm/TranslateFromWasm.cpp index e3529f639842f..8d450520629eb 100644 --- a/mlir/lib/Target/Wasm/TranslateFromWasm.cpp +++ b/mlir/lib/Target/Wasm/TranslateFromWasm.cpp @@ -16,16 +16,15 @@ #include "mlir/IR/BuiltinAttributeInterfaces.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Location.h" -#include "mlir/Support/LLVM.h" #include "mlir/Target/Wasm/WasmBinaryEncoding.h" #include "mlir/Target/Wasm/WasmImporter.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Support/Debug.h" #include "llvm/Support/DebugLog.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/LEB128.h" -#include "llvm/Support/LogicalResult.h" -#include <cstddef> +#include <climits> #include <cstdint> #include <variant> @@ -149,22 +148,22 @@ struct WasmModuleSymbolTables { } std::string getNewFuncSymbolName() const { - size_t id = funcSymbols.size(); + auto id = funcSymbols.size(); return getNewSymbolName("func_", id); } std::string getNewGlobalSymbolName() const { - size_t id = globalSymbols.size(); + auto id = globalSymbols.size(); return getNewSymbolName("global_", id); } std::string getNewMemorySymbolName() const { - size_t id = memSymbols.size(); + auto id = memSymbols.size(); return getNewSymbolName("mem_", id); } std::string getNewTableSymbolName() const { - size_t id = tableSymbols.size(); + auto id = tableSymbols.size(); return getNewSymbolName("table_", id); } }; @@ -233,20 +232,6 @@ class ExpressionParser { parseConstInst(OpBuilder &builder, std::enable_if_t<std::is_arithmetic_v<valueT>> * = nullptr); - /// Construct an operation with \p numOperands operands and a single result. - /// Each operand must have the same type. Suitable for e.g. binops, unary - /// ops, etc. - /// - /// \p opcode - The WASM opcode to build. - /// \p valueType - The operand and result type for the built instruction. - /// \p numOperands - The number of operands for the built operation. - /// - /// \returns The parsed instruction result, or failure. - template <typename opcode, typename valueType, unsigned int numOperands> - inline parsed_inst_t - buildNumericOp(OpBuilder &builder, - std::enable_if_t<std::is_arithmetic_v<valueType>> * = nullptr); - /// This function generates a dispatch tree to associate an opcode with a /// parser. Parsers are registered by specialising the /// `parseSpecificInstruction` function for the op code to handle. @@ -301,16 +286,10 @@ class ExpressionParser { return valueStack.pushResults(results, ¤tOpLoc.value()); } - /// The local.set and local.tee operations behave similarly and only diff er - /// on their return value. This function factorizes the behavior of the two - /// operations in one place. - template <typename OpToCreate> - parsed_inst_t parseSetOrTee(OpBuilder &); - private: std::optional<Location> currentOpLoc; ParserHead &parser; - WasmModuleSymbolTables const &symbols; + [[maybe_unused]] WasmModuleSymbolTables const &symbols; locals_t locals; ValueStack valueStack; }; @@ -343,7 +322,7 @@ class ParserHead { } FailureOr<std::byte> consumeByte() { - FailureOr<StringRef> res = consumeNBytes(1); + auto res = consumeNBytes(1); if (failed(res)) return failure(); return std::byte{*res->bytes_begin()}; @@ -503,7 +482,7 @@ class ParserHead { FileLineColLoc importLoc = getLocation(); FailureOr<std::byte> importType = consumeByte(); auto packager = [](auto parseResult) -> FailureOr<ImportDesc> { - if (failed(parseResult)) + if (llvm::failed(parseResult)) return failure(); return {*parseResult}; }; @@ -531,60 +510,6 @@ class ParserHead { return eParser.parse(builder); } - LogicalResult parseCodeFor(FuncOp func, - WasmModuleSymbolTables const &symbols) { - SmallVector<local_val_t> locals{}; - // Populating locals with function argument - Block &block = func.getBody().front(); - // Delete temporary return argument which was only created for IR validity - assert(func.getBody().getBlocks().size() == 1 && - "Function should only have its default created block at this point"); - assert(block.getOperations().size() == 1 && - "Only the placeholder return op should be present at this point"); - auto returnOp = cast<ReturnOp>(&block.back()); - assert(returnOp); - - FailureOr<uint32_t> codeSizeInBytes = parseUI32(); - if (failed(codeSizeInBytes)) - return failure(); - FailureOr<StringRef> codeContent = consumeNBytes(*codeSizeInBytes); - if (failed(codeContent)) - return failure(); - auto name = StringAttr::get(func->getContext(), - locName.str() + "::" + func.getSymName()); - auto cParser = ParserHead{*codeContent, name}; - FailureOr<uint32_t> localVecSize = cParser.parseVectorSize(); - if (failed(localVecSize)) - return failure(); - OpBuilder builder{&func.getBody().front().back()}; - for (auto arg : block.getArguments()) - locals.push_back(cast<TypedValue<LocalRefType>>(arg)); - // Declare the local ops - uint32_t nVarVec = *localVecSize; - for (size_t i = 0; i < nVarVec; ++i) { - FileLineColLoc varLoc = cParser.getLocation(); - FailureOr<uint32_t> nSubVar = cParser.parseUI32(); - if (failed(nSubVar)) - return failure(); - FailureOr<Type> varT = cParser.parseValueType(func->getContext()); - if (failed(varT)) - return failure(); - for (size_t j = 0; j < *nSubVar; ++j) { - auto local = builder.create<LocalOp>(varLoc, *varT); - locals.push_back(local.getResult()); - } - } - parsed_inst_t res = cParser.parseExpression(builder, symbols, locals); - if (failed(res)) - return failure(); - if (!cParser.end()) - return emitError(cParser.getLocation(), - "unparsed garbage remaining at end of code block"); - builder.create<ReturnOp>(func->getLoc(), *res); - returnOp->erase(); - return success(); - } - bool end() const { return curHead().empty(); } ParserHead copy() const { return *this; } @@ -610,7 +535,7 @@ class ParserHead { template <> FailureOr<float> ParserHead::parseLiteral<float>() { - FailureOr<StringRef> bytes = consumeNBytes(4); + auto bytes = consumeNBytes(4); if (failed(bytes)) return failure(); float result; @@ -620,7 +545,7 @@ FailureOr<float> ParserHead::parseLiteral<float>() { template <> FailureOr<double> ParserHead::parseLiteral<double>() { - FailureOr<StringRef> bytes = consumeNBytes(8); + auto bytes = consumeNBytes(8); if (failed(bytes)) return failure(); double result; @@ -725,7 +650,7 @@ parsed_inst_t ValueStack::popOperands(TypeRange operandTypes, Location *opLoc) { << " Current stack size: " << values.size(); if (operandTypes.size() > values.size()) return emitError(*opLoc, - "stack doesn't contain enough values. trying to get ") + "stack doesn't contain enough values. Trying to get ") << operandTypes.size() << " operands on a stack containing only " << values.size() << " values."; size_t stackIdxOffset = values.size() - operandTypes.size(); @@ -735,7 +660,7 @@ parsed_inst_t ValueStack::popOperands(TypeRange operandTypes, Location *opLoc) { Value operand = values[i + stackIdxOffset]; Type stackType = operand.getType(); if (stackType != operandTypes[i]) - return emitError(*opLoc, "invalid operand type on stack. expecting ") + return emitError(*opLoc, "invalid operand type on stack. Expecting ") << operandTypes[i] << ", value on stack is of type " << stackType << "."; LDBG() << " POP: " << operand; @@ -793,70 +718,6 @@ ExpressionParser::parse(OpBuilder &builder, } } -template <> -inline parsed_inst_t ExpressionParser::parseSpecificInstruction< - WasmBinaryEncoding::OpCode::localGet>(OpBuilder &builder) { - FailureOr<uint32_t> id = parser.parseLiteral<uint32_t>(); - Location instLoc = *currentOpLoc; - if (failed(id)) - return failure(); - if (*id >= locals.size()) - return emitError(instLoc, "invalid local index. function has ") - << locals.size() << " accessible locals, received index " << *id; - return {{builder.create<LocalGetOp>(instLoc, locals[*id]).getResult()}}; -} - -template <> -inline parsed_inst_t ExpressionParser::parseSpecificInstruction< - WasmBinaryEncoding::OpCode::globalGet>(OpBuilder &builder) { - FailureOr<uint32_t> id = parser.parseLiteral<uint32_t>(); - Location instLoc = *currentOpLoc; - if (failed(id)) - return failure(); - if (*id >= symbols.globalSymbols.size()) - return emitError(instLoc, "invalid global index. function has ") - << symbols.globalSymbols.size() - << " accessible globals, received index " << *id; - GlobalSymbolRefContainer globalVar = symbols.globalSymbols[*id]; - auto globalOp = builder.create<GlobalGetOp>(instLoc, globalVar.globalType, - globalVar.symbol); - - return {{globalOp.getResult()}}; -} - -template <typename OpToCreate> -parsed_inst_t ExpressionParser::parseSetOrTee(OpBuilder &builder) { - FailureOr<uint32_t> id = parser.parseLiteral<uint32_t>(); - if (failed(id)) - return failure(); - if (*id >= locals.size()) - return emitError(*currentOpLoc, "invalid local index. function has ") - << locals.size() << " accessible locals, received index " << *id; - if (valueStack.empty()) - return emitError( - *currentOpLoc, - "invalid stack access, trying to access a value on an empty stack."); - - parsed_inst_t poppedOp = popOperands(locals[*id].getType().getElementType()); - if (failed(poppedOp)) - return failure(); - return { - builder.create<OpToCreate>(*currentOpLoc, locals[*id], poppedOp->front()) - ->getResults()}; -} - -template <> -inline parsed_inst_t ExpressionParser::parseSpecificInstruction< - WasmBinaryEncoding::OpCode::localSet>(OpBuilder &builder) { - return parseSetOrTee<LocalSetOp>(builder); -} - -template <> -inline parsed_inst_t ExpressionParser::parseSpecificInstruction< - WasmBinaryEncoding::OpCode::localTee>(OpBuilder &builder) { - return parseSetOrTee<LocalTeeOp>(builder); -} - template <typename T> inline Type buildLiteralType(OpBuilder &); @@ -949,94 +810,6 @@ inline parsed_inst_t ExpressionParser::parseSpecificInstruction< return parseConstInst<double>(builder); } -template <typename opcode, typename valueType, unsigned int numOperands> -inline parsed_inst_t ExpressionParser::buildNumericOp( - OpBuilder &builder, std::enable_if_t<std::is_arithmetic_v<valueType>> *) { - auto ty = buildLiteralType<valueType>(builder); - LDBG() << "*** buildNumericOp: numOperands = " << numOperands - << ", type = " << ty << " ***"; - auto tysToPop = SmallVector<Type, numOperands>(); - tysToPop.resize(numOperands); - std::fill(tysToPop.begin(), tysToPop.end(), ty); - auto operands = popOperands(tysToPop); - if (failed(operands)) - return failure(); - auto op = builder.create<opcode>(*currentOpLoc, *operands).getResult(); - LDBG() << "Built operation: " << op; - return {{op}}; -} - -// Convenience macro for generating numerical operations. -#define BUILD_NUMERIC_OP(OP_NAME, N_ARGS, PREFIX, SUFFIX, TYPE) \ - template <> \ - inline parsed_inst_t ExpressionParser::parseSpecificInstruction< \ - WasmBinaryEncoding::OpCode::PREFIX##SUFFIX>(OpBuilder & builder) { \ - return buildNumericOp<OP_NAME, TYPE, N_ARGS>(builder); \ - } - -// Macro to define binops that only support integer types. -#define BUILD_NUMERIC_BINOP_INT(OP_NAME, PREFIX) \ - BUILD_NUMERIC_OP(OP_NAME, 2, PREFIX, I32, int32_t) \ - BUILD_NUMERIC_OP(OP_NAME, 2, PREFIX, I64, int64_t) - -// Macro to define binops that only support floating point types. -#define BUILD_NUMERIC_BINOP_FP(OP_NAME, PREFIX) \ - BUILD_NUMERIC_OP(OP_NAME, 2, PREFIX, F32, float) \ - BUILD_NUMERIC_OP(OP_NAME, 2, PREFIX, F64, double) - -// Macro to define binops that support both floating point and integer types. -#define BUILD_NUMERIC_BINOP_INTFP(OP_NAME, PREFIX) \ - BUILD_NUMERIC_BINOP_INT(OP_NAME, PREFIX) \ - BUILD_NUMERIC_BINOP_FP(OP_NAME, PREFIX) - -// Macro to implement unary ops that only support integers. -#define BUILD_NUMERIC_UNARY_OP_INT(OP_NAME, PREFIX) \ - BUILD_NUMERIC_OP(OP_NAME, 1, PREFIX, I32, int32_t) \ - BUILD_NUMERIC_OP(OP_NAME, 1, PREFIX, I64, int64_t) - -// Macro to implement unary ops that support integer and floating point types. -#define BUILD_NUMERIC_UNARY_OP_FP(OP_NAME, PREFIX) \ - BUILD_NUMERIC_OP(OP_NAME, 1, PREFIX, F32, float) \ - BUILD_NUMERIC_OP(OP_NAME, 1, PREFIX, F64, double) - -BUILD_NUMERIC_BINOP_FP(CopySignOp, copysign) -BUILD_NUMERIC_BINOP_FP(DivOp, div) -BUILD_NUMERIC_BINOP_FP(MaxOp, max) -BUILD_NUMERIC_BINOP_FP(MinOp, min) -BUILD_NUMERIC_BINOP_INT(AndOp, and) -BUILD_NUMERIC_BINOP_INT(DivSIOp, divS) -BUILD_NUMERIC_BINOP_INT(DivUIOp, divU) -BUILD_NUMERIC_BINOP_INT(OrOp, or) -BUILD_NUMERIC_BINOP_INT(RemSIOp, remS) -BUILD_NUMERIC_BINOP_INT(RemUIOp, remU) -BUILD_NUMERIC_BINOP_INT(RotlOp, rotl) -BUILD_NUMERIC_BINOP_INT(RotrOp, rotr) -BUILD_NUMERIC_BINOP_INT(ShLOp, shl) -BUILD_NUMERIC_BINOP_INT(ShRSOp, shrS) -BUILD_NUMERIC_BINOP_INT(ShRUOp, shrU) -BUILD_NUMERIC_BINOP_INT(XOrOp, xor) -BUILD_NUMERIC_BINOP_INTFP(AddOp, add) -BUILD_NUMERIC_BINOP_INTFP(MulOp, mul) -BUILD_NUMERIC_BINOP_INTFP(SubOp, sub) -BUILD_NUMERIC_UNARY_OP_FP(AbsOp, abs) -BUILD_NUMERIC_UNARY_OP_FP(CeilOp, ceil) -BUILD_NUMERIC_UNARY_OP_FP(FloorOp, floor) -BUILD_NUMERIC_UNARY_OP_FP(NegOp, neg) -BUILD_NUMERIC_UNARY_OP_FP(SqrtOp, sqrt) -BUILD_NUMERIC_UNARY_OP_FP(TruncOp, trunc) -BUILD_NUMERIC_UNARY_OP_INT(ClzOp, clz) -BUILD_NUMERIC_UNARY_OP_INT(CtzOp, ctz) -BUILD_NUMERIC_UNARY_OP_INT(PopCntOp, popcnt) - -// Don't need these anymore so let's undef them. -#undef BUILD_NUMERIC_BINOP_FP -#undef BUILD_NUMERIC_BINOP_INT -#undef BUILD_NUMERIC_BINOP_INTFP -#undef BUILD_NUMERIC_UNARY_OP_FP -#undef BUILD_NUMERIC_UNARY_OP_INT -#undef BUILD_NUMERIC_OP -#undef BUILD_NUMERIC_CAST_OP - class WasmBinaryParser { private: struct SectionRegistry { @@ -1134,7 +907,7 @@ class WasmBinaryParser { if (failed(nElemsParsed)) return failure(); uint32_t nElems = *nElemsParsed; - LDBG() << "starting to parse " << nElems << " items for section " + LDBG() << "Starting to parse " << nElems << " items for section " << secName; for (size_t i = 0; i < nElems; ++i) { if (failed(parseSectionItem<section>(ph, i))) @@ -1233,7 +1006,7 @@ class WasmBinaryParser { return; if (version->compare(expectedVersionString)) { emitError(versionLoc, - "unsupported Wasm version. only version 1 is supported"); + "unsupported Wasm version. Only version 1 is supported."); return; } LogicalResult fillRegistry = registry.populateFromBody(parser.copy()); @@ -1264,14 +1037,6 @@ class WasmBinaryParser { if (failed(parsingMems)) return; - LogicalResult parsingGlobals = parseSection<WasmSectionType::GLOBAL>(); - if (failed(parsingGlobals)) - return; - - LogicalResult parsingCode = parseSection<WasmSectionType::CODE>(); - if (failed(parsingCode)) - return; - LogicalResult parsingExports = parseSection<WasmSectionType::EXPORT>(); if (failed(parsingExports)) return; @@ -1428,9 +1193,10 @@ WasmBinaryParser::parseSectionItem<WasmSectionType::FUNCTION>(ParserHead &ph, auto funcOp = FuncOp::create(builder, opLoc, symbol, symbols.moduleFuncTypes[typeIdx]); Block *block = funcOp.addEntryBlock(); - OpBuilder::InsertionGuard guard{builder}; + auto ip = builder.saveInsertionPoint(); builder.setInsertionPointToEnd(block); ReturnOp::create(builder, opLoc); + builder.restoreInsertionPoint(ip); symbols.funcSymbols.push_back( {{FlatSymbolRefAttr::get(funcOp.getSymNameAttr())}, symbols.moduleFuncTypes[typeIdx]}); @@ -1464,50 +1230,6 @@ WasmBinaryParser::parseSectionItem<WasmSectionType::MEMORY>(ParserHead &ph, symbols.memSymbols.push_back({SymbolRefAttr::get(memOp)}); return success(); } - -template <> -LogicalResult -WasmBinaryParser::parseSectionItem<WasmSectionType::GLOBAL>(ParserHead &ph, - size_t) { - FileLineColLoc globalLocation = ph.getLocation(); - auto globalTypeParsed = ph.parseGlobalType(ctx); - if (failed(globalTypeParsed)) - return failure(); - - GlobalTypeRecord globalType = *globalTypeParsed; - auto symbol = builder.getStringAttr(symbols.getNewGlobalSymbolName()); - auto globalOp = builder.create<wasmssa::GlobalOp>( - globalLocation, symbol, globalType.type, globalType.isMutable); - symbols.globalSymbols.push_back( - {{FlatSymbolRefAttr::get(globalOp)}, globalOp.getType()}); - OpBuilder::InsertionGuard guard{builder}; - Block *block = builder.createBlock(&globalOp.getInitializer()); - builder.setInsertionPointToStart(block); - parsed_inst_t expr = ph.parseExpression(builder, symbols); - if (failed(expr)) - return failure(); - if (block->empty()) - return emitError(globalLocation, "global with empty initializer"); - if (expr->size() != 1 && (*expr)[0].getType() != globalType.type) - return emitError( - globalLocation, - "initializer result type does not match global declaration type"); - builder.create<ReturnOp>(globalLocation, *expr); - return success(); -} - -template <> -LogicalResult WasmBinaryParser::parseSectionItem<WasmSectionType::CODE>( - ParserHead &ph, size_t innerFunctionId) { - unsigned long funcId = innerFunctionId + firstInternalFuncID; - FunctionSymbolRefContainer symRef = symbols.funcSymbols[funcId]; - auto funcOp = - dyn_cast<FuncOp>(SymbolTable::lookupSymbolIn(mOp, symRef.symbol)); - assert(funcOp); - if (failed(ph.parseCodeFor(funcOp, symbols))) - return failure(); - return success(); -} } // namespace namespace mlir::wasm { diff --git a/mlir/test/Target/Wasm/abs.mlir b/mlir/test/Target/Wasm/abs.mlir deleted file mode 100644 index 9c45ba78507ad..0000000000000 --- a/mlir/test/Target/Wasm/abs.mlir +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: yaml2obj %S/inputs/abs.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "abs_f32") (result f32) - f32.const 10 - f32.abs) - - (func (export "abs_f64") (result f64) - f64.const 10 - f64.abs) -) -*/ - -// CHECK-LABEL: wasmssa.func @abs_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.abs %[[VAL_0]] : f32 -// CHECK: wasmssa.return %[[VAL_1]] : f32 - -// CHECK-LABEL: wasmssa.func @abs_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.abs %[[VAL_0]] : f64 -// CHECK: wasmssa.return %[[VAL_1]] : f64 diff --git a/mlir/test/Target/Wasm/and.mlir b/mlir/test/Target/Wasm/and.mlir deleted file mode 100644 index 4c0fea01b3ae6..0000000000000 --- a/mlir/test/Target/Wasm/and.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/and.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "and_i32") (result i32) - i32.const 10 - i32.const 3 - i32.and) - - (func (export "and_i64") (result i64) - i64.const 10 - i64.const 3 - i64.and) -) -*/ - -// CHECK-LABEL: wasmssa.func @and_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.and %0 %1 : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @and_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.and %0 %1 : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/clz.mlir b/mlir/test/Target/Wasm/clz.mlir deleted file mode 100644 index 3e6641d9a2a96..0000000000000 --- a/mlir/test/Target/Wasm/clz.mlir +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: yaml2obj %S/inputs/clz.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "clz_i32") (result i32) - i32.const 10 - i32.clz - ) - - (func (export "clz_i64") (result i64) - i64.const 10 - i64.clz - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @clz_i32() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.clz %[[VAL_0]] : i32 -// CHECK: wasmssa.return %[[VAL_1]] : i32 - -// CHECK-LABEL: wasmssa.func @clz_i64() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.clz %[[VAL_0]] : i64 -// CHECK: wasmssa.return %[[VAL_1]] : i64 diff --git a/mlir/test/Target/Wasm/const.mlir b/mlir/test/Target/Wasm/const.mlir deleted file mode 100644 index aa9e76f8502b6..0000000000000 --- a/mlir/test/Target/Wasm/const.mlir +++ /dev/null @@ -1,37 +0,0 @@ -// RUN: yaml2obj %S/inputs/const.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s -/* Source code used to create this test: -(module - (func(result i32) - i32.const 1 - ) - (func (result i64) - i64.const 3 - ) - (func (result f32) - f32.const 4.0 - ) - (func (result f64) - f64.const 9.0 - ) -) -*/ - -// CHECK-LABEL: wasmssa.func nested @func_0() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1 : i32 -// CHECK: wasmssa.return %[[VAL_0]] : i32 -// CHECK: } - -// CHECK-LABEL: wasmssa.func nested @func_1() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 3 : i64 -// CHECK: wasmssa.return %[[VAL_0]] : i64 -// CHECK: } - -// CHECK-LABEL: wasmssa.func nested @func_2() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 4.000000e+00 : f32 -// CHECK: wasmssa.return %[[VAL_0]] : f32 -// CHECK: } - -// CHECK-LABEL: wasmssa.func nested @func_3() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 9.000000e+00 : f64 -// CHECK: wasmssa.return %[[VAL_0]] : f64 -// CHECK: } diff --git a/mlir/test/Target/Wasm/copysign.mlir b/mlir/test/Target/Wasm/copysign.mlir deleted file mode 100644 index 33d7a56694c1c..0000000000000 --- a/mlir/test/Target/Wasm/copysign.mlir +++ /dev/null @@ -1,31 +0,0 @@ -// RUN: yaml2obj %S/inputs/copysign.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "copysign_f32") (result f32) - f32.const 10 - f32.const 1 - f32.copysign - ) - - (func (export "copysign_f64") (result f64) - f64.const 10 - f64.const 1 - f64.copysign - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @copysign_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.000000e+00 : f32 -// CHECK: %[[VAL_2:.*]] = wasmssa.copysign %[[VAL_0]] %[[VAL_1]] : f32 -// CHECK: wasmssa.return %[[VAL_2]] : f32 -// CHECK: } - -// CHECK-LABEL: wasmssa.func @copysign_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.000000e+00 : f64 -// CHECK: %[[VAL_2:.*]] = wasmssa.copysign %[[VAL_0]] %[[VAL_1]] : f64 -// CHECK: wasmssa.return %[[VAL_2]] : f64 -// CHECK: } diff --git a/mlir/test/Target/Wasm/ctz.mlir b/mlir/test/Target/Wasm/ctz.mlir deleted file mode 100644 index 6c0806f62303c..0000000000000 --- a/mlir/test/Target/Wasm/ctz.mlir +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: yaml2obj %S/inputs/ctz.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "ctz_i32") (result i32) - i32.const 10 - i32.ctz - ) - - (func (export "ctz_i64") (result i64) - i64.const 10 - i64.ctz - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @ctz_i32() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.ctz %[[VAL_0]] : i32 -// CHECK: wasmssa.return %[[VAL_1]] : i32 - -// CHECK-LABEL: wasmssa.func @ctz_i64() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.ctz %[[VAL_0]] : i64 -// CHECK: wasmssa.return %[[VAL_1]] : i64 diff --git a/mlir/test/Target/Wasm/div.mlir b/mlir/test/Target/Wasm/div.mlir deleted file mode 100644 index c91f7809a255d..0000000000000 --- a/mlir/test/Target/Wasm/div.mlir +++ /dev/null @@ -1,127 +0,0 @@ -// RUN: yaml2obj %S/inputs/div.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to create this test: -(module - (func (export "div_u_i32") (result i32) - i32.const 10 - i32.const 2 - i32.div_u - ) - - (func (export "div_u_i32_zero") (result i32) - i32.const 10 - i32.const 0 - i32.div_u - ) - - (func (export "div_s_i32") (result i32) - i32.const 10 - i32.const 2 - i32.div_s - ) - - (func (export "div_s_i32_zero") (result i32) - i32.const 10 - i32.const 0 - i32.div_s - ) - - (func (export "div_u_i64") (result i64) - i64.const 10 - i64.const 2 - i64.div_u - ) - - ;; explode - (func (export "div_u_i64_zero") (result i64) - i64.const 10 - i64.const 0 - i64.div_u - ) - - (func (export "div_s_i64") (result i64) - i64.const 10 - i64.const 2 - i64.div_s - ) - - ;; explode - (func (export "div_s_i64_zero") (result i64) - i64.const 10 - i64.const 0 - i64.div_s - ) - - (func (export "div_f32") (result f32) - f32.const 10 - f32.const 2 - f32.div - ) - - (func (export "div_f64") (result f64) - f64.const 10 - f64.const 2 - f64.div - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @div_u_i32() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 2 : i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_ui %[[VAL_0]] %[[VAL_1]] : i32 -// CHECK: wasmssa.return %[[VAL_2]] : i32 - -// CHECK-LABEL: wasmssa.func @div_u_i32_zero() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 0 : i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_ui %[[VAL_0]] %[[VAL_1]] : i32 -// CHECK: wasmssa.return %[[VAL_2]] : i32 - -// CHECK-LABEL: wasmssa.func @div_s_i32() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 2 : i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_si %[[VAL_0]] %[[VAL_1]] : i32 -// CHECK: wasmssa.return %[[VAL_2]] : i32 - -// CHECK-LABEL: wasmssa.func @div_s_i32_zero() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 0 : i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_si %[[VAL_0]] %[[VAL_1]] : i32 -// CHECK: wasmssa.return %[[VAL_2]] : i32 - -// CHECK-LABEL: wasmssa.func @div_u_i64() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 2 : i64 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_ui %[[VAL_0]] %[[VAL_1]] : i64 -// CHECK: wasmssa.return %[[VAL_2]] : i64 - -// CHECK-LABEL: wasmssa.func @div_u_i64_zero() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 0 : i64 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_ui %[[VAL_0]] %[[VAL_1]] : i64 -// CHECK: wasmssa.return %[[VAL_2]] : i64 - -// CHECK-LABEL: wasmssa.func @div_s_i64() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 2 : i64 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_si %[[VAL_0]] %[[VAL_1]] : i64 -// CHECK: wasmssa.return %[[VAL_2]] : i64 - -// CHECK-LABEL: wasmssa.func @div_s_i64_zero() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 0 : i64 -// CHECK: %[[VAL_2:.*]] = wasmssa.div_si %[[VAL_0]] %[[VAL_1]] : i64 -// CHECK: wasmssa.return %[[VAL_2]] : i64 - -// CHECK-LABEL: wasmssa.func @div_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 2.000000e+00 : f32 -// CHECK: %[[VAL_2:.*]] = wasmssa.div %[[VAL_0]] %[[VAL_1]] : f32 -// CHECK: wasmssa.return %[[VAL_2]] : f32 - -// CHECK-LABEL: wasmssa.func @div_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 2.000000e+00 : f64 -// CHECK: %[[VAL_2:.*]] = wasmssa.div %[[VAL_0]] %[[VAL_1]] : f64 -// CHECK: wasmssa.return %[[VAL_2]] : f64 diff --git a/mlir/test/Target/Wasm/global.mlir b/mlir/test/Target/Wasm/global.mlir deleted file mode 100644 index e72fe69666999..0000000000000 --- a/mlir/test/Target/Wasm/global.mlir +++ /dev/null @@ -1,66 +0,0 @@ -// RUN: yaml2obj %S/inputs/global.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s -/* Source code used to create this test: -(module - -;; import a global variable from js -(global $imported_glob (import "env" "from_js") i32) - -;; create a global variable -(global $normal_glob i32(i32.const 10)) -(global $glob_mut (mut i32) (i32.const 10)) -(global $glob_mut_ext (mut i32) (i32.const 10)) - -(global $normal_glob_i64 i64(i64.const 11)) -(global $normal_glob_f32 f32(f32.const 12)) -(global $normal_glob_f64 f64(f64.const 13)) - -(func $main (result i32) -;; load both global variables onto the stack -global.get $imported_glob -global.get $normal_glob - -i32.add ;; add up both globals - -global.get $glob_mut -global.get $glob_mut_ext -i32.add -i32.add -) -) -*/ - -// CHECK-LABEL: wasmssa.import_global "from_js" from "env" as @global_0 nested : i32 - -// CHECK-LABEL: wasmssa.func nested @func_0() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.global_get @global_0 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.global_get @global_1 : i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.add %[[VAL_0]] %[[VAL_1]] : i32 -// CHECK: %[[VAL_3:.*]] = wasmssa.global_get @global_2 : i32 -// CHECK: %[[VAL_4:.*]] = wasmssa.global_get @global_3 : i32 -// CHECK: %[[VAL_5:.*]] = wasmssa.add %[[VAL_3]] %[[VAL_4]] : i32 -// CHECK: %[[VAL_6:.*]] = wasmssa.add %[[VAL_2]] %[[VAL_5]] : i32 -// CHECK: wasmssa.return %[[VAL_6]] : i32 - -// CHECK-LABEL: wasmssa.global @global_1 i32 nested : { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: wasmssa.return %[[VAL_0]] : i32 - -// CHECK-LABEL: wasmssa.global @global_2 i32 mutable nested : { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: wasmssa.return %[[VAL_0]] : i32 - -// CHECK-LABEL: wasmssa.global @global_3 i32 mutable nested : { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: wasmssa.return %[[VAL_0]] : i32 - -// CHECK-LABEL: wasmssa.global @global_4 i64 nested : { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 11 : i64 -// CHECK: wasmssa.return %[[VAL_0]] : i64 - -// CHECK-LABEL: wasmssa.global @global_5 f32 nested : { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.200000e+01 : f32 -// CHECK: wasmssa.return %[[VAL_0]] : f32 - -// CHECK-LABEL: wasmssa.global @global_6 f64 nested : { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.300000e+01 : f64 -// CHECK: wasmssa.return %[[VAL_0]] : f64 diff --git a/mlir/test/Target/Wasm/inputs/abs.yaml.wasm b/mlir/test/Target/Wasm/inputs/abs.yaml.wasm deleted file mode 100644 index 1cb6d21b2fdd4..0000000000000 --- a/mlir/test/Target/Wasm/inputs/abs.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: abs_f32 - Kind: FUNCTION - Index: 0 - - Name: abs_f64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 43000020418B0B - - Index: 1 - Locals: [] - Body: 440000000000002440990B -... diff --git a/mlir/test/Target/Wasm/inputs/and.yaml.wasm b/mlir/test/Target/Wasm/inputs/and.yaml.wasm deleted file mode 100644 index 926445b761080..0000000000000 --- a/mlir/test/Target/Wasm/inputs/and.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: and_i32 - Kind: FUNCTION - Index: 0 - - Name: and_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103710B - - Index: 1 - Locals: [] - Body: 420A4203830B -... diff --git a/mlir/test/Target/Wasm/inputs/clz.yaml.wasm b/mlir/test/Target/Wasm/inputs/clz.yaml.wasm deleted file mode 100644 index f537bdb359241..0000000000000 --- a/mlir/test/Target/Wasm/inputs/clz.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: clz_i32 - Kind: FUNCTION - Index: 0 - - Name: clz_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A670B - - Index: 1 - Locals: [] - Body: 420A790B -... diff --git a/mlir/test/Target/Wasm/inputs/const.yaml.wasm b/mlir/test/Target/Wasm/inputs/const.yaml.wasm deleted file mode 100644 index be8f88e2f3be4..0000000000000 --- a/mlir/test/Target/Wasm/inputs/const.yaml.wasm +++ /dev/null @@ -1,39 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Index: 2 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 3 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1, 2, 3 ] - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 41010B - - Index: 1 - Locals: [] - Body: 42030B - - Index: 2 - Locals: [] - Body: 43000080400B - - Index: 3 - Locals: [] - Body: 4400000000000022400B -... diff --git a/mlir/test/Target/Wasm/inputs/copysign.yaml.wasm b/mlir/test/Target/Wasm/inputs/copysign.yaml.wasm deleted file mode 100644 index 46c04124ac84a..0000000000000 --- a/mlir/test/Target/Wasm/inputs/copysign.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: copysign_f32 - Kind: FUNCTION - Index: 0 - - Name: copysign_f64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 4300002041430000803F980B - - Index: 1 - Locals: [] - Body: 44000000000000244044000000000000F03FA60B -... diff --git a/mlir/test/Target/Wasm/inputs/ctz.yaml.wasm b/mlir/test/Target/Wasm/inputs/ctz.yaml.wasm deleted file mode 100644 index 51400852d3dce..0000000000000 --- a/mlir/test/Target/Wasm/inputs/ctz.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: ctz_i32 - Kind: FUNCTION - Index: 0 - - Name: ctz_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A680B - - Index: 1 - Locals: [] - Body: 420A7A0B -... diff --git a/mlir/test/Target/Wasm/inputs/div.yaml.wasm b/mlir/test/Target/Wasm/inputs/div.yaml.wasm deleted file mode 100644 index 648e10c15cbed..0000000000000 --- a/mlir/test/Target/Wasm/inputs/div.yaml.wasm +++ /dev/null @@ -1,89 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Index: 2 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 3 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 0, 0, 0, 1, 1, 1, 1, 2, 3 ] - - Type: EXPORT - Exports: - - Name: div_u_i32 - Kind: FUNCTION - Index: 0 - - Name: div_u_i32_zero - Kind: FUNCTION - Index: 1 - - Name: div_s_i32 - Kind: FUNCTION - Index: 2 - - Name: div_s_i32_zero - Kind: FUNCTION - Index: 3 - - Name: div_u_i64 - Kind: FUNCTION - Index: 4 - - Name: div_u_i64_zero - Kind: FUNCTION - Index: 5 - - Name: div_s_i64 - Kind: FUNCTION - Index: 6 - - Name: div_s_i64_zero - Kind: FUNCTION - Index: 7 - - Name: div_f32 - Kind: FUNCTION - Index: 8 - - Name: div_f64 - Kind: FUNCTION - Index: 9 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A41026E0B - - Index: 1 - Locals: [] - Body: 410A41006E0B - - Index: 2 - Locals: [] - Body: 410A41026D0B - - Index: 3 - Locals: [] - Body: 410A41006D0B - - Index: 4 - Locals: [] - Body: 420A4202800B - - Index: 5 - Locals: [] - Body: 420A4200800B - - Index: 6 - Locals: [] - Body: 420A42027F0B - - Index: 7 - Locals: [] - Body: 420A42007F0B - - Index: 8 - Locals: [] - Body: 43000020414300000040950B - - Index: 9 - Locals: [] - Body: 440000000000002440440000000000000040A30B -... diff --git a/mlir/test/Target/Wasm/inputs/global.yaml.wasm b/mlir/test/Target/Wasm/inputs/global.yaml.wasm deleted file mode 100644 index 4bbb434c0c51a..0000000000000 --- a/mlir/test/Target/Wasm/inputs/global.yaml.wasm +++ /dev/null @@ -1,63 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Type: IMPORT - Imports: - - Module: env - Field: from_js - Kind: GLOBAL - GlobalType: I32 - GlobalMutable: false - - Type: FUNCTION - FunctionTypes: [ 0 ] - - Type: GLOBAL - Globals: - - Index: 1 - Type: I32 - Mutable: false - InitExpr: - Opcode: I32_CONST - Value: 10 - - Index: 2 - Type: I32 - Mutable: true - InitExpr: - Opcode: I32_CONST - Value: 10 - - Index: 3 - Type: I32 - Mutable: true - InitExpr: - Opcode: I32_CONST - Value: 10 - - Index: 4 - Type: I64 - Mutable: false - InitExpr: - Opcode: I64_CONST - Value: 11 - - Index: 5 - Type: F32 - Mutable: false - InitExpr: - Opcode: F32_CONST - Value: 1094713344 - - Index: 6 - Type: F64 - Mutable: false - InitExpr: - Opcode: F64_CONST - Value: 4623507967449235456 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 230023016A230223036A6A0B -... diff --git a/mlir/test/Target/Wasm/inputs/local.yaml.wasm b/mlir/test/Target/Wasm/inputs/local.yaml.wasm deleted file mode 100644 index 3e937f3e7402a..0000000000000 --- a/mlir/test/Target/Wasm/inputs/local.yaml.wasm +++ /dev/null @@ -1,37 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 2 - ParamTypes: - - I32 - ReturnTypes: - - I32 - - Type: FUNCTION - FunctionTypes: [ 0, 1, 2 ] - - Type: CODE - Functions: - - Index: 0 - Locals: - - Type: F32 - Count: 2 - Body: 43000000412100200043000040412201920B - - Index: 1 - Locals: - - Type: I32 - Count: 2 - Body: 410821002000410C22016A0B - - Index: 2 - Locals: [] - Body: 4103210020000B -... diff --git a/mlir/test/Target/Wasm/inputs/max.yaml.wasm b/mlir/test/Target/Wasm/inputs/max.yaml.wasm deleted file mode 100644 index fc04b019fe34c..0000000000000 --- a/mlir/test/Target/Wasm/inputs/max.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: min_f32 - Kind: FUNCTION - Index: 0 - - Name: min_f64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 4300002041430000803F970B - - Index: 1 - Locals: [] - Body: 44000000000000244044000000000000F03FA50B -... diff --git a/mlir/test/Target/Wasm/inputs/min.yaml.wasm b/mlir/test/Target/Wasm/inputs/min.yaml.wasm deleted file mode 100644 index 925a5e96b43c9..0000000000000 --- a/mlir/test/Target/Wasm/inputs/min.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: min_f32 - Kind: FUNCTION - Index: 0 - - Name: min_f64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 4300002041430000803F960B - - Index: 1 - Locals: [] - Body: 44000000000000244044000000000000F03FA40B -... diff --git a/mlir/test/Target/Wasm/inputs/neg.yaml.wasm b/mlir/test/Target/Wasm/inputs/neg.yaml.wasm deleted file mode 100644 index 8392a2bf9a5fb..0000000000000 --- a/mlir/test/Target/Wasm/inputs/neg.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: neg_f32 - Kind: FUNCTION - Index: 0 - - Name: neg_f64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 43000020418C0B - - Index: 1 - Locals: [] - Body: 4400000000000024409A0B -... diff --git a/mlir/test/Target/Wasm/inputs/or.yaml.wasm b/mlir/test/Target/Wasm/inputs/or.yaml.wasm deleted file mode 100644 index 9528ce8b3f911..0000000000000 --- a/mlir/test/Target/Wasm/inputs/or.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: or_i32 - Kind: FUNCTION - Index: 0 - - Name: or_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103720B - - Index: 1 - Locals: [] - Body: 420A4203840B -... diff --git a/mlir/test/Target/Wasm/inputs/popcnt.yaml.wasm b/mlir/test/Target/Wasm/inputs/popcnt.yaml.wasm deleted file mode 100644 index 03c57ad0841b9..0000000000000 --- a/mlir/test/Target/Wasm/inputs/popcnt.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: popcnt_i32 - Kind: FUNCTION - Index: 0 - - Name: popcnt_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A690B - - Index: 1 - Locals: [] - Body: 420A7B0B -... diff --git a/mlir/test/Target/Wasm/inputs/rem.yaml.wasm b/mlir/test/Target/Wasm/inputs/rem.yaml.wasm deleted file mode 100644 index 468a9db6f05ae..0000000000000 --- a/mlir/test/Target/Wasm/inputs/rem.yaml.wasm +++ /dev/null @@ -1,45 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1, 0, 1 ] - - Type: EXPORT - Exports: - - Name: rem_u_i32 - Kind: FUNCTION - Index: 0 - - Name: rem_u_i64 - Kind: FUNCTION - Index: 1 - - Name: rem_s_i32 - Kind: FUNCTION - Index: 2 - - Name: rem_s_i64 - Kind: FUNCTION - Index: 3 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103700B - - Index: 1 - Locals: [] - Body: 420A4203820B - - Index: 2 - Locals: [] - Body: 410A41036F0B - - Index: 3 - Locals: [] - Body: 420A4203810B -... diff --git a/mlir/test/Target/Wasm/inputs/rotl.yaml.wasm b/mlir/test/Target/Wasm/inputs/rotl.yaml.wasm deleted file mode 100644 index 87466cb16393f..0000000000000 --- a/mlir/test/Target/Wasm/inputs/rotl.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: rotl_i32 - Kind: FUNCTION - Index: 0 - - Name: rotl_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103770B - - Index: 1 - Locals: [] - Body: 420A4203890B -... diff --git a/mlir/test/Target/Wasm/inputs/rotr.yaml.wasm b/mlir/test/Target/Wasm/inputs/rotr.yaml.wasm deleted file mode 100644 index 805a93fd55a8c..0000000000000 --- a/mlir/test/Target/Wasm/inputs/rotr.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: rotr_i32 - Kind: FUNCTION - Index: 0 - - Name: rotr_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103780B - - Index: 1 - Locals: [] - Body: 420A42038A0B -... diff --git a/mlir/test/Target/Wasm/inputs/shl.yaml.wasm b/mlir/test/Target/Wasm/inputs/shl.yaml.wasm deleted file mode 100644 index d07605e599483..0000000000000 --- a/mlir/test/Target/Wasm/inputs/shl.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: shl_i32 - Kind: FUNCTION - Index: 0 - - Name: shl_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103740B - - Index: 1 - Locals: [] - Body: 420A4203860B -... diff --git a/mlir/test/Target/Wasm/inputs/shr_s.yaml.wasm b/mlir/test/Target/Wasm/inputs/shr_s.yaml.wasm deleted file mode 100644 index d5d8013a2f743..0000000000000 --- a/mlir/test/Target/Wasm/inputs/shr_s.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: shr_s_i32 - Kind: FUNCTION - Index: 0 - - Name: shr_s_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103750B - - Index: 1 - Locals: [] - Body: 420A4203870B -... diff --git a/mlir/test/Target/Wasm/inputs/shr_u.yaml.wasm b/mlir/test/Target/Wasm/inputs/shr_u.yaml.wasm deleted file mode 100644 index cd815144432f7..0000000000000 --- a/mlir/test/Target/Wasm/inputs/shr_u.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: shr_u_i32 - Kind: FUNCTION - Index: 0 - - Name: shr_u_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103760B - - Index: 1 - Locals: [] - Body: 420A4203880B -... diff --git a/mlir/test/Target/Wasm/inputs/sqrt.yaml.wasm b/mlir/test/Target/Wasm/inputs/sqrt.yaml.wasm deleted file mode 100644 index f8ab84be9255f..0000000000000 --- a/mlir/test/Target/Wasm/inputs/sqrt.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: sqrt_f32 - Kind: FUNCTION - Index: 0 - - Name: sqrt_f64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 4300002041910B - - Index: 1 - Locals: [] - Body: 4400000000000024409F0B -... diff --git a/mlir/test/Target/Wasm/inputs/sub.yaml.wasm b/mlir/test/Target/Wasm/inputs/sub.yaml.wasm deleted file mode 100644 index 95b6bcc1d9021..0000000000000 --- a/mlir/test/Target/Wasm/inputs/sub.yaml.wasm +++ /dev/null @@ -1,39 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Index: 2 - ParamTypes: [] - ReturnTypes: - - F32 - - Index: 3 - ParamTypes: [] - ReturnTypes: - - F64 - - Type: FUNCTION - FunctionTypes: [ 0, 1, 2, 3 ] - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410C41326B0B - - Index: 1 - Locals: [] - Body: 421442057D0B - - Index: 2 - Locals: [] - Body: 430000A0404300006041930B - - Index: 3 - Locals: [] - Body: 440000000000003140440000000000000000A10B -... diff --git a/mlir/test/Target/Wasm/inputs/xor.yaml.wasm b/mlir/test/Target/Wasm/inputs/xor.yaml.wasm deleted file mode 100644 index 45079c3b4fed3..0000000000000 --- a/mlir/test/Target/Wasm/inputs/xor.yaml.wasm +++ /dev/null @@ -1,33 +0,0 @@ ---- !WASM -FileHeader: - Version: 0x1 -Sections: - - Type: TYPE - Signatures: - - Index: 0 - ParamTypes: [] - ReturnTypes: - - I32 - - Index: 1 - ParamTypes: [] - ReturnTypes: - - I64 - - Type: FUNCTION - FunctionTypes: [ 0, 1 ] - - Type: EXPORT - Exports: - - Name: xor_i32 - Kind: FUNCTION - Index: 0 - - Name: xor_i64 - Kind: FUNCTION - Index: 1 - - Type: CODE - Functions: - - Index: 0 - Locals: [] - Body: 410A4103730B - - Index: 1 - Locals: [] - Body: 420A4203850B -... diff --git a/mlir/test/Target/Wasm/local.mlir b/mlir/test/Target/Wasm/local.mlir deleted file mode 100644 index 32f590021b959..0000000000000 --- a/mlir/test/Target/Wasm/local.mlir +++ /dev/null @@ -1,59 +0,0 @@ -// RUN: yaml2obj %S/inputs/local.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s -/* Source code used to create this test: -(module - (func $local_f32 (result f32) - (local $var1 f32) - (local $var2 f32) - f32.const 8.0 - local.set $var1 - local.get $var1 - f32.const 12.0 - local.tee $var2 - f32.add - ) - (func $local_i32 (result i32) - (local $var1 i32) - (local $var2 i32) - i32.const 8 - local.set $var1 - local.get $var1 - i32.const 12 - local.tee $var2 - i32.add - ) - (func $local_arg (param $var i32) (result i32) - i32.const 3 - local.set $var - local.get $var - ) -) -*/ - -// CHECK-LABEL: wasmssa.func nested @func_0() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.local of type f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.local of type f32 -// CHECK: %[[VAL_2:.*]] = wasmssa.const 8.000000e+00 : f32 -// CHECK: wasmssa.local_set %[[VAL_0]] : ref to f32 to %[[VAL_2]] : f32 -// CHECK: %[[VAL_3:.*]] = wasmssa.local_get %[[VAL_0]] : ref to f32 -// CHECK: %[[VAL_4:.*]] = wasmssa.const 1.200000e+01 : f32 -// CHECK: %[[VAL_5:.*]] = wasmssa.local_tee %[[VAL_1]] : ref to f32 to %[[VAL_4]] : f32 -// CHECK: %[[VAL_6:.*]] = wasmssa.add %[[VAL_3]] %[[VAL_5]] : f32 -// CHECK: wasmssa.return %[[VAL_6]] : f32 - -// CHECK-LABEL: wasmssa.func nested @func_1() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.local of type i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.local of type i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.const 8 : i32 -// CHECK: wasmssa.local_set %[[VAL_0]] : ref to i32 to %[[VAL_2]] : i32 -// CHECK: %[[VAL_3:.*]] = wasmssa.local_get %[[VAL_0]] : ref to i32 -// CHECK: %[[VAL_4:.*]] = wasmssa.const 12 : i32 -// CHECK: %[[VAL_5:.*]] = wasmssa.local_tee %[[VAL_1]] : ref to i32 to %[[VAL_4]] : i32 -// CHECK: %[[VAL_6:.*]] = wasmssa.add %[[VAL_3]] %[[VAL_5]] : i32 -// CHECK: wasmssa.return %[[VAL_6]] : i32 - -// CHECK-LABEL: wasmssa.func nested @func_2( -// CHECK-SAME: %[[ARG0:.*]]: !wasmssa<local ref to i32>) -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 3 : i32 -// CHECK: wasmssa.local_set %[[ARG0]] : ref to i32 to %[[VAL_0]] : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.local_get %[[ARG0]] : ref to i32 -// CHECK: wasmssa.return %[[VAL_1]] : i32 diff --git a/mlir/test/Target/Wasm/max.mlir b/mlir/test/Target/Wasm/max.mlir deleted file mode 100644 index 4ef2042d923b6..0000000000000 --- a/mlir/test/Target/Wasm/max.mlir +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: yaml2obj %S/inputs/max.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "max_f32") (result f32) - f32.const 10 - f32.const 1 - f32.max - ) - - (func (export "max_f64") (result f64) - f64.const 10 - f64.const 1 - f64.max - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @min_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.000000e+00 : f32 -// CHECK: %[[VAL_2:.*]] = wasmssa.max %[[VAL_0]] %[[VAL_1]] : f32 -// CHECK: wasmssa.return %[[VAL_2]] : f32 - - -// CHECK-LABEL: wasmssa.func @min_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.000000e+00 : f64 -// CHECK: %[[VAL_2:.*]] = wasmssa.max %[[VAL_0]] %[[VAL_1]] : f64 -// CHECK: wasmssa.return %[[VAL_2]] : f64 diff --git a/mlir/test/Target/Wasm/min.mlir b/mlir/test/Target/Wasm/min.mlir deleted file mode 100644 index 1058c7d32be71..0000000000000 --- a/mlir/test/Target/Wasm/min.mlir +++ /dev/null @@ -1,29 +0,0 @@ -// RUN: yaml2obj %S/inputs/min.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "min_f32") (result f32) - f32.const 10 - f32.const 1 - f32.min - ) - - (func (export "min_f64") (result f64) - f64.const 10 - f64.const 1 - f64.min - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @min_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.000000e+00 : f32 -// CHECK: %[[VAL_2:.*]] = wasmssa.min %[[VAL_0]] %[[VAL_1]] : f32 -// CHECK: wasmssa.return %[[VAL_2]] : f32 - -// CHECK-LABEL: wasmssa.func @min_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.000000e+00 : f64 -// CHECK: %[[VAL_2:.*]] = wasmssa.min %[[VAL_0]] %[[VAL_1]] : f64 -// CHECK: wasmssa.return %[[VAL_2]] : f64 diff --git a/mlir/test/Target/Wasm/neg.mlir b/mlir/test/Target/Wasm/neg.mlir deleted file mode 100644 index 5811ab50348bd..0000000000000 --- a/mlir/test/Target/Wasm/neg.mlir +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: yaml2obj %S/inputs/neg.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "neg_f32") (result f32) - f32.const 10 - f32.neg) - - (func (export "neg_f64") (result f64) - f64.const 10 - f64.neg) -) -*/ - -// CHECK-LABEL: wasmssa.func @neg_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.neg %[[VAL_0]] : f32 -// CHECK: wasmssa.return %[[VAL_1]] : f32 - -// CHECK-LABEL: wasmssa.func @neg_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.neg %[[VAL_0]] : f64 -// CHECK: wasmssa.return %[[VAL_1]] : f64 diff --git a/mlir/test/Target/Wasm/or.mlir b/mlir/test/Target/Wasm/or.mlir deleted file mode 100644 index 521f2bac9fa6a..0000000000000 --- a/mlir/test/Target/Wasm/or.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/or.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "or_i32") (result i32) - i32.const 10 - i32.const 3 - i32.or) - - (func (export "or_i64") (result i64) - i64.const 10 - i64.const 3 - i64.or) -) -*/ - -// CHECK-LABEL: wasmssa.func @or_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.or %0 %1 : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @or_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.or %0 %1 : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/popcnt.mlir b/mlir/test/Target/Wasm/popcnt.mlir deleted file mode 100644 index 235333a085177..0000000000000 --- a/mlir/test/Target/Wasm/popcnt.mlir +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: yaml2obj %S/inputs/popcnt.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "popcnt_i32") (result i32) - i32.const 10 - i32.popcnt - ) - - (func (export "popcnt_i64") (result i64) - i64.const 10 - i64.popcnt - ) -) -*/ - -// CHECK-LABEL: wasmssa.func @popcnt_i32() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.popcnt %[[VAL_0]] : i32 -// CHECK: wasmssa.return %[[VAL_1]] : i32 - -// CHECK-LABEL: wasmssa.func @popcnt_i64() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 10 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.popcnt %[[VAL_0]] : i64 -// CHECK: wasmssa.return %[[VAL_1]] : i64 diff --git a/mlir/test/Target/Wasm/rem.mlir b/mlir/test/Target/Wasm/rem.mlir deleted file mode 100644 index b19b8d9d45ed7..0000000000000 --- a/mlir/test/Target/Wasm/rem.mlir +++ /dev/null @@ -1,53 +0,0 @@ -// RUN: yaml2obj %S/inputs/rem.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "rem_u_i32") (result i32) - i32.const 10 - i32.const 3 - i32.rem_u) - - (func (export "rem_u_i64") (result i64) - i64.const 10 - i64.const 3 - i64.rem_u) - - (func (export "rem_s_i32") (result i32) - i32.const 10 - i32.const 3 - i32.rem_s) - - (func (export "rem_s_i64") (result i64) - i64.const 10 - i64.const 3 - i64.rem_s) -) -*/ - -// CHECK-LABEL: wasmssa.func @rem_u_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.rem_ui %0 %1 : i32 -// CHECK: wasmssa.return %2 : i32 -// CHECK: } - -// CHECK-LABEL: wasmssa.func @rem_u_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.rem_ui %0 %1 : i64 -// CHECK: wasmssa.return %2 : i64 -// CHECK: } - -// CHECK-LABEL: wasmssa.func @rem_s_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.rem_si %0 %1 : i32 -// CHECK: wasmssa.return %2 : i32 -// CHECK: } - -// CHECK-LABEL: wasmssa.func @rem_s_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.rem_si %0 %1 : i64 -// CHECK: wasmssa.return %2 : i64 -// CHECK: } diff --git a/mlir/test/Target/Wasm/rotl.mlir b/mlir/test/Target/Wasm/rotl.mlir deleted file mode 100644 index ec573554f0a8c..0000000000000 --- a/mlir/test/Target/Wasm/rotl.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/rotl.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "rotl_i32") (result i32) - i32.const 10 - i32.const 3 - i32.rotl) - - (func (export "rotl_i64") (result i64) - i64.const 10 - i64.const 3 - i64.rotl) -) -*/ - -// CHECK-LABEL: wasmssa.func @rotl_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.rotl %0 by %1 bits : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @rotl_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.rotl %0 by %1 bits : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/rotr.mlir b/mlir/test/Target/Wasm/rotr.mlir deleted file mode 100644 index 5618b432693ad..0000000000000 --- a/mlir/test/Target/Wasm/rotr.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/rotr.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "rotr_i32") (result i32) - i32.const 10 - i32.const 3 - i32.rotr) - - (func (export "rotr_i64") (result i64) - i64.const 10 - i64.const 3 - i64.rotr) -) -*/ - -// CHECK-LABEL: wasmssa.func @rotr_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.rotr %0 by %1 bits : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @rotr_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.rotr %0 by %1 bits : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/shl.mlir b/mlir/test/Target/Wasm/shl.mlir deleted file mode 100644 index f2bdd573fab81..0000000000000 --- a/mlir/test/Target/Wasm/shl.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/shl.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "shl_i32") (result i32) - i32.const 10 - i32.const 3 - i32.shl) - - (func (export "shl_i64") (result i64) - i64.const 10 - i64.const 3 - i64.shl) -) -*/ - -// CHECK-LABEL: wasmssa.func @shl_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.shl %0 by %1 bits : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @shl_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.shl %0 by %1 bits : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/shr_s.mlir b/mlir/test/Target/Wasm/shr_s.mlir deleted file mode 100644 index 247d9be28403c..0000000000000 --- a/mlir/test/Target/Wasm/shr_s.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/shr_s.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "shr_s_i32") (result i32) - i32.const 10 - i32.const 3 - i32.shr_s) - - (func (export "shr_s_i64") (result i64) - i64.const 10 - i64.const 3 - i64.shr_s) -) -*/ - -// CHECK-LABEL: wasmssa.func @shr_s_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.shr_s %0 by %1 bits : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @shr_s_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.shr_s %0 by %1 bits : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/shr_u.mlir b/mlir/test/Target/Wasm/shr_u.mlir deleted file mode 100644 index 9a79eed9b1d4a..0000000000000 --- a/mlir/test/Target/Wasm/shr_u.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/shr_u.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "shr_u_i32") (result i32) - i32.const 10 - i32.const 3 - i32.shr_u) - - (func (export "shr_u_i64") (result i64) - i64.const 10 - i64.const 3 - i64.shr_u) -) -*/ - -// CHECK-LABEL: wasmssa.func @shr_u_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.shr_u %0 by %1 bits : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @shr_u_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.shr_u %0 by %1 bits : i64 -// CHECK: wasmssa.return %2 : i64 diff --git a/mlir/test/Target/Wasm/sqrt.mlir b/mlir/test/Target/Wasm/sqrt.mlir deleted file mode 100644 index 77444ad69b16f..0000000000000 --- a/mlir/test/Target/Wasm/sqrt.mlir +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: yaml2obj %S/inputs/sqrt.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "sqrt_f32") (result f32) - f32.const 10 - f32.sqrt) - - (func (export "sqrt_f64") (result f64) - f64.const 10 - f64.sqrt) -) -*/ - -// CHECK-LABEL: wasmssa.func @sqrt_f32() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.sqrt %[[VAL_0]] : f32 -// CHECK: wasmssa.return %[[VAL_1]] : f32 - -// CHECK-LABEL: wasmssa.func @sqrt_f64() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.000000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.sqrt %[[VAL_0]] : f64 -// CHECK: wasmssa.return %[[VAL_1]] : f64 diff --git a/mlir/test/Target/Wasm/sub.mlir b/mlir/test/Target/Wasm/sub.mlir deleted file mode 100644 index b9c6caf006583..0000000000000 --- a/mlir/test/Target/Wasm/sub.mlir +++ /dev/null @@ -1,52 +0,0 @@ -// RUN: yaml2obj %S/inputs/sub.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s -/* Source code used to create this test: -(module - (func $sub_i32 (result i32) - i32.const 12 - i32.const 50 - i32.sub - ) - - (func $sub_i64 (result i64) - i64.const 20 - i64.const 5 - i64.sub - ) - - (func $sub_f32 (result f32) - f32.const 5 - f32.const 14 - f32.sub - ) - - (func $sub_f64 (result f64) - f64.const 17 - f64.const 0 - f64.sub - ) -) -*/ - -// CHECK-LABEL: wasmssa.func nested @func_0() -> i32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 12 : i32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 50 : i32 -// CHECK: %[[VAL_2:.*]] = wasmssa.sub %[[VAL_0]] %[[VAL_1]] : i32 -// CHECK: wasmssa.return %[[VAL_2]] : i32 - -// CHECK-LABEL: wasmssa.func nested @func_1() -> i64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 20 : i64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 5 : i64 -// CHECK: %[[VAL_2:.*]] = wasmssa.sub %[[VAL_0]] %[[VAL_1]] : i64 -// CHECK: wasmssa.return %[[VAL_2]] : i64 - -// CHECK-LABEL: wasmssa.func nested @func_2() -> f32 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 5.000000e+00 : f32 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 1.400000e+01 : f32 -// CHECK: %[[VAL_2:.*]] = wasmssa.sub %[[VAL_0]] %[[VAL_1]] : f32 -// CHECK: wasmssa.return %[[VAL_2]] : f32 - -// CHECK-LABEL: wasmssa.func nested @func_3() -> f64 { -// CHECK: %[[VAL_0:.*]] = wasmssa.const 1.700000e+01 : f64 -// CHECK: %[[VAL_1:.*]] = wasmssa.const 0.000000e+00 : f64 -// CHECK: %[[VAL_2:.*]] = wasmssa.sub %[[VAL_0]] %[[VAL_1]] : f64 -// CHECK: wasmssa.return %[[VAL_2]] : f64 diff --git a/mlir/test/Target/Wasm/xor.mlir b/mlir/test/Target/Wasm/xor.mlir deleted file mode 100644 index 94691de2b3be4..0000000000000 --- a/mlir/test/Target/Wasm/xor.mlir +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: yaml2obj %S/inputs/xor.yaml.wasm -o - | mlir-translate --import-wasm | FileCheck %s - -/* Source code used to generate this test: -(module - (func (export "xor_i32") (result i32) - i32.const 10 - i32.const 3 - i32.xor) - - (func (export "xor_i64") (result i64) - i64.const 10 - i64.const 3 - i64.xor) -) -*/ - -// CHECK-LABEL: wasmssa.func @xor_i32() -> i32 { -// CHECK: %0 = wasmssa.const 10 : i32 -// CHECK: %1 = wasmssa.const 3 : i32 -// CHECK: %2 = wasmssa.xor %0 %1 : i32 -// CHECK: wasmssa.return %2 : i32 - -// CHECK-LABEL: wasmssa.func @xor_i64() -> i64 { -// CHECK: %0 = wasmssa.const 10 : i64 -// CHECK: %1 = wasmssa.const 3 : i64 -// CHECK: %2 = wasmssa.xor %0 %1 : i64 -// CHECK: wasmssa.return %2 : i64 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits