From: Hans Wennborg Date: Thu, 12 Nov 2015 14:37:56 +0000 (+0000) Subject: Revert r252858: "[WebAssembly] Switch to MC for instruction printing." X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e8073938cf1b5b009a1bf45211ffec5b1b0e9461;p=oota-llvm.git Revert r252858: "[WebAssembly] Switch to MC for instruction printing." It broke the CMake build: "Cannot find source file: WebAssemblyRegNumbering.cpp" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252897 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/WebAssembly/CMakeLists.txt b/lib/Target/WebAssembly/CMakeLists.txt index 47fa9c631ba..96f039bed75 100644 --- a/lib/Target/WebAssembly/CMakeLists.txt +++ b/lib/Target/WebAssembly/CMakeLists.txt @@ -21,7 +21,6 @@ add_llvm_target(WebAssemblyCodeGen WebAssemblyMachineFunctionInfo.cpp WebAssemblyMCInstLower.cpp WebAssemblyRegisterInfo.cpp - WebAssemblyRegNumbering.cpp WebAssemblySelectionDAGInfo.cpp WebAssemblySubtarget.cpp WebAssemblyTargetMachine.cpp diff --git a/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp b/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp index cc77f56dce3..bb10f20fd6d 100644 --- a/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp +++ b/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp @@ -36,50 +36,28 @@ WebAssemblyInstPrinter::WebAssemblyInstPrinter(const MCAsmInfo &MAI, void WebAssemblyInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const { - // FIXME: Revisit whether we actually print the get_local explicitly. - OS << "(get_local " << RegNo << ")"; + if (TargetRegisterInfo::isPhysicalRegister(RegNo)) + OS << getRegisterName(RegNo); + else + OS << TargetRegisterInfo::virtReg2Index(RegNo); } void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI) { printInstruction(MI, OS); - - const MCInstrDesc &Desc = MII.get(MI->getOpcode()); - if (Desc.isVariadic()) - for (unsigned i = Desc.getNumOperands(), e = MI->getNumOperands(); i < e; - ++i) { - OS << ", "; - printOperand(MI, i, OS); - } - printAnnotation(OS, Annot); unsigned NumDefs = MII.get(MI->getOpcode()).getNumDefs(); assert(NumDefs <= 1 && "Instructions with multiple result values not implemented"); - // FIXME: Revisit whether we actually print the set_local explicitly. - if (NumDefs != 0) + if (NumDefs != 0) { OS << "\n" - "\t" "set_local " << MI->getOperand(0).getReg() << ", $pop"; -} - -static std::string toString(const APFloat &FP) { - static const size_t BufBytes = 128; - char buf[BufBytes]; - if (FP.isNaN()) - assert((FP.bitwiseIsEqual(APFloat::getQNaN(FP.getSemantics())) || - FP.bitwiseIsEqual( - APFloat::getQNaN(FP.getSemantics(), /*Negative=*/true))) && - "convertToHexString handles neither SNaN nor NaN payloads"); - // Use C99's hexadecimal floating-point representation. - auto Written = FP.convertToHexString( - buf, /*hexDigits=*/0, /*upperCase=*/false, APFloat::rmNearestTiesToEven); - (void)Written; - assert(Written != 0); - assert(Written < BufBytes); - return buf; + "\t" "set_local "; + printRegName(OS, MI->getOperand(0).getReg()); + OS << ", pop"; + } } void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, @@ -87,13 +65,13 @@ void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, const MCOperand &Op = MI->getOperand(OpNo); if (Op.isReg()) { if (OpNo < MII.get(MI->getOpcode()).getNumDefs()) - O << "$push"; + O << "push"; else printRegName(O, Op.getReg()); } else if (Op.isImm()) - O << Op.getImm(); + O << '#' << Op.getImm(); else if (Op.isFPImm()) - O << toString(APFloat(Op.getFPImm())); + O << '#' << Op.getFPImm(); else { assert(Op.isExpr() && "unknown operand kind in printOperand"); Op.getExpr()->print(O, &MAI); diff --git a/lib/Target/WebAssembly/WebAssembly.h b/lib/Target/WebAssembly/WebAssembly.h index be6c20c1a7c..0109c00ef2f 100644 --- a/lib/Target/WebAssembly/WebAssembly.h +++ b/lib/Target/WebAssembly/WebAssembly.h @@ -27,7 +27,6 @@ FunctionPass *createWebAssemblyISelDag(WebAssemblyTargetMachine &TM, CodeGenOpt::Level OptLevel); FunctionPass *createWebAssemblyCFGStackify(); -FunctionPass *createWebAssemblyRegNumbering(); FunctionPass *createWebAssemblyRelooper(); diff --git a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 641d6ea2b86..27095ec51df 100644 --- a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -15,12 +15,12 @@ //===----------------------------------------------------------------------===// #include "WebAssembly.h" -#include "InstPrinter/WebAssemblyInstPrinter.h" -#include "MCTargetDesc/WebAssemblyMCTargetDesc.h" -#include "WebAssemblyMCInstLower.h" #include "WebAssemblyMachineFunctionInfo.h" #include "WebAssemblyRegisterInfo.h" #include "WebAssemblySubtarget.h" +#include "InstPrinter/WebAssemblyInstPrinter.h" +#include "MCTargetDesc/WebAssemblyMCTargetDesc.h" + #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include "llvm/CodeGen/Analysis.h" @@ -28,7 +28,7 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/IR/DataLayout.h" -#include "llvm/MC/MCContext.h" +#include "llvm/IR/DebugInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Support/Debug.h" @@ -42,12 +42,13 @@ using namespace llvm; namespace { class WebAssemblyAsmPrinter final : public AsmPrinter { + const WebAssemblyInstrInfo *TII; const MachineRegisterInfo *MRI; - const WebAssemblyFunctionInfo *MFI; + unsigned NumArgs; public: WebAssemblyAsmPrinter(TargetMachine &TM, std::unique_ptr Streamer) - : AsmPrinter(TM, std::move(Streamer)), MRI(nullptr), MFI(nullptr) {} + : AsmPrinter(TM, std::move(Streamer)), TII(nullptr), MRI(nullptr) {} private: const char *getPassName() const override { @@ -63,8 +64,10 @@ private: } bool runOnMachineFunction(MachineFunction &MF) override { + const auto &Subtarget = MF.getSubtarget(); + TII = Subtarget.getInstrInfo(); MRI = &MF.getRegInfo(); - MFI = MF.getInfo(); + NumArgs = MF.getInfo()->getParams().size(); return AsmPrinter::runOnMachineFunction(MF); } @@ -79,8 +82,10 @@ private: void EmitEndOfAsmFile(Module &M) override; std::string getRegTypeName(unsigned RegNo) const; + static std::string toString(const APFloat &APF); const char *toString(MVT VT) const; std::string regToString(const MachineOperand &MO); + std::string argToString(const MachineOperand &MO); }; } // end anonymous namespace @@ -89,6 +94,36 @@ private: // Helpers. //===----------------------------------------------------------------------===// +// Operand type (if any), followed by the lower-case version of the opcode's +// name matching the names WebAssembly opcodes are expected to have. The +// tablegen names are uppercase and suffixed with their type (after an +// underscore). Conversions are additionally prefixed with their input type +// (before a double underscore). +static std::string OpcodeName(const WebAssemblyInstrInfo *TII, + const MachineInstr *MI) { + std::string N(StringRef(TII->getName(MI->getOpcode())).lower()); + std::string::size_type Len = N.length(); + std::string::size_type Under = N.rfind('_'); + bool HasType = std::string::npos != Under; + std::string::size_type NameEnd = HasType ? Under : Len; + std::string Name(&N[0], &N[NameEnd]); + if (!HasType) + return Name; + for (const char *typelessOpcode : { "return", "call", "br_if" }) + if (Name == typelessOpcode) + return Name; + std::string Type(&N[NameEnd + 1], &N[Len]); + std::string::size_type DoubleUnder = Name.find("__"); + bool IsConv = std::string::npos != DoubleUnder; + if (!IsConv) + return Type + '.' + Name; + std::string InType(&Name[0], &Name[DoubleUnder]); + return Type + '.' + std::string(&Name[DoubleUnder + 2], &Name[NameEnd]) + + '/' + InType; +} + +static std::string toSymbol(StringRef S) { return ("$" + S).str(); } + std::string WebAssemblyAsmPrinter::getRegTypeName(unsigned RegNo) const { const TargetRegisterClass *TRC = MRI->getRegClass(RegNo); for (MVT T : {MVT::i32, MVT::i64, MVT::f32, MVT::f64}) @@ -99,12 +134,38 @@ std::string WebAssemblyAsmPrinter::getRegTypeName(unsigned RegNo) const { return "?"; } +std::string WebAssemblyAsmPrinter::toString(const APFloat &FP) { + static const size_t BufBytes = 128; + char buf[BufBytes]; + if (FP.isNaN()) + assert((FP.bitwiseIsEqual(APFloat::getQNaN(FP.getSemantics())) || + FP.bitwiseIsEqual( + APFloat::getQNaN(FP.getSemantics(), /*Negative=*/true))) && + "convertToHexString handles neither SNaN nor NaN payloads"); + // Use C99's hexadecimal floating-point representation. + auto Written = FP.convertToHexString( + buf, /*hexDigits=*/0, /*upperCase=*/false, APFloat::rmNearestTiesToEven); + (void)Written; + assert(Written != 0); + assert(Written < BufBytes); + return buf; +} + std::string WebAssemblyAsmPrinter::regToString(const MachineOperand &MO) { unsigned RegNo = MO.getReg(); if (TargetRegisterInfo::isPhysicalRegister(RegNo)) return WebAssemblyInstPrinter::getRegisterName(RegNo); - return utostr(MFI->getWAReg(RegNo)); + // WebAssembly arguments and local variables are in the same index space, and + // there are no explicit varargs, so we just add the number of arguments to + // the virtual register number to get the local variable number. + return utostr(TargetRegisterInfo::virtReg2Index(RegNo) + NumArgs); +} + +std::string WebAssemblyAsmPrinter::argToString(const MachineOperand &MO) { + unsigned ArgNo = MO.getImm(); + // Same as above, but we don't need to add NumArgs here. + return utostr(ArgNo); } const char *WebAssemblyAsmPrinter::toString(MVT VT) const { @@ -142,22 +203,26 @@ void WebAssemblyAsmPrinter::EmitFunctionBodyStart() { SmallString<128> Str; raw_svector_ostream OS(Str); - for (MVT VT : MFI->getParams()) - OS << "\t" ".param " << toString(VT) << '\n'; - for (MVT VT : MFI->getResults()) - OS << "\t" ".result " << toString(VT) << '\n'; + for (MVT VT : MF->getInfo()->getParams()) + OS << "\t" ".param " + << toString(VT) << '\n'; + for (MVT VT : MF->getInfo()->getResults()) + OS << "\t" ".result " + << toString(VT) << '\n'; bool FirstVReg = true; for (unsigned Idx = 0, IdxE = MRI->getNumVirtRegs(); Idx != IdxE; ++Idx) { unsigned VReg = TargetRegisterInfo::index2VirtReg(Idx); - if (!MRI->use_empty(VReg)) { - if (FirstVReg) - OS << "\t" ".local "; - else - OS << ", "; - OS << getRegTypeName(VReg); - FirstVReg = false; - } + // FIXME: Don't skip dead virtual registers for now: that would require + // remapping all locals' numbers. + // if (!MRI->use_empty(VReg)) { + if (FirstVReg) + OS << "\t" ".local "; + else + OS << ", "; + OS << getRegTypeName(VReg); + FirstVReg = false; + //} } if (!FirstVReg) OS << '\n'; @@ -171,36 +236,80 @@ void WebAssemblyAsmPrinter::EmitFunctionBodyStart() { void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) { DEBUG(dbgs() << "EmitInstruction: " << *MI << '\n'); + SmallString<128> Str; + raw_svector_ostream OS(Str); unsigned NumDefs = MI->getDesc().getNumDefs(); assert(NumDefs <= 1 && "Instructions with multiple result values not implemented"); + OS << '\t'; + switch (MI->getOpcode()) { - case TargetOpcode::COPY: { - // TODO: Figure out a way to lower COPY instructions to MCInst form. - SmallString<128> Str; - raw_svector_ostream OS(Str); - OS << "\t" "set_local " << regToString(MI->getOperand(0)) << ", " - "(get_local " << regToString(MI->getOperand(1)) << ")"; - OutStreamer->EmitRawText(OS.str()); + case TargetOpcode::COPY: + OS << "get_local push, " << regToString(MI->getOperand(1)); break; - } case WebAssembly::ARGUMENT_I32: case WebAssembly::ARGUMENT_I64: case WebAssembly::ARGUMENT_F32: case WebAssembly::ARGUMENT_F64: - // These represent values which are live into the function entry, so there's - // no instruction to emit. + OS << "get_local push, " << argToString(MI->getOperand(1)); break; default: { - WebAssemblyMCInstLower MCInstLowering(OutContext, *this); - MCInst TmpInst; - MCInstLowering.Lower(MI, TmpInst); - EmitToStreamer(*OutStreamer, TmpInst); + OS << OpcodeName(TII, MI); + bool NeedComma = false; + bool DefsPushed = false; + if (NumDefs != 0 && !MI->isCall()) { + OS << " push"; + NeedComma = true; + DefsPushed = true; + } + for (const MachineOperand &MO : MI->uses()) { + if (MO.isReg() && MO.isImplicit()) + continue; + if (NeedComma) + OS << ','; + NeedComma = true; + OS << ' '; + switch (MO.getType()) { + default: + llvm_unreachable("unexpected machine operand type"); + case MachineOperand::MO_Register: + OS << "(get_local " << regToString(MO) << ')'; + break; + case MachineOperand::MO_Immediate: + OS << MO.getImm(); + break; + case MachineOperand::MO_FPImmediate: + OS << toString(MO.getFPImm()->getValueAPF()); + break; + case MachineOperand::MO_GlobalAddress: + OS << toSymbol(MO.getGlobal()->getName()); + break; + case MachineOperand::MO_MachineBasicBlock: + OS << toSymbol(MO.getMBB()->getSymbol()->getName()); + break; + } + if (NumDefs != 0 && !DefsPushed) { + // Special-case for calls; print the push after the callee. + assert(MI->isCall()); + OS << ", push"; + DefsPushed = true; + } + } break; } } + + OutStreamer->EmitRawText(OS.str()); + + if (NumDefs != 0) { + SmallString<128> Str; + raw_svector_ostream OS(Str); + const MachineOperand &Operand = MI->getOperand(0); + OS << "\tset_local " << regToString(Operand) << ", pop"; + OutStreamer->EmitRawText(OS.str()); + } } static void ComputeLegalValueVTs(LLVMContext &Context, @@ -231,8 +340,8 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { if (Str.empty()) OS << "\t.imports\n"; - MCSymbol *Sym = OutStreamer->getContext().getOrCreateSymbol(F.getName()); - OS << "\t.import " << *Sym << " \"\" " << *Sym; + OS << "\t.import " << toSymbol(F.getName()) << " \"\" \"" << F.getName() + << "\""; const WebAssemblyTargetLowering &TLI = *TM.getSubtarget(F).getTargetLowering(); diff --git a/lib/Target/WebAssembly/WebAssemblyInstrCall.td b/lib/Target/WebAssembly/WebAssemblyInstrCall.td index d175b6ae626..82a42f564ab 100644 --- a/lib/Target/WebAssembly/WebAssemblyInstrCall.td +++ b/lib/Target/WebAssembly/WebAssemblyInstrCall.td @@ -23,11 +23,9 @@ def : I<(outs), (ins i64imm:$amt1, i64imm:$amt2), multiclass CALL { def CALL_#vt : I<(outs vt:$dst), (ins global:$callee, variable_ops), - [(set vt:$dst, (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee)))], - "call $callee, $dst">; + [(set vt:$dst, (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee)))]>; def CALL_INDIRECT_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops), - [(set vt:$dst, (WebAssemblycall1 I32:$callee))], - "call_indirect $callee, $dst">; + [(set vt:$dst, (WebAssemblycall1 I32:$callee))]>; } let Uses = [SP32, SP64], isCall = 1 in { defm : CALL; @@ -36,11 +34,9 @@ let Uses = [SP32, SP64], isCall = 1 in { defm : CALL; def CALL_VOID : I<(outs), (ins global:$callee, variable_ops), - [(WebAssemblycall0 (WebAssemblywrapper tglobaladdr:$callee))], - "call $callee">; + [(WebAssemblycall0 (WebAssemblywrapper tglobaladdr:$callee))]>; def CALL_INDIRECT_VOID : I<(outs), (ins I32:$callee, variable_ops), - [(WebAssemblycall0 I32:$callee)], - "call_indirect $callee">; + [(WebAssemblycall0 I32:$callee)]>; } // Uses = [SP32,SP64], isCall = 1 /* diff --git a/lib/Target/WebAssembly/WebAssemblyInstrControl.td b/lib/Target/WebAssembly/WebAssemblyInstrControl.td index acfd738a8fa..6aae5d38d0b 100644 --- a/lib/Target/WebAssembly/WebAssemblyInstrControl.td +++ b/lib/Target/WebAssembly/WebAssemblyInstrControl.td @@ -41,11 +41,9 @@ def BR : I<(outs), (ins bb_op:$dst), // currently. let isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in { def SWITCH_I32 : I<(outs), (ins I32:$index, variable_ops), - [(WebAssemblyswitch I32:$index)], - "switch $index">; + [(WebAssemblyswitch I32:$index)]>; def SWITCH_I64 : I<(outs), (ins I64:$index, variable_ops), - [(WebAssemblyswitch I64:$index)], - "switch $index">; + [(WebAssemblyswitch I64:$index)]>; } // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 // Placemarkers to indicate the start of a block or loop scope. diff --git a/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp index 4226a5385ce..59acbdbe63d 100644 --- a/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp +++ b/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp @@ -14,13 +14,11 @@ //===----------------------------------------------------------------------===// #include "WebAssemblyMCInstLower.h" -#include "WebAssemblyMachineFunctionInfo.h" #include "llvm/ADT/SmallString.h" +#include "llvm/IR/Constants.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineBasicBlock.h" -#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/IR/Constants.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" @@ -57,36 +55,25 @@ void WebAssemblyMCInstLower::Lower(const MachineInstr *MI, default: MI->dump(); llvm_unreachable("unknown operand type"); - case MachineOperand::MO_Register: { + case MachineOperand::MO_Register: // Ignore all implicit register operands. if (MO.isImplicit()) continue; - // TODO: Handle physical registers. - const WebAssemblyFunctionInfo &MFI = - *MI->getParent()->getParent()->getInfo(); - unsigned WAReg = MFI.getWAReg(MO.getReg()); - MCOp = MCOperand::createReg(WAReg); + MCOp = MCOperand::createReg(MO.getReg()); break; - } case MachineOperand::MO_Immediate: MCOp = MCOperand::createImm(MO.getImm()); break; - case MachineOperand::MO_FPImmediate: { - // TODO: MC converts all floating point immediate operands to double. - // This is fine for numeric values, but may cause NaNs to change bits. - const ConstantFP *Imm = MO.getFPImm(); - if (Imm->getType()->isFloatTy()) - MCOp = MCOperand::createFPImm(Imm->getValueAPF().convertToFloat()); - else if (Imm->getType()->isDoubleTy()) - MCOp = MCOperand::createFPImm(Imm->getValueAPF().convertToDouble()); - else - llvm_unreachable("unknown floating point immediate type"); + case MachineOperand::MO_FPImmediate: + MCOp = MCOperand::createFPImm( + MO.getFPImm()->getValueAPF().convertToDouble()); break; - } case MachineOperand::MO_MachineBasicBlock: MCOp = MCOperand::createExpr( MCSymbolRefExpr::create(MO.getMBB()->getSymbol(), Ctx)); break; + case MachineOperand::MO_RegisterMask: + continue; case MachineOperand::MO_GlobalAddress: MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO)); break; diff --git a/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h b/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h index 81273c00471..bac0dfafcf3 100644 --- a/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h +++ b/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h @@ -30,11 +30,9 @@ class WebAssemblyFunctionInfo final : public MachineFunctionInfo { std::vector Params; std::vector Results; - /// A mapping from CodeGen vreg index to WebAssembly register number. - std::vector WARegs; - public: - explicit WebAssemblyFunctionInfo(MachineFunction &MF) : MF(MF) {} + explicit WebAssemblyFunctionInfo(MachineFunction &MF) + : MF(MF) {} ~WebAssemblyFunctionInfo() override; void addParam(MVT VT) { Params.push_back(VT); } @@ -42,17 +40,6 @@ public: void addResult(MVT VT) { Results.push_back(VT); } const std::vector &getResults() const { return Results; } - - void initWARegs() { - assert(WARegs.empty()); - WARegs.resize(MF.getRegInfo().getNumVirtRegs(), -1u); - } - void setWAReg(unsigned VReg, unsigned WAReg) { - WARegs[TargetRegisterInfo::virtReg2Index(VReg)] = WAReg; - } - unsigned getWAReg(unsigned VReg) const { - return WARegs[TargetRegisterInfo::virtReg2Index(VReg)]; - } }; } // end namespace llvm diff --git a/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 5aae7108474..99a24266686 100644 --- a/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -175,5 +175,4 @@ void WebAssemblyPassConfig::addPreSched2() {} void WebAssemblyPassConfig::addPreEmitPass() { addPass(createWebAssemblyCFGStackify()); - addPass(createWebAssemblyRegNumbering()); } diff --git a/test/CodeGen/WebAssembly/call.ll b/test/CodeGen/WebAssembly/call.ll index f44ba92045a..7a03bdc4e5f 100644 --- a/test/CodeGen/WebAssembly/call.ll +++ b/test/CodeGen/WebAssembly/call.ll @@ -16,8 +16,8 @@ declare void @void_nullary() ; CHECK-LABEL: call_i32_nullary: ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local i32 -; CHECK-NEXT: call i32_nullary, $push{{$}} -; CHECK-NEXT: set_local 0, $pop +; CHECK-NEXT: call $i32_nullary, push{{$}} +; CHECK-NEXT: set_local 0, pop ; CHECK-NEXT: return (get_local 0) define i32 @call_i32_nullary() { %r = call i32 @i32_nullary() @@ -27,8 +27,8 @@ define i32 @call_i32_nullary() { ; CHECK-LABEL: call_i64_nullary: ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local i64 -; CHECK-NEXT: call i64_nullary, $push{{$}} -; CHECK-NEXT: set_local 0, $pop +; CHECK-NEXT: call $i64_nullary, push{{$}} +; CHECK-NEXT: set_local 0, pop ; CHECK-NEXT: return (get_local 0) define i64 @call_i64_nullary() { %r = call i64 @i64_nullary() @@ -38,8 +38,8 @@ define i64 @call_i64_nullary() { ; CHECK-LABEL: call_float_nullary: ; CHECK-NEXT: .result f32 ; CHECK-NEXT: .local f32 -; CHECK-NEXT: call float_nullary, $push{{$}} -; CHECK-NEXT: set_local 0, $pop +; CHECK-NEXT: call $float_nullary, push{{$}} +; CHECK-NEXT: set_local 0, pop ; CHECK-NEXT: return (get_local 0) define float @call_float_nullary() { %r = call float @float_nullary() @@ -49,8 +49,8 @@ define float @call_float_nullary() { ; CHECK-LABEL: call_double_nullary: ; CHECK-NEXT: .result f64 ; CHECK-NEXT: .local f64 -; CHECK-NEXT: call double_nullary, $push{{$}} -; CHECK-NEXT: set_local 0, $pop +; CHECK-NEXT: call $double_nullary, push{{$}} +; CHECK-NEXT: set_local 0, pop ; CHECK-NEXT: return (get_local 0) define double @call_double_nullary() { %r = call double @double_nullary() @@ -58,7 +58,7 @@ define double @call_double_nullary() { } ; CHECK-LABEL: call_void_nullary: -; CHECK-NEXT: call void_nullary{{$}} +; CHECK-NEXT: call $void_nullary{{$}} ; CHECK-NEXT: return define void @call_void_nullary() { call void @void_nullary() @@ -69,9 +69,11 @@ define void @call_void_nullary() { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local i32, i32 -; CHECK-NEXT: call i32_unary, $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop -; CHECK-NEXT: return (get_local 1) +; CHECK-NEXT: get_local push, 0 +; CHECK-NEXT: set_local 1, pop +; CHECK-NEXT: call $i32_unary, push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop +; CHECK-NEXT: return (get_local 2) define i32 @call_i32_unary(i32 %a) { %r = call i32 @i32_unary(i32 %a) ret i32 %r @@ -82,9 +84,13 @@ define i32 @call_i32_unary(i32 %a) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local i32, i32, i32 -; CHECK-NEXT: call i32_binary, $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop -; CHECK-NEXT: return (get_local 2) +; CHECK-NEXT: get_local push, 1 +; CHECK-NEXT: set_local 2, pop +; CHECK-NEXT: get_local push, 0 +; CHECK-NEXT: set_local 3, pop +; CHECK-NEXT: call $i32_binary, push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop +; CHECK-NEXT: return (get_local 4) define i32 @call_i32_binary(i32 %a, i32 %b) { %r = call i32 @i32_binary(i32 %a, i32 %b) ret i32 %r @@ -93,7 +99,9 @@ define i32 @call_i32_binary(i32 %a, i32 %b) { ; CHECK-LABEL: call_indirect_void: ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .local i32 -; CHECK-NEXT: call_indirect (get_local 0){{$}} +; CHECK-NEXT: get_local push, 0 +; CHECK-NEXT: set_local 1, pop +; CHECK-NEXT: call_indirect (get_local 1){{$}} ; CHECK-NEXT: return define void @call_indirect_void(void ()* %callee) { call void %callee() @@ -104,16 +112,18 @@ define void @call_indirect_void(void ()* %callee) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local i32, i32 -; CHECK-NEXT: call_indirect (get_local 0), $push{{$}} -; CHECK-NEXT: set_local 1, $pop -; CHECK-NEXT: return (get_local 1) +; CHECK-NEXT: get_local push, 0 +; CHECK-NEXT: set_local 1, pop +; CHECK-NEXT: call_indirect (get_local 1), push{{$}} +; CHECK-NEXT: set_local 2, pop +; CHECK-NEXT: return (get_local 2) define i32 @call_indirect_i32(i32 ()* %callee) { %t = call i32 %callee() ret i32 %t } ; CHECK-LABEL: tail_call_void_nullary: -; CHECK-NEXT: call void_nullary{{$}} +; CHECK-NEXT: call $void_nullary{{$}} ; CHECK-NEXT: return{{$}} define void @tail_call_void_nullary() { tail call void @void_nullary() @@ -121,7 +131,7 @@ define void @tail_call_void_nullary() { } ; CHECK-LABEL: fastcc_tail_call_void_nullary: -; CHECK-NEXT: call void_nullary{{$}} +; CHECK-NEXT: call $void_nullary{{$}} ; CHECK-NEXT: return{{$}} define void @fastcc_tail_call_void_nullary() { tail call fastcc void @void_nullary() @@ -129,7 +139,7 @@ define void @fastcc_tail_call_void_nullary() { } ; CHECK-LABEL: coldcc_tail_call_void_nullary: -; CHECK-NEXT: call void_nullary +; CHECK-NEXT: call $void_nullary ; CHECK-NEXT: return{{$}} define void @coldcc_tail_call_void_nullary() { tail call coldcc void @void_nullary() diff --git a/test/CodeGen/WebAssembly/cfg-stackify.ll b/test/CodeGen/WebAssembly/cfg-stackify.ll index 44b8cd08d1c..16307345354 100644 --- a/test/CodeGen/WebAssembly/cfg-stackify.ll +++ b/test/CodeGen/WebAssembly/cfg-stackify.ll @@ -14,7 +14,7 @@ declare void @something() ; CHECK: i32.add ; CHECK: br_if ; CHECK: call -; CHECK: br BB0_1{{$}} +; CHECK: br $BB0_1{{$}} ; CHECK: return{{$}} define void @test0(i32 %n) { entry: @@ -42,7 +42,7 @@ back: ; CHECK: i32.add ; CHECK: br_if ; CHECK: call -; CHECK: br BB1_1{{$}} +; CHECK: br $BB1_1{{$}} ; CHECK: return{{$}} define void @test1(i32 %n) { entry: @@ -66,10 +66,10 @@ back: ; Test that a simple loop is handled as expected. ; CHECK-LABEL: test2: -; CHECK: block BB2_2{{$}} -; CHECK: br_if BB2_2, {{.*}} +; CHECK: block $BB2_2{{$}} +; CHECK: br_if $BB2_2, {{.*}} ; CHECK: BB2_1: -; CHECK: br_if BB2_1, (get_local 10){{$}} +; CHECK: br_if $BB2_1, (get_local 16){{$}} ; CHECK: BB2_2: ; CHECK: return{{$}} define void @test2(double* nocapture %p, i32 %n) { @@ -98,17 +98,17 @@ for.end: } ; CHECK-LABEL: doublediamond: -; CHECK: block BB3_5{{$}} -; CHECK: block BB3_4{{$}} -; CHECK: block BB3_2{{$}} -; CHECK: br_if BB3_2, (get_local 4){{$}} -; CHECK: br BB3_5{{$}} +; CHECK: block $BB3_5{{$}} +; CHECK: block $BB3_4{{$}} +; CHECK: block $BB3_2{{$}} +; CHECK: br_if $BB3_2, (get_local 7){{$}} +; CHECK: br $BB3_5{{$}} ; CHECK: BB3_2: -; CHECK: br_if BB3_4, (get_local 6){{$}} -; CHECK: br BB3_5{{$}} +; CHECK: br_if $BB3_4, (get_local 10){{$}} +; CHECK: br $BB3_5{{$}} ; CHECK: BB3_4: ; CHECK: BB3_5: -; CHECK: return (get_local 3){{$}} +; CHECK: return (get_local 6){{$}} define i32 @doublediamond(i32 %a, i32 %b, i32* %p) { entry: %c = icmp eq i32 %a, 0 @@ -133,10 +133,10 @@ exit: } ; CHECK-LABEL: triangle: -; CHECK: block BB4_2{{$}} -; CHECK: br_if BB4_2, (get_local 3){{$}} +; CHECK: block $BB4_2{{$}} +; CHECK: br_if $BB4_2, (get_local 5){{$}} ; CHECK: BB4_2: -; CHECK: return (get_local 2){{$}} +; CHECK: return (get_local 4){{$}} define i32 @triangle(i32* %p, i32 %a) { entry: %c = icmp eq i32 %a, 0 @@ -151,13 +151,13 @@ exit: } ; CHECK-LABEL: diamond: -; CHECK: block BB5_3{{$}} -; CHECK: block BB5_2{{$}} -; CHECK: br_if BB5_2, (get_local 3){{$}} -; CHECK: br BB5_3{{$}} +; CHECK: block $BB5_3{{$}} +; CHECK: block $BB5_2{{$}} +; CHECK: br_if $BB5_2, (get_local 5){{$}} +; CHECK: br $BB5_3{{$}} ; CHECK: BB5_2: ; CHECK: BB5_3: -; CHECK: return (get_local 2){{$}} +; CHECK: return (get_local 4){{$}} define i32 @diamond(i32* %p, i32 %a) { entry: %c = icmp eq i32 %a, 0 @@ -176,7 +176,7 @@ exit: ; CHECK-LABEL: single_block: ; CHECK-NOT: br -; CHECK: return (get_local 1){{$}} +; CHECK: return (get_local 2){{$}} define i32 @single_block(i32* %p) { entry: store volatile i32 0, i32* %p @@ -186,8 +186,8 @@ entry: ; CHECK-LABEL: minimal_loop: ; CHECK-NOT: br ; CHECK: BB7_1: -; CHECK: i32.store (get_local 0), (get_local 2){{$}} -; CHECK: br BB7_1{{$}} +; CHECK: i32.store (get_local 1), (get_local 3){{$}} +; CHECK: br $BB7_1{{$}} define i32 @minimal_loop(i32* %p) { entry: store volatile i32 0, i32* %p @@ -200,9 +200,9 @@ loop: ; CHECK-LABEL: simple_loop: ; CHECK-NOT: br ; CHECK: BB8_1: -; CHECK: loop BB8_2{{$}} -; CHECK: br_if BB8_1, (get_local 3){{$}} -; CHECK: return (get_local 2){{$}} +; CHECK: loop $BB8_2{{$}} +; CHECK: br_if $BB8_1, (get_local 6){{$}} +; CHECK: return (get_local 4){{$}} define i32 @simple_loop(i32* %p, i32 %a) { entry: %c = icmp eq i32 %a, 0 @@ -217,13 +217,13 @@ exit: } ; CHECK-LABEL: doubletriangle: -; CHECK: block BB9_4{{$}} -; CHECK: block BB9_3{{$}} -; CHECK: br_if BB9_4, (get_local 4){{$}} -; CHECK: br_if BB9_3, (get_local 6){{$}} +; CHECK: block $BB9_4{{$}} +; CHECK: block $BB9_3{{$}} +; CHECK: br_if $BB9_4, (get_local 7){{$}} +; CHECK: br_if $BB9_3, (get_local 10){{$}} ; CHECK: BB9_3: ; CHECK: BB9_4: -; CHECK: return (get_local 3){{$}} +; CHECK: return (get_local 6){{$}} define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) { entry: %c = icmp eq i32 %a, 0 @@ -245,14 +245,14 @@ exit: } ; CHECK-LABEL: ifelse_earlyexits: -; CHECK: block BB10_4{{$}} -; CHECK: block BB10_2{{$}} -; CHECK: br_if BB10_2, (get_local 4){{$}} -; CHECK: br BB10_4{{$}} +; CHECK: block $BB10_4{{$}} +; CHECK: block $BB10_2{{$}} +; CHECK: br_if $BB10_2, (get_local 7){{$}} +; CHECK: br $BB10_4{{$}} ; CHECK: BB10_2: -; CHECK: br_if BB10_4, (get_local 6){{$}} +; CHECK: br_if $BB10_4, (get_local 10){{$}} ; CHECK: BB10_4: -; CHECK: return (get_local 3){{$}} +; CHECK: return (get_local 6){{$}} define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) { entry: %c = icmp eq i32 %a, 0 diff --git a/test/CodeGen/WebAssembly/comparisons_f32.ll b/test/CodeGen/WebAssembly/comparisons_f32.ll index 87297d35808..4648fef1f09 100644 --- a/test/CodeGen/WebAssembly/comparisons_f32.ll +++ b/test/CodeGen/WebAssembly/comparisons_f32.ll @@ -11,13 +11,17 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f32, f32, i32, i32, i32{{$}} -; CHECK-NEXT: f32.eq $push, (get_local 1), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: f32.eq $push, (get_local 0), (get_local 0){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: i32.and $push, (get_local 3), (get_local 2){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: return (get_local 4){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f32.eq push, (get_local 3), (get_local 3){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: f32.eq push, (get_local 2), (get_local 2){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: i32.and push, (get_local 5), (get_local 4){{$}} +; CHECK-NEXT: set_local 6, pop{{$}} +; CHECK-NEXT: return (get_local 6){{$}} define i32 @ord_f32(float %x, float %y) { %a = fcmp ord float %x, %y %b = zext i1 %a to i32 @@ -29,13 +33,17 @@ define i32 @ord_f32(float %x, float %y) { ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f32, f32, i32, i32, i32{{$}} -; CHECK-NEXT: f32.ne $push, (get_local 1), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: f32.ne $push, (get_local 0), (get_local 0){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: i32.or $push, (get_local 3), (get_local 2){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: return (get_local 4){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f32.ne push, (get_local 3), (get_local 3){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: f32.ne push, (get_local 2), (get_local 2){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 5), (get_local 4){{$}} +; CHECK-NEXT: set_local 6, pop{{$}} +; CHECK-NEXT: return (get_local 6){{$}} define i32 @uno_f32(float %x, float %y) { %a = fcmp uno float %x, %y %b = zext i1 %a to i32 @@ -47,9 +55,13 @@ define i32 @uno_f32(float %x, float %y) { ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f32, f32, i32{{$}} -; CHECK-NEXT: f32.eq $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f32.eq push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @oeq_f32(float %x, float %y) { %a = fcmp oeq float %x, %y %b = zext i1 %a to i32 @@ -57,8 +69,8 @@ define i32 @oeq_f32(float %x, float %y) { } ; CHECK-LABEL: une_f32: -; CHECK: f32.ne $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.ne push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @une_f32(float %x, float %y) { %a = fcmp une float %x, %y %b = zext i1 %a to i32 @@ -66,8 +78,8 @@ define i32 @une_f32(float %x, float %y) { } ; CHECK-LABEL: olt_f32: -; CHECK: f32.lt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.lt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @olt_f32(float %x, float %y) { %a = fcmp olt float %x, %y %b = zext i1 %a to i32 @@ -75,8 +87,8 @@ define i32 @olt_f32(float %x, float %y) { } ; CHECK-LABEL: ole_f32: -; CHECK: f32.le $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.le push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ole_f32(float %x, float %y) { %a = fcmp ole float %x, %y %b = zext i1 %a to i32 @@ -84,8 +96,8 @@ define i32 @ole_f32(float %x, float %y) { } ; CHECK-LABEL: ogt_f32: -; CHECK: f32.gt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.gt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ogt_f32(float %x, float %y) { %a = fcmp ogt float %x, %y %b = zext i1 %a to i32 @@ -93,8 +105,8 @@ define i32 @ogt_f32(float %x, float %y) { } ; CHECK-LABEL: oge_f32: -; CHECK: f32.ge $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.ge push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @oge_f32(float %x, float %y) { %a = fcmp oge float %x, %y %b = zext i1 %a to i32 @@ -108,17 +120,21 @@ define i32 @oge_f32(float %x, float %y) { ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f32, f32, i32, i32, i32, i32, i32{{$}} -; CHECK-NEXT: f32.eq $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: f32.ne $push, (get_local 1), (get_local 1){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: f32.ne $push, (get_local 0), (get_local 0){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: i32.or $push, (get_local 4), (get_local 3){{$}} -; CHECK-NEXT: set_local 5, $pop{{$}} -; CHECK-NEXT: i32.or $push, (get_local 2), (get_local 5){{$}} -; CHECK-NEXT: set_local 6, $pop{{$}} -; CHECK-NEXT: return (get_local 6){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f32.eq push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: f32.ne push, (get_local 2), (get_local 2){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: f32.ne push, (get_local 3), (get_local 3){{$}} +; CHECK-NEXT: set_local 6, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 6), (get_local 5){{$}} +; CHECK-NEXT: set_local 7, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 4), (get_local 7){{$}} +; CHECK-NEXT: set_local 8, pop{{$}} +; CHECK-NEXT: return (get_local 8){{$}} define i32 @ueq_f32(float %x, float %y) { %a = fcmp ueq float %x, %y %b = zext i1 %a to i32 @@ -126,8 +142,8 @@ define i32 @ueq_f32(float %x, float %y) { } ; CHECK-LABEL: one_f32: -; CHECK: f32.ne $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.ne push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @one_f32(float %x, float %y) { %a = fcmp one float %x, %y %b = zext i1 %a to i32 @@ -135,8 +151,8 @@ define i32 @one_f32(float %x, float %y) { } ; CHECK-LABEL: ult_f32: -; CHECK: f32.lt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.lt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ult_f32(float %x, float %y) { %a = fcmp ult float %x, %y %b = zext i1 %a to i32 @@ -144,8 +160,8 @@ define i32 @ult_f32(float %x, float %y) { } ; CHECK-LABEL: ule_f32: -; CHECK: f32.le $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.le push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ule_f32(float %x, float %y) { %a = fcmp ule float %x, %y %b = zext i1 %a to i32 @@ -153,8 +169,8 @@ define i32 @ule_f32(float %x, float %y) { } ; CHECK-LABEL: ugt_f32: -; CHECK: f32.gt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.gt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ugt_f32(float %x, float %y) { %a = fcmp ugt float %x, %y %b = zext i1 %a to i32 @@ -162,8 +178,8 @@ define i32 @ugt_f32(float %x, float %y) { } ; CHECK-LABEL: uge_f32: -; CHECK: f32.ge $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.ge push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @uge_f32(float %x, float %y) { %a = fcmp uge float %x, %y %b = zext i1 %a to i32 diff --git a/test/CodeGen/WebAssembly/comparisons_f64.ll b/test/CodeGen/WebAssembly/comparisons_f64.ll index da419993e7b..bf82d621abc 100644 --- a/test/CodeGen/WebAssembly/comparisons_f64.ll +++ b/test/CodeGen/WebAssembly/comparisons_f64.ll @@ -11,13 +11,17 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param f64{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f64, f64, i32, i32, i32{{$}} -; CHECK-NEXT: f64.eq $push, (get_local 1), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: f64.eq $push, (get_local 0), (get_local 0){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: i32.and $push, (get_local 3), (get_local 2){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: return (get_local 4){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f64.eq push, (get_local 3), (get_local 3){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: f64.eq push, (get_local 2), (get_local 2){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: i32.and push, (get_local 5), (get_local 4){{$}} +; CHECK-NEXT: set_local 6, pop{{$}} +; CHECK-NEXT: return (get_local 6){{$}} define i32 @ord_f64(double %x, double %y) { %a = fcmp ord double %x, %y %b = zext i1 %a to i32 @@ -29,13 +33,17 @@ define i32 @ord_f64(double %x, double %y) { ; CHECK-NEXT: .param f64{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f64, f64, i32, i32, i32{{$}} -; CHECK-NEXT: f64.ne $push, (get_local 1), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: f64.ne $push, (get_local 0), (get_local 0){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: i32.or $push, (get_local 3), (get_local 2){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: return (get_local 4){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f64.ne push, (get_local 3), (get_local 3){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: f64.ne push, (get_local 2), (get_local 2){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 5), (get_local 4){{$}} +; CHECK-NEXT: set_local 6, pop{{$}} +; CHECK-NEXT: return (get_local 6){{$}} define i32 @uno_f64(double %x, double %y) { %a = fcmp uno double %x, %y %b = zext i1 %a to i32 @@ -47,9 +55,13 @@ define i32 @uno_f64(double %x, double %y) { ; CHECK-NEXT: .param f64{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f64, f64, i32{{$}} -; CHECK-NEXT: f64.eq $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f64.eq push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @oeq_f64(double %x, double %y) { %a = fcmp oeq double %x, %y %b = zext i1 %a to i32 @@ -57,8 +69,8 @@ define i32 @oeq_f64(double %x, double %y) { } ; CHECK-LABEL: une_f64: -; CHECK: f64.ne $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.ne push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @une_f64(double %x, double %y) { %a = fcmp une double %x, %y %b = zext i1 %a to i32 @@ -66,8 +78,8 @@ define i32 @une_f64(double %x, double %y) { } ; CHECK-LABEL: olt_f64: -; CHECK: f64.lt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.lt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @olt_f64(double %x, double %y) { %a = fcmp olt double %x, %y %b = zext i1 %a to i32 @@ -75,8 +87,8 @@ define i32 @olt_f64(double %x, double %y) { } ; CHECK-LABEL: ole_f64: -; CHECK: f64.le $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.le push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ole_f64(double %x, double %y) { %a = fcmp ole double %x, %y %b = zext i1 %a to i32 @@ -84,8 +96,8 @@ define i32 @ole_f64(double %x, double %y) { } ; CHECK-LABEL: ogt_f64: -; CHECK: f64.gt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.gt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ogt_f64(double %x, double %y) { %a = fcmp ogt double %x, %y %b = zext i1 %a to i32 @@ -93,8 +105,8 @@ define i32 @ogt_f64(double %x, double %y) { } ; CHECK-LABEL: oge_f64: -; CHECK: f64.ge $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.ge push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @oge_f64(double %x, double %y) { %a = fcmp oge double %x, %y %b = zext i1 %a to i32 @@ -108,17 +120,21 @@ define i32 @oge_f64(double %x, double %y) { ; CHECK-NEXT: .param f64{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local f64, f64, i32, i32, i32, i32, i32{{$}} -; CHECK-NEXT: f64.eq $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: f64.ne $push, (get_local 1), (get_local 1){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: f64.ne $push, (get_local 0), (get_local 0){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: i32.or $push, (get_local 4), (get_local 3){{$}} -; CHECK-NEXT: set_local 5, $pop{{$}} -; CHECK-NEXT: i32.or $push, (get_local 2), (get_local 5){{$}} -; CHECK-NEXT: set_local 6, $pop{{$}} -; CHECK-NEXT: return (get_local 6){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f64.eq push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: f64.ne push, (get_local 2), (get_local 2){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: f64.ne push, (get_local 3), (get_local 3){{$}} +; CHECK-NEXT: set_local 6, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 6), (get_local 5){{$}} +; CHECK-NEXT: set_local 7, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 4), (get_local 7){{$}} +; CHECK-NEXT: set_local 8, pop{{$}} +; CHECK-NEXT: return (get_local 8){{$}} define i32 @ueq_f64(double %x, double %y) { %a = fcmp ueq double %x, %y %b = zext i1 %a to i32 @@ -126,8 +142,8 @@ define i32 @ueq_f64(double %x, double %y) { } ; CHECK-LABEL: one_f64: -; CHECK: f64.ne $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.ne push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @one_f64(double %x, double %y) { %a = fcmp one double %x, %y %b = zext i1 %a to i32 @@ -135,8 +151,8 @@ define i32 @one_f64(double %x, double %y) { } ; CHECK-LABEL: ult_f64: -; CHECK: f64.lt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.lt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ult_f64(double %x, double %y) { %a = fcmp ult double %x, %y %b = zext i1 %a to i32 @@ -144,8 +160,8 @@ define i32 @ult_f64(double %x, double %y) { } ; CHECK-LABEL: ule_f64: -; CHECK: f64.le $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.le push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ule_f64(double %x, double %y) { %a = fcmp ule double %x, %y %b = zext i1 %a to i32 @@ -153,8 +169,8 @@ define i32 @ule_f64(double %x, double %y) { } ; CHECK-LABEL: ugt_f64: -; CHECK: f64.gt $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.gt push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ugt_f64(double %x, double %y) { %a = fcmp ugt double %x, %y %b = zext i1 %a to i32 @@ -162,8 +178,8 @@ define i32 @ugt_f64(double %x, double %y) { } ; CHECK-LABEL: uge_f64: -; CHECK: f64.ge $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.ge push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @uge_f64(double %x, double %y) { %a = fcmp uge double %x, %y %b = zext i1 %a to i32 diff --git a/test/CodeGen/WebAssembly/comparisons_i32.ll b/test/CodeGen/WebAssembly/comparisons_i32.ll index 3362b5fc407..68275adff9a 100644 --- a/test/CodeGen/WebAssembly/comparisons_i32.ll +++ b/test/CodeGen/WebAssembly/comparisons_i32.ll @@ -10,9 +10,13 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.eq $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.eq push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @eq_i32(i32 %x, i32 %y) { %a = icmp eq i32 %x, %y %b = zext i1 %a to i32 @@ -20,8 +24,8 @@ define i32 @eq_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ne_i32: -; CHECK: i32.ne $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.ne push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ne_i32(i32 %x, i32 %y) { %a = icmp ne i32 %x, %y %b = zext i1 %a to i32 @@ -29,8 +33,8 @@ define i32 @ne_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: slt_i32: -; CHECK: i32.lt_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.lt_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @slt_i32(i32 %x, i32 %y) { %a = icmp slt i32 %x, %y %b = zext i1 %a to i32 @@ -38,8 +42,8 @@ define i32 @slt_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: sle_i32: -; CHECK: i32.le_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.le_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @sle_i32(i32 %x, i32 %y) { %a = icmp sle i32 %x, %y %b = zext i1 %a to i32 @@ -47,8 +51,8 @@ define i32 @sle_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ult_i32: -; CHECK: i32.lt_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.lt_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ult_i32(i32 %x, i32 %y) { %a = icmp ult i32 %x, %y %b = zext i1 %a to i32 @@ -56,8 +60,8 @@ define i32 @ult_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ule_i32: -; CHECK: i32.le_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.le_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ule_i32(i32 %x, i32 %y) { %a = icmp ule i32 %x, %y %b = zext i1 %a to i32 @@ -65,8 +69,8 @@ define i32 @ule_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: sgt_i32: -; CHECK: i32.gt_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.gt_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @sgt_i32(i32 %x, i32 %y) { %a = icmp sgt i32 %x, %y %b = zext i1 %a to i32 @@ -74,8 +78,8 @@ define i32 @sgt_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: sge_i32: -; CHECK: i32.ge_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.ge_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @sge_i32(i32 %x, i32 %y) { %a = icmp sge i32 %x, %y %b = zext i1 %a to i32 @@ -83,8 +87,8 @@ define i32 @sge_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ugt_i32: -; CHECK: i32.gt_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.gt_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ugt_i32(i32 %x, i32 %y) { %a = icmp ugt i32 %x, %y %b = zext i1 %a to i32 @@ -92,8 +96,8 @@ define i32 @ugt_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: uge_i32: -; CHECK: i32.ge_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i32.ge_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @uge_i32(i32 %x, i32 %y) { %a = icmp uge i32 %x, %y %b = zext i1 %a to i32 diff --git a/test/CodeGen/WebAssembly/comparisons_i64.ll b/test/CodeGen/WebAssembly/comparisons_i64.ll index 620d0f39067..807d523b7df 100644 --- a/test/CodeGen/WebAssembly/comparisons_i64.ll +++ b/test/CodeGen/WebAssembly/comparisons_i64.ll @@ -10,9 +10,13 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i64, i64, i32{{$}} -; CHECK-NEXT: i64.eq $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.eq push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @eq_i64(i64 %x, i64 %y) { %a = icmp eq i64 %x, %y %b = zext i1 %a to i32 @@ -20,8 +24,8 @@ define i32 @eq_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: ne_i64: -; CHECK: i64.ne $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.ne push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ne_i64(i64 %x, i64 %y) { %a = icmp ne i64 %x, %y %b = zext i1 %a to i32 @@ -29,8 +33,8 @@ define i32 @ne_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: slt_i64: -; CHECK: i64.lt_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.lt_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @slt_i64(i64 %x, i64 %y) { %a = icmp slt i64 %x, %y %b = zext i1 %a to i32 @@ -38,8 +42,8 @@ define i32 @slt_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: sle_i64: -; CHECK: i64.le_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.le_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @sle_i64(i64 %x, i64 %y) { %a = icmp sle i64 %x, %y %b = zext i1 %a to i32 @@ -47,8 +51,8 @@ define i32 @sle_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: ult_i64: -; CHECK: i64.lt_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.lt_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ult_i64(i64 %x, i64 %y) { %a = icmp ult i64 %x, %y %b = zext i1 %a to i32 @@ -56,8 +60,8 @@ define i32 @ult_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: ule_i64: -; CHECK: i64.le_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.le_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ule_i64(i64 %x, i64 %y) { %a = icmp ule i64 %x, %y %b = zext i1 %a to i32 @@ -65,8 +69,8 @@ define i32 @ule_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: sgt_i64: -; CHECK: i64.gt_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.gt_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @sgt_i64(i64 %x, i64 %y) { %a = icmp sgt i64 %x, %y %b = zext i1 %a to i32 @@ -74,8 +78,8 @@ define i32 @sgt_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: sge_i64: -; CHECK: i64.ge_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.ge_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @sge_i64(i64 %x, i64 %y) { %a = icmp sge i64 %x, %y %b = zext i1 %a to i32 @@ -83,8 +87,8 @@ define i32 @sge_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: ugt_i64: -; CHECK: i64.gt_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.gt_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @ugt_i64(i64 %x, i64 %y) { %a = icmp ugt i64 %x, %y %b = zext i1 %a to i32 @@ -92,8 +96,8 @@ define i32 @ugt_i64(i64 %x, i64 %y) { } ; CHECK-LABEL: uge_i64: -; CHECK: i64.ge_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: i64.ge_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define i32 @uge_i64(i64 %x, i64 %y) { %a = icmp uge i64 %x, %y %b = zext i1 %a to i32 diff --git a/test/CodeGen/WebAssembly/conv.ll b/test/CodeGen/WebAssembly/conv.ll index 946d88bc7e3..d2d567677ab 100644 --- a/test/CodeGen/WebAssembly/conv.ll +++ b/test/CodeGen/WebAssembly/conv.ll @@ -9,9 +9,11 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i64, i32{{$}} -; CHECK-NEXT: i32.wrap/i64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.wrap/i64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @i32_wrap_i64(i64 %x) { %a = trunc i64 %x to i32 ret i32 %a @@ -21,9 +23,11 @@ define i32 @i32_wrap_i64(i64 %x) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local i32, i64{{$}} -; CHECK-NEXT: i64.extend_s/i32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.extend_s/i32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @i64_extend_s_i32(i32 %x) { %a = sext i32 %x to i64 ret i64 %a @@ -33,9 +37,11 @@ define i64 @i64_extend_s_i32(i32 %x) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local i32, i64{{$}} -; CHECK-NEXT: i64.extend_u/i32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.extend_u/i32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @i64_extend_u_i32(i32 %x) { %a = zext i32 %x to i64 ret i64 %a @@ -45,9 +51,11 @@ define i64 @i64_extend_u_i32(i32 %x) { ; CHECK-NEXT: .param f32 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local f32, i32{{$}} -; CHECK-NEXT: i32.trunc_s/f32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.trunc_s/f32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @i32_trunc_s_f32(float %x) { %a = fptosi float %x to i32 ret i32 %a @@ -57,9 +65,11 @@ define i32 @i32_trunc_s_f32(float %x) { ; CHECK-NEXT: .param f32 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local f32, i32{{$}} -; CHECK-NEXT: i32.trunc_u/f32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.trunc_u/f32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @i32_trunc_u_f32(float %x) { %a = fptoui float %x to i32 ret i32 %a @@ -69,9 +79,11 @@ define i32 @i32_trunc_u_f32(float %x) { ; CHECK-NEXT: .param f64 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local f64, i32{{$}} -; CHECK-NEXT: i32.trunc_s/f64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.trunc_s/f64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @i32_trunc_s_f64(double %x) { %a = fptosi double %x to i32 ret i32 %a @@ -81,9 +93,11 @@ define i32 @i32_trunc_s_f64(double %x) { ; CHECK-NEXT: .param f64 ; CHECK-NEXT: .result i32 ; CHECK-NEXT: .local f64, i32{{$}} -; CHECK-NEXT: i32.trunc_u/f64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.trunc_u/f64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @i32_trunc_u_f64(double %x) { %a = fptoui double %x to i32 ret i32 %a @@ -93,9 +107,11 @@ define i32 @i32_trunc_u_f64(double %x) { ; CHECK-NEXT: .param f32 ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local f32, i64{{$}} -; CHECK-NEXT: i64.trunc_s/f32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.trunc_s/f32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @i64_trunc_s_f32(float %x) { %a = fptosi float %x to i64 ret i64 %a @@ -105,9 +121,11 @@ define i64 @i64_trunc_s_f32(float %x) { ; CHECK-NEXT: .param f32 ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local f32, i64{{$}} -; CHECK-NEXT: i64.trunc_u/f32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.trunc_u/f32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @i64_trunc_u_f32(float %x) { %a = fptoui float %x to i64 ret i64 %a @@ -117,9 +135,11 @@ define i64 @i64_trunc_u_f32(float %x) { ; CHECK-NEXT: .param f64 ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local f64, i64{{$}} -; CHECK-NEXT: i64.trunc_s/f64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.trunc_s/f64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @i64_trunc_s_f64(double %x) { %a = fptosi double %x to i64 ret i64 %a @@ -129,9 +149,11 @@ define i64 @i64_trunc_s_f64(double %x) { ; CHECK-NEXT: .param f64 ; CHECK-NEXT: .result i64 ; CHECK-NEXT: .local f64, i64{{$}} -; CHECK-NEXT: i64.trunc_u/f64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.trunc_u/f64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @i64_trunc_u_f64(double %x) { %a = fptoui double %x to i64 ret i64 %a @@ -141,9 +163,11 @@ define i64 @i64_trunc_u_f64(double %x) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result f32 ; CHECK-NEXT: .local i32, f32{{$}} -; CHECK-NEXT: f32.convert_s/i32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f32.convert_s/i32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define float @f32_convert_s_i32(i32 %x) { %a = sitofp i32 %x to float ret float %a @@ -153,9 +177,11 @@ define float @f32_convert_s_i32(i32 %x) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result f32 ; CHECK-NEXT: .local i32, f32{{$}} -; CHECK-NEXT: f32.convert_u/i32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f32.convert_u/i32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define float @f32_convert_u_i32(i32 %x) { %a = uitofp i32 %x to float ret float %a @@ -165,9 +191,11 @@ define float @f32_convert_u_i32(i32 %x) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result f64 ; CHECK-NEXT: .local i32, f64{{$}} -; CHECK-NEXT: f64.convert_s/i32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f64.convert_s/i32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define double @f64_convert_s_i32(i32 %x) { %a = sitofp i32 %x to double ret double %a @@ -177,9 +205,11 @@ define double @f64_convert_s_i32(i32 %x) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .result f64 ; CHECK-NEXT: .local i32, f64{{$}} -; CHECK-NEXT: f64.convert_u/i32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f64.convert_u/i32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define double @f64_convert_u_i32(i32 %x) { %a = uitofp i32 %x to double ret double %a @@ -189,9 +219,11 @@ define double @f64_convert_u_i32(i32 %x) { ; CHECK-NEXT: .param i64 ; CHECK-NEXT: .result f32 ; CHECK-NEXT: .local i64, f32{{$}} -; CHECK-NEXT: f32.convert_s/i64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f32.convert_s/i64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define float @f32_convert_s_i64(i64 %x) { %a = sitofp i64 %x to float ret float %a @@ -201,9 +233,11 @@ define float @f32_convert_s_i64(i64 %x) { ; CHECK-NEXT: .param i64 ; CHECK-NEXT: .result f32 ; CHECK-NEXT: .local i64, f32{{$}} -; CHECK-NEXT: f32.convert_u/i64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f32.convert_u/i64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define float @f32_convert_u_i64(i64 %x) { %a = uitofp i64 %x to float ret float %a @@ -213,9 +247,11 @@ define float @f32_convert_u_i64(i64 %x) { ; CHECK-NEXT: .param i64 ; CHECK-NEXT: .result f64 ; CHECK-NEXT: .local i64, f64{{$}} -; CHECK-NEXT: f64.convert_s/i64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f64.convert_s/i64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define double @f64_convert_s_i64(i64 %x) { %a = sitofp i64 %x to double ret double %a @@ -225,9 +261,11 @@ define double @f64_convert_s_i64(i64 %x) { ; CHECK-NEXT: .param i64 ; CHECK-NEXT: .result f64 ; CHECK-NEXT: .local i64, f64{{$}} -; CHECK-NEXT: f64.convert_u/i64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f64.convert_u/i64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define double @f64_convert_u_i64(i64 %x) { %a = uitofp i64 %x to double ret double %a @@ -237,9 +275,11 @@ define double @f64_convert_u_i64(i64 %x) { ; CHECK-NEXT: .param f32 ; CHECK-NEXT: .result f64 ; CHECK-NEXT: .local f32, f64{{$}} -; CHECK-NEXT: f64.promote/f32 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f64.promote/f32 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define double @f64_promote_f32(float %x) { %a = fpext float %x to double ret double %a @@ -249,9 +289,11 @@ define double @f64_promote_f32(float %x) { ; CHECK-NEXT: .param f64 ; CHECK-NEXT: .result f32 ; CHECK-NEXT: .local f64, f32{{$}} -; CHECK-NEXT: f32.demote/f64 $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f32.demote/f64 push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define float @f32_demote_f64(double %x) { %a = fptrunc double %x to float ret float %a diff --git a/test/CodeGen/WebAssembly/dead-vreg.ll b/test/CodeGen/WebAssembly/dead-vreg.ll index c05db3ed470..181a09d5924 100644 --- a/test/CodeGen/WebAssembly/dead-vreg.ll +++ b/test/CodeGen/WebAssembly/dead-vreg.ll @@ -1,6 +1,11 @@ ; RUN: llc < %s -asm-verbose=false | FileCheck %s -; Check that unused vregs aren't assigned registers. +; Check that unused vregs don't prevent locals from being numbered wrong. +; +; The test currently checks that the dead virtual registers still appear as +; locals, which isn't what we want long term. Removing them from the list of +; locals will require remapping the local numbers, and checking that the +; get_/set_local have the right numbers. target datalayout = "e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" @@ -10,7 +15,7 @@ define void @foo(i32* nocapture %a, i32 %w, i32 %h) { ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .param i32 -; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32{{$}} +; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32{{$}} entry: %cmp.19 = icmp sgt i32 %h, 0 br i1 %cmp.19, label %for.cond.1.preheader.lr.ph, label %for.end.7 diff --git a/test/CodeGen/WebAssembly/f32.ll b/test/CodeGen/WebAssembly/f32.ll index a8842dbe33a..3ae35880d0e 100644 --- a/test/CodeGen/WebAssembly/f32.ll +++ b/test/CodeGen/WebAssembly/f32.ll @@ -19,105 +19,109 @@ declare float @llvm.rint.f32(float) ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local f32, f32, f32{{$}} -; CHECK-NEXT: f32.add $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f32.add push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define float @fadd32(float %x, float %y) { %a = fadd float %x, %y ret float %a } ; CHECK-LABEL: fsub32: -; CHECK: f32.sub $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.sub push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define float @fsub32(float %x, float %y) { %a = fsub float %x, %y ret float %a } ; CHECK-LABEL: fmul32: -; CHECK: f32.mul $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.mul push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define float @fmul32(float %x, float %y) { %a = fmul float %x, %y ret float %a } ; CHECK-LABEL: fdiv32: -; CHECK: f32.div $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.div push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define float @fdiv32(float %x, float %y) { %a = fdiv float %x, %y ret float %a } ; CHECK-LABEL: fabs32: -; CHECK: f32.abs $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.abs push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @fabs32(float %x) { %a = call float @llvm.fabs.f32(float %x) ret float %a } ; CHECK-LABEL: fneg32: -; CHECK: f32.neg $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.neg push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @fneg32(float %x) { %a = fsub float -0., %x ret float %a } ; CHECK-LABEL: copysign32: -; CHECK: f32.copysign $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.copysign push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define float @copysign32(float %x, float %y) { %a = call float @llvm.copysign.f32(float %x, float %y) ret float %a } ; CHECK-LABEL: sqrt32: -; CHECK: f32.sqrt $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.sqrt push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @sqrt32(float %x) { %a = call float @llvm.sqrt.f32(float %x) ret float %a } ; CHECK-LABEL: ceil32: -; CHECK: f32.ceil $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.ceil push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @ceil32(float %x) { %a = call float @llvm.ceil.f32(float %x) ret float %a } ; CHECK-LABEL: floor32: -; CHECK: f32.floor $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.floor push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @floor32(float %x) { %a = call float @llvm.floor.f32(float %x) ret float %a } ; CHECK-LABEL: trunc32: -; CHECK: f32.trunc $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.trunc push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @trunc32(float %x) { %a = call float @llvm.trunc.f32(float %x) ret float %a } ; CHECK-LABEL: nearest32: -; CHECK: f32.nearest $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.nearest push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @nearest32(float %x) { %a = call float @llvm.nearbyint.f32(float %x) ret float %a } ; CHECK-LABEL: nearest32_via_rint: -; CHECK: f32.nearest $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f32.nearest push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define float @nearest32_via_rint(float %x) { %a = call float @llvm.rint.f32(float %x) ret float %a @@ -130,8 +134,8 @@ define float @nearest32_via_rint(float %x) { ; tests. ; CHECK-LABEL: fmin32: -; CHECK: f32.min $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.min push, (get_local 1), (get_local 2){{$}} +; CHECK-NEXT: set_local 3, pop{{$}} define float @fmin32(float %x) { %a = fcmp ult float %x, 0.0 %b = select i1 %a, float %x, float 0.0 @@ -139,8 +143,8 @@ define float @fmin32(float %x) { } ; CHECK-LABEL: fmax32: -; CHECK: f32.max $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f32.max push, (get_local 1), (get_local 2){{$}} +; CHECK-NEXT: set_local 3, pop{{$}} define float @fmax32(float %x) { %a = fcmp ugt float %x, 0.0 %b = select i1 %a, float %x, float 0.0 diff --git a/test/CodeGen/WebAssembly/f64.ll b/test/CodeGen/WebAssembly/f64.ll index 3cd68794e38..d5f6f3e7fe3 100644 --- a/test/CodeGen/WebAssembly/f64.ll +++ b/test/CodeGen/WebAssembly/f64.ll @@ -19,105 +19,109 @@ declare double @llvm.rint.f64(double) ; CHECK-NEXT: .param f64{{$}} ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local f64, f64, f64{{$}} -; CHECK-NEXT: f64.add $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f64.add push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define double @fadd64(double %x, double %y) { %a = fadd double %x, %y ret double %a } ; CHECK-LABEL: fsub64: -; CHECK: f64.sub $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.sub push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define double @fsub64(double %x, double %y) { %a = fsub double %x, %y ret double %a } ; CHECK-LABEL: fmul64: -; CHECK: f64.mul $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.mul push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define double @fmul64(double %x, double %y) { %a = fmul double %x, %y ret double %a } ; CHECK-LABEL: fdiv64: -; CHECK: f64.div $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.div push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define double @fdiv64(double %x, double %y) { %a = fdiv double %x, %y ret double %a } ; CHECK-LABEL: fabs64: -; CHECK: f64.abs $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.abs push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @fabs64(double %x) { %a = call double @llvm.fabs.f64(double %x) ret double %a } ; CHECK-LABEL: fneg64: -; CHECK: f64.neg $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.neg push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @fneg64(double %x) { %a = fsub double -0., %x ret double %a } ; CHECK-LABEL: copysign64: -; CHECK: f64.copysign $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.copysign push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} define double @copysign64(double %x, double %y) { %a = call double @llvm.copysign.f64(double %x, double %y) ret double %a } ; CHECK-LABEL: sqrt64: -; CHECK: f64.sqrt $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.sqrt push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @sqrt64(double %x) { %a = call double @llvm.sqrt.f64(double %x) ret double %a } ; CHECK-LABEL: ceil64: -; CHECK: f64.ceil $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.ceil push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @ceil64(double %x) { %a = call double @llvm.ceil.f64(double %x) ret double %a } ; CHECK-LABEL: floor64: -; CHECK: f64.floor $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.floor push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @floor64(double %x) { %a = call double @llvm.floor.f64(double %x) ret double %a } ; CHECK-LABEL: trunc64: -; CHECK: f64.trunc $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.trunc push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @trunc64(double %x) { %a = call double @llvm.trunc.f64(double %x) ret double %a } ; CHECK-LABEL: nearest64: -; CHECK: f64.nearest $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.nearest push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @nearest64(double %x) { %a = call double @llvm.nearbyint.f64(double %x) ret double %a } ; CHECK-LABEL: nearest64_via_rint: -; CHECK: f64.nearest $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: f64.nearest push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define double @nearest64_via_rint(double %x) { %a = call double @llvm.rint.f64(double %x) ret double %a @@ -130,8 +134,8 @@ define double @nearest64_via_rint(double %x) { ; tests. ; CHECK-LABEL: fmin64: -; CHECK: f64.min $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.min push, (get_local 1), (get_local 2){{$}} +; CHECK-NEXT: set_local 3, pop{{$}} define double @fmin64(double %x) { %a = fcmp ult double %x, 0.0 %b = select i1 %a, double %x, double 0.0 @@ -139,8 +143,8 @@ define double @fmin64(double %x) { } ; CHECK-LABEL: fmax64: -; CHECK: f64.max $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK: f64.max push, (get_local 1), (get_local 2){{$}} +; CHECK-NEXT: set_local 3, pop{{$}} define double @fmax64(double %x) { %a = fcmp ugt double %x, 0.0 %b = select i1 %a, double %x, double 0.0 diff --git a/test/CodeGen/WebAssembly/fast-isel.ll b/test/CodeGen/WebAssembly/fast-isel.ll index 5d68af4b986..f079b1a9325 100644 --- a/test/CodeGen/WebAssembly/fast-isel.ll +++ b/test/CodeGen/WebAssembly/fast-isel.ll @@ -8,13 +8,13 @@ target triple = "wasm32-unknown-unknown" ; This tests very minimal fast-isel functionality. ; CHECK-LABEL: immediate_f32: -; CHECK: f32.const $push, 0x1.4p1{{$}} +; CHECK: f32.const push, 0x1.4p1{{$}} define float @immediate_f32() { ret float 2.5 } ; CHECK-LABEL: immediate_f64: -; CHECK: f64.const $push, 0x1.4p1{{$}} +; CHECK: f64.const push, 0x1.4p1{{$}} define double @immediate_f64() { ret double 2.5 } diff --git a/test/CodeGen/WebAssembly/func.ll b/test/CodeGen/WebAssembly/func.ll index 17d20760e8c..cd78df0d1a2 100644 --- a/test/CodeGen/WebAssembly/func.ll +++ b/test/CodeGen/WebAssembly/func.ll @@ -15,8 +15,8 @@ define void @f0() { ; CHECK-LABEL: f1: ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32{{$}} -; CHECK-NEXT: i32.const $push, 0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i32.const push, 0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} ; CHECK: .size f1, define i32 @f1() { @@ -28,8 +28,8 @@ define i32 @f1() { ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32{{$}} -; CHECK-NEXT: i32.const $push, 0{{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} +; CHECK-NEXT: i32.const push, 0{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: return (get_local 2){{$}} ; CHECK: .size f2, define i32 @f2(i32 %p1, float %p2) { diff --git a/test/CodeGen/WebAssembly/i32.ll b/test/CodeGen/WebAssembly/i32.ll index 51d9549b4d3..074bed17ce6 100644 --- a/test/CodeGen/WebAssembly/i32.ll +++ b/test/CodeGen/WebAssembly/i32.ll @@ -14,9 +14,13 @@ declare i32 @llvm.ctpop.i32(i32) ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.add $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.add push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @add32(i32 %x, i32 %y) { %a = add i32 %x, %y ret i32 %a @@ -27,9 +31,13 @@ define i32 @add32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.sub $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.sub push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @sub32(i32 %x, i32 %y) { %a = sub i32 %x, %y ret i32 %a @@ -40,9 +48,13 @@ define i32 @sub32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.mul $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.mul push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @mul32(i32 %x, i32 %y) { %a = mul i32 %x, %y ret i32 %a @@ -53,9 +65,13 @@ define i32 @mul32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.div_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.div_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @sdiv32(i32 %x, i32 %y) { %a = sdiv i32 %x, %y ret i32 %a @@ -66,9 +82,13 @@ define i32 @sdiv32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.div_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.div_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @udiv32(i32 %x, i32 %y) { %a = udiv i32 %x, %y ret i32 %a @@ -79,9 +99,13 @@ define i32 @udiv32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.rem_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.rem_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @srem32(i32 %x, i32 %y) { %a = srem i32 %x, %y ret i32 %a @@ -92,9 +116,13 @@ define i32 @srem32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.rem_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.rem_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @urem32(i32 %x, i32 %y) { %a = urem i32 %x, %y ret i32 %a @@ -105,9 +133,13 @@ define i32 @urem32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.and $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.and push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @and32(i32 %x, i32 %y) { %a = and i32 %x, %y ret i32 %a @@ -118,9 +150,13 @@ define i32 @and32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.or $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.or push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @or32(i32 %x, i32 %y) { %a = or i32 %x, %y ret i32 %a @@ -131,9 +167,13 @@ define i32 @or32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.xor $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.xor push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @xor32(i32 %x, i32 %y) { %a = xor i32 %x, %y ret i32 %a @@ -144,9 +184,13 @@ define i32 @xor32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.shl $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.shl push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @shl32(i32 %x, i32 %y) { %a = shl i32 %x, %y ret i32 %a @@ -157,9 +201,13 @@ define i32 @shl32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.shr_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.shr_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @shr32(i32 %x, i32 %y) { %a = lshr i32 %x, %y ret i32 %a @@ -170,9 +218,13 @@ define i32 @shr32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32, i32{{$}} -; CHECK-NEXT: i32.shr_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.shr_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i32 @sar32(i32 %x, i32 %y) { %a = ashr i32 %x, %y ret i32 %a @@ -182,9 +234,11 @@ define i32 @sar32(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.clz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.clz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @clz32(i32 %x) { %a = call i32 @llvm.ctlz.i32(i32 %x, i1 false) ret i32 %a @@ -194,9 +248,11 @@ define i32 @clz32(i32 %x) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.clz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.clz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @clz32_zero_undef(i32 %x) { %a = call i32 @llvm.ctlz.i32(i32 %x, i1 true) ret i32 %a @@ -206,9 +262,11 @@ define i32 @clz32_zero_undef(i32 %x) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.ctz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.ctz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @ctz32(i32 %x) { %a = call i32 @llvm.cttz.i32(i32 %x, i1 false) ret i32 %a @@ -218,9 +276,11 @@ define i32 @ctz32(i32 %x) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.ctz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.ctz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @ctz32_zero_undef(i32 %x) { %a = call i32 @llvm.cttz.i32(i32 %x, i1 true) ret i32 %a @@ -230,9 +290,11 @@ define i32 @ctz32_zero_undef(i32 %x) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.popcnt $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.popcnt push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @popcnt32(i32 %x) { %a = call i32 @llvm.ctpop.i32(i32 %x) ret i32 %a diff --git a/test/CodeGen/WebAssembly/i64.ll b/test/CodeGen/WebAssembly/i64.ll index f6a40032c57..331381d14cb 100644 --- a/test/CodeGen/WebAssembly/i64.ll +++ b/test/CodeGen/WebAssembly/i64.ll @@ -14,9 +14,13 @@ declare i64 @llvm.ctpop.i64(i64) ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.add $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.add push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @add64(i64 %x, i64 %y) { %a = add i64 %x, %y ret i64 %a @@ -27,9 +31,13 @@ define i64 @add64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.sub $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.sub push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @sub64(i64 %x, i64 %y) { %a = sub i64 %x, %y ret i64 %a @@ -40,9 +48,13 @@ define i64 @sub64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.mul $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.mul push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @mul64(i64 %x, i64 %y) { %a = mul i64 %x, %y ret i64 %a @@ -53,9 +65,13 @@ define i64 @mul64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.div_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.div_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @sdiv64(i64 %x, i64 %y) { %a = sdiv i64 %x, %y ret i64 %a @@ -66,9 +82,13 @@ define i64 @sdiv64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.div_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.div_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @udiv64(i64 %x, i64 %y) { %a = udiv i64 %x, %y ret i64 %a @@ -79,9 +99,13 @@ define i64 @udiv64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.rem_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.rem_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @srem64(i64 %x, i64 %y) { %a = srem i64 %x, %y ret i64 %a @@ -92,9 +116,13 @@ define i64 @srem64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.rem_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.rem_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @urem64(i64 %x, i64 %y) { %a = urem i64 %x, %y ret i64 %a @@ -105,9 +133,13 @@ define i64 @urem64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.and $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.and push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @and64(i64 %x, i64 %y) { %a = and i64 %x, %y ret i64 %a @@ -118,9 +150,13 @@ define i64 @and64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.or $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.or push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @or64(i64 %x, i64 %y) { %a = or i64 %x, %y ret i64 %a @@ -131,9 +167,13 @@ define i64 @or64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.xor $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.xor push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @xor64(i64 %x, i64 %y) { %a = xor i64 %x, %y ret i64 %a @@ -144,9 +184,13 @@ define i64 @xor64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.shl $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.shl push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @shl64(i64 %x, i64 %y) { %a = shl i64 %x, %y ret i64 %a @@ -157,9 +201,13 @@ define i64 @shl64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.shr_u $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.shr_u push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @shr64(i64 %x, i64 %y) { %a = lshr i64 %x, %y ret i64 %a @@ -170,9 +218,13 @@ define i64 @shr64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64, i64{{$}} -; CHECK-NEXT: i64.shr_s $push, (get_local 0), (get_local 1){{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: return (get_local 2){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.shr_s push, (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: return (get_local 4){{$}} define i64 @sar64(i64 %x, i64 %y) { %a = ashr i64 %x, %y ret i64 %a @@ -182,9 +234,11 @@ define i64 @sar64(i64 %x, i64 %y) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64{{$}} -; CHECK-NEXT: i64.clz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.clz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @clz64(i64 %x) { %a = call i64 @llvm.ctlz.i64(i64 %x, i1 false) ret i64 %a @@ -194,9 +248,11 @@ define i64 @clz64(i64 %x) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64{{$}} -; CHECK-NEXT: i64.clz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.clz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @clz64_zero_undef(i64 %x) { %a = call i64 @llvm.ctlz.i64(i64 %x, i1 true) ret i64 %a @@ -206,9 +262,11 @@ define i64 @clz64_zero_undef(i64 %x) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64{{$}} -; CHECK-NEXT: i64.ctz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.ctz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @ctz64(i64 %x) { %a = call i64 @llvm.cttz.i64(i64 %x, i1 false) ret i64 %a @@ -218,9 +276,11 @@ define i64 @ctz64(i64 %x) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64{{$}} -; CHECK-NEXT: i64.ctz $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.ctz push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @ctz64_zero_undef(i64 %x) { %a = call i64 @llvm.cttz.i64(i64 %x, i1 true) ret i64 %a @@ -230,9 +290,11 @@ define i64 @ctz64_zero_undef(i64 %x) { ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64, i64{{$}} -; CHECK-NEXT: i64.popcnt $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.popcnt push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @popcnt64(i64 %x) { %a = call i64 @llvm.ctpop.i64(i64 %x) ret i64 %a diff --git a/test/CodeGen/WebAssembly/immediates.ll b/test/CodeGen/WebAssembly/immediates.ll index 82757b5f7a4..e2635993dee 100644 --- a/test/CodeGen/WebAssembly/immediates.ll +++ b/test/CodeGen/WebAssembly/immediates.ll @@ -8,8 +8,8 @@ target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: zero_i32: ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i32.const $push, 0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i32.const push, 0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i32 @zero_i32() { ret i32 0 @@ -18,8 +18,8 @@ define i32 @zero_i32() { ; CHECK-LABEL: one_i32: ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i32.const $push, 1{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i32.const push, 1{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i32 @one_i32() { ret i32 1 @@ -28,8 +28,8 @@ define i32 @one_i32() { ; CHECK-LABEL: max_i32: ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i32.const $push, 2147483647{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i32.const push, 2147483647{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i32 @max_i32() { ret i32 2147483647 @@ -38,8 +38,8 @@ define i32 @max_i32() { ; CHECK-LABEL: min_i32: ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i32.const $push, -2147483648{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i32.const push, -2147483648{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i32 @min_i32() { ret i32 -2147483648 @@ -48,8 +48,8 @@ define i32 @min_i32() { ; CHECK-LABEL: zero_i64: ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i64.const $push, 0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i64.const push, 0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i64 @zero_i64() { ret i64 0 @@ -58,8 +58,8 @@ define i64 @zero_i64() { ; CHECK-LABEL: one_i64: ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i64.const $push, 1{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i64.const push, 1{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i64 @one_i64() { ret i64 1 @@ -68,8 +68,8 @@ define i64 @one_i64() { ; CHECK-LABEL: max_i64: ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i64.const $push, 9223372036854775807{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i64.const push, 9223372036854775807{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i64 @max_i64() { ret i64 9223372036854775807 @@ -78,8 +78,8 @@ define i64 @max_i64() { ; CHECK-LABEL: min_i64: ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: i64.const $push, -9223372036854775808{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: i64.const push, -9223372036854775808{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i64 @min_i64() { ret i64 -9223372036854775808 @@ -88,8 +88,8 @@ define i64 @min_i64() { ; CHECK-LABEL: negzero_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, -0x0p0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, -0x0p0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @negzero_f32() { ret float -0.0 @@ -98,8 +98,8 @@ define float @negzero_f32() { ; CHECK-LABEL: zero_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, 0x0p0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, 0x0p0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @zero_f32() { ret float 0.0 @@ -108,8 +108,8 @@ define float @zero_f32() { ; CHECK-LABEL: one_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, 0x1p0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, 0x1p0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @one_f32() { ret float 1.0 @@ -118,8 +118,8 @@ define float @one_f32() { ; CHECK-LABEL: two_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, 0x1p1{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, 0x1p1{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @two_f32() { ret float 2.0 @@ -128,8 +128,8 @@ define float @two_f32() { ; CHECK-LABEL: nan_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, nan -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, nan +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @nan_f32() { ret float 0x7FF8000000000000 @@ -138,8 +138,8 @@ define float @nan_f32() { ; CHECK-LABEL: negnan_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, -nan -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, -nan +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @negnan_f32() { ret float 0xFFF8000000000000 @@ -148,8 +148,8 @@ define float @negnan_f32() { ; CHECK-LABEL: inf_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, infinity -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, infinity +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @inf_f32() { ret float 0x7FF0000000000000 @@ -158,8 +158,8 @@ define float @inf_f32() { ; CHECK-LABEL: neginf_f32: ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f32.const $push, -infinity -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f32.const push, -infinity +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define float @neginf_f32() { ret float 0xFFF0000000000000 @@ -168,8 +168,8 @@ define float @neginf_f32() { ; CHECK-LABEL: negzero_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, -0x0p0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, -0x0p0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @negzero_f64() { ret double -0.0 @@ -178,8 +178,8 @@ define double @negzero_f64() { ; CHECK-LABEL: zero_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, 0x0p0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, 0x0p0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @zero_f64() { ret double 0.0 @@ -188,8 +188,8 @@ define double @zero_f64() { ; CHECK-LABEL: one_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, 0x1p0{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, 0x1p0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @one_f64() { ret double 1.0 @@ -198,8 +198,8 @@ define double @one_f64() { ; CHECK-LABEL: two_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, 0x1p1{{$}} -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, 0x1p1{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @two_f64() { ret double 2.0 @@ -208,8 +208,8 @@ define double @two_f64() { ; CHECK-LABEL: nan_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, nan -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, nan +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @nan_f64() { ret double 0x7FF8000000000000 @@ -218,8 +218,8 @@ define double @nan_f64() { ; CHECK-LABEL: negnan_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, -nan -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, -nan +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @negnan_f64() { ret double 0xFFF8000000000000 @@ -228,8 +228,8 @@ define double @negnan_f64() { ; CHECK-LABEL: inf_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, infinity -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, infinity +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @inf_f64() { ret double 0x7FF0000000000000 @@ -238,8 +238,8 @@ define double @inf_f64() { ; CHECK-LABEL: neginf_f64: ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local -; CHECK-NEXT: f64.const $push, -infinity -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: f64.const push, -infinity +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define double @neginf_f64() { ret double 0xFFF0000000000000 diff --git a/test/CodeGen/WebAssembly/import.ll b/test/CodeGen/WebAssembly/import.ll index 2547bae92ea..09c7cefcd65 100644 --- a/test/CodeGen/WebAssembly/import.ll +++ b/test/CodeGen/WebAssembly/import.ll @@ -16,13 +16,13 @@ define void @f(i32 %a, float %b, i128 %c, i1 %d) { } ; CHECK-LABEL: .imports -; CHECK-NEXT: .import printi "" printi (param i32) (result i32){{$}} -; CHECK-NEXT: .import printf "" printf (param f32) (result f32){{$}} -; CHECK-NEXT: .import printv "" printv{{$}} -; CHECK-NEXT: .import add2 "" add2 (param i32 i32) (result i32){{$}} -; CHECK-NEXT: .import split_arg "" split_arg (param i64 i64){{$}} -; CHECK-NEXT: .import expanded_arg "" expanded_arg (param i32){{$}} -; CHECK-NEXT: .import lowered_result "" lowered_result (result i32){{$}} +; CHECK-NEXT: .import $printi "" "printi" (param i32) (result i32){{$}} +; CHECK-NEXT: .import $printf "" "printf" (param f32) (result f32){{$}} +; CHECK-NEXT: .import $printv "" "printv"{{$}} +; CHECK-NEXT: .import $add2 "" "add2" (param i32 i32) (result i32){{$}} +; CHECK-NEXT: .import $split_arg "" "split_arg" (param i64 i64){{$}} +; CHECK-NEXT: .import $expanded_arg "" "expanded_arg" (param i32){{$}} +; CHECK-NEXT: .import $lowered_result "" "lowered_result" (result i32){{$}} declare i32 @printi(i32) declare float @printf(float) declare void @printv() diff --git a/test/CodeGen/WebAssembly/load-ext.ll b/test/CodeGen/WebAssembly/load-ext.ll index e0c2646bc24..e6fb59c0493 100644 --- a/test/CodeGen/WebAssembly/load-ext.ll +++ b/test/CodeGen/WebAssembly/load-ext.ll @@ -6,8 +6,8 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: sext_i8_i32: -; CHECK: i32.load8_s $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i32.load8_s push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i32 @sext_i8_i32(i8 *%p) { %v = load i8, i8* %p %e = sext i8 %v to i32 @@ -15,8 +15,8 @@ define i32 @sext_i8_i32(i8 *%p) { } ; CHECK-LABEL: zext_i8_i32: -; CHECK: i32.load8_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i32.load8_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i32 @zext_i8_i32(i8 *%p) { %v = load i8, i8* %p %e = zext i8 %v to i32 @@ -24,8 +24,8 @@ define i32 @zext_i8_i32(i8 *%p) { } ; CHECK-LABEL: sext_i16_i32: -; CHECK: i32.load16_s $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i32.load16_s push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i32 @sext_i16_i32(i16 *%p) { %v = load i16, i16* %p %e = sext i16 %v to i32 @@ -33,8 +33,8 @@ define i32 @sext_i16_i32(i16 *%p) { } ; CHECK-LABEL: zext_i16_i32: -; CHECK: i32.load16_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i32.load16_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i32 @zext_i16_i32(i16 *%p) { %v = load i16, i16* %p %e = zext i16 %v to i32 @@ -42,8 +42,8 @@ define i32 @zext_i16_i32(i16 *%p) { } ; CHECK-LABEL: sext_i8_i64: -; CHECK: i64.load8_s $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i64.load8_s push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i64 @sext_i8_i64(i8 *%p) { %v = load i8, i8* %p %e = sext i8 %v to i64 @@ -51,8 +51,8 @@ define i64 @sext_i8_i64(i8 *%p) { } ; CHECK-LABEL: zext_i8_i64: -; CHECK: i64.load8_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i64.load8_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i64 @zext_i8_i64(i8 *%p) { %v = load i8, i8* %p %e = zext i8 %v to i64 @@ -60,8 +60,8 @@ define i64 @zext_i8_i64(i8 *%p) { } ; CHECK-LABEL: sext_i16_i64: -; CHECK: i64.load16_s $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i64.load16_s push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i64 @sext_i16_i64(i16 *%p) { %v = load i16, i16* %p %e = sext i16 %v to i64 @@ -69,8 +69,8 @@ define i64 @sext_i16_i64(i16 *%p) { } ; CHECK-LABEL: zext_i16_i64: -; CHECK: i64.load16_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i64.load16_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i64 @zext_i16_i64(i16 *%p) { %v = load i16, i16* %p %e = zext i16 %v to i64 @@ -78,8 +78,8 @@ define i64 @zext_i16_i64(i16 *%p) { } ; CHECK-LABEL: sext_i32_i64: -; CHECK: i64.load32_s $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} +; CHECK: i64.load32_s push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} define i64 @sext_i32_i64(i32 *%p) { %v = load i32, i32* %p %e = sext i32 %v to i64 @@ -87,8 +87,8 @@ define i64 @sext_i32_i64(i32 *%p) { } ; CHECK-LABEL: zext_i32_i64: -; CHECK: i64.load32_u $push, (get_local 0){{$}} -; CHECK: set_local 1, $pop{{$}} +; CHECK: i64.load32_u push, (get_local 1){{$}} +; CHECK: set_local 2, pop{{$}} define i64 @zext_i32_i64(i32 *%p) { %v = load i32, i32* %p %e = zext i32 %v to i64 diff --git a/test/CodeGen/WebAssembly/load-store-i1.ll b/test/CodeGen/WebAssembly/load-store-i1.ll index ba14294b96a..cb89e2c1772 100644 --- a/test/CodeGen/WebAssembly/load-store-i1.ll +++ b/test/CodeGen/WebAssembly/load-store-i1.ll @@ -6,9 +6,9 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: load_u_i1_i32: -; CHECK: i32.load8_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK: i32.load8_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @load_u_i1_i32(i1* %p) { %v = load i1, i1* %p %e = zext i1 %v to i32 @@ -16,15 +16,15 @@ define i32 @load_u_i1_i32(i1* %p) { } ; CHECK-LABEL: load_s_i1_i32: -; CHECK: i32.load8_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: i32.const $push, 31{{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: shl $push, (get_local 1), (get_local 2){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: shr_s $push, (get_local 3), (get_local 2){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: return (get_local 4){{$}} +; CHECK: i32.load8_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: i32.const push, 31{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: shl push, (get_local 2), (get_local 3){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: shr_s push, (get_local 4), (get_local 3){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: return (get_local 5){{$}} define i32 @load_s_i1_i32(i1* %p) { %v = load i1, i1* %p %e = sext i1 %v to i32 @@ -32,9 +32,9 @@ define i32 @load_s_i1_i32(i1* %p) { } ; CHECK-LABEL: load_u_i1_i64: -; CHECK: i64.load8_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK: i64.load8_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @load_u_i1_i64(i1* %p) { %v = load i1, i1* %p %e = zext i1 %v to i64 @@ -42,15 +42,15 @@ define i64 @load_u_i1_i64(i1* %p) { } ; CHECK-LABEL: load_s_i1_i64: -; CHECK: i64.load8_u $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: i64.const $push, 63{{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: shl $push, (get_local 1), (get_local 2){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: shr_s $push, (get_local 3), (get_local 2){{$}} -; CHECK-NEXT: set_local 4, $pop{{$}} -; CHECK-NEXT: return (get_local 4){{$}} +; CHECK: i64.load8_u push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: i64.const push, 63{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: shl push, (get_local 2), (get_local 3){{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: shr_s push, (get_local 4), (get_local 3){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: return (get_local 5){{$}} define i64 @load_s_i1_i64(i1* %p) { %v = load i1, i1* %p %e = sext i1 %v to i64 @@ -58,11 +58,11 @@ define i64 @load_s_i1_i64(i1* %p) { } ; CHECK-LABEL: store_i32_i1: -; CHECK: i32.const $push, 1{{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: i32.and $push, (get_local 1), (get_local 2){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: i32.store8 (get_local 0), (get_local 3){{$}} +; CHECK: i32.const push, 1{{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: i32.and push, (get_local 3), (get_local 4){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: i32.store8 (get_local 2), (get_local 5){{$}} define void @store_i32_i1(i1* %p, i32 %v) { %t = trunc i32 %v to i1 store i1 %t, i1* %p @@ -70,11 +70,11 @@ define void @store_i32_i1(i1* %p, i32 %v) { } ; CHECK-LABEL: store_i64_i1: -; CHECK: i64.const $push, 1{{$}} -; CHECK-NEXT: set_local 2, $pop{{$}} -; CHECK-NEXT: i64.and $push, (get_local 1), (get_local 2){{$}} -; CHECK-NEXT: set_local 3, $pop{{$}} -; CHECK-NEXT: i64.store8 (get_local 0), (get_local 3){{$}} +; CHECK: i64.const push, 1{{$}} +; CHECK-NEXT: set_local 4, pop{{$}} +; CHECK-NEXT: i64.and push, (get_local 3), (get_local 4){{$}} +; CHECK-NEXT: set_local 5, pop{{$}} +; CHECK-NEXT: i64.store8 (get_local 2), (get_local 5){{$}} define void @store_i64_i1(i1* %p, i64 %v) { %t = trunc i64 %v to i1 store i1 %t, i1* %p diff --git a/test/CodeGen/WebAssembly/load.ll b/test/CodeGen/WebAssembly/load.ll index 74a034c5c5b..6660f2ce0a2 100644 --- a/test/CodeGen/WebAssembly/load.ll +++ b/test/CodeGen/WebAssembly/load.ll @@ -9,9 +9,11 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.load $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i32.load push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @ldi32(i32 *%p) { %v = load i32, i32* %p ret i32 %v @@ -21,9 +23,11 @@ define i32 @ldi32(i32 *%p) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i32, i64{{$}} -; CHECK-NEXT: i64.load $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: i64.load push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i64 @ldi64(i64 *%p) { %v = load i64, i64* %p ret i64 %v @@ -33,9 +37,11 @@ define i64 @ldi64(i64 *%p) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result f32{{$}} ; CHECK-NEXT: .local i32, f32{{$}} -; CHECK-NEXT: f32.load $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f32.load push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define float @ldf32(float *%p) { %v = load float, float* %p ret float %v @@ -45,9 +51,11 @@ define float @ldf32(float *%p) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result f64{{$}} ; CHECK-NEXT: .local i32, f64{{$}} -; CHECK-NEXT: f64.load $push, (get_local 0){{$}} -; CHECK-NEXT: set_local 1, $pop{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 1, pop{{$}} +; CHECK-NEXT: f64.load push, (get_local 1){{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define double @ldf64(double *%p) { %v = load double, double* %p ret double %v diff --git a/test/CodeGen/WebAssembly/memory-addr32.ll b/test/CodeGen/WebAssembly/memory-addr32.ll index 9193d794b5e..194fd64cce8 100644 --- a/test/CodeGen/WebAssembly/memory-addr32.ll +++ b/test/CodeGen/WebAssembly/memory-addr32.ll @@ -12,7 +12,7 @@ declare void @llvm.wasm.grow.memory.i32(i32) nounwind ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32{{$}} ; CHECK-NEXT: memory_size -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i32 @memory_size() { %a = call i32 @llvm.wasm.memory.size.i32() @@ -22,7 +22,7 @@ define i32 @memory_size() { ; CHECK-LABEL: grow_memory: ; CHECK-NEXT: .param i32 ; CHECK-NEXT: .local i32{{$}} -; CHECK: grow_memory (get_local 0) +; CHECK: grow_memory (get_local 1) ; CHECK-NEXT: return define void @grow_memory(i32 %n) { call void @llvm.wasm.grow.memory.i32(i32 %n) diff --git a/test/CodeGen/WebAssembly/memory-addr64.ll b/test/CodeGen/WebAssembly/memory-addr64.ll index 5748715e7c6..54e1c4aa9e4 100644 --- a/test/CodeGen/WebAssembly/memory-addr64.ll +++ b/test/CodeGen/WebAssembly/memory-addr64.ll @@ -12,7 +12,7 @@ declare void @llvm.wasm.grow.memory.i64(i64) nounwind ; CHECK-NEXT: .result i64{{$}} ; CHECK-NEXT: .local i64{{$}} ; CHECK-NEXT: memory_size -; CHECK-NEXT: set_local 0, $pop{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} ; CHECK-NEXT: return (get_local 0){{$}} define i64 @memory_size() { %a = call i64 @llvm.wasm.memory.size.i64() @@ -22,7 +22,7 @@ define i64 @memory_size() { ; CHECK-LABEL: grow_memory: ; CHECK-NEXT: .param i64 ; CHECK-NEXT: .local i64{{$}} -; CHECK: grow_memory (get_local 0) +; CHECK: grow_memory (get_local 1) ; CHECK-NEXT: return define void @grow_memory(i64 %n) { call void @llvm.wasm.grow.memory.i64(i64 %n) diff --git a/test/CodeGen/WebAssembly/phi.ll b/test/CodeGen/WebAssembly/phi.ll index 25fbdca5e5b..39c3561bb2a 100644 --- a/test/CodeGen/WebAssembly/phi.ll +++ b/test/CodeGen/WebAssembly/phi.ll @@ -8,9 +8,11 @@ target triple = "wasm32-unknown-unknown" ; Basic phi triangle. ; CHECK-LABEL: test0: -; CHECK: div_s $push, (get_local 0), (get_local 3){{$}} -; CHECK: set_local 0, $pop -; CHECK: return (get_local 0) +; CHECK: get_local push, 0{{$}} +; CHECK: set_local [[REG:.*]], pop +; CHECK: div_s push, (get_local [[REG]]), {{.*}} +; CHECK: set_local [[REG]], pop +; CHECK: return (get_local [[REG]]) define i32 @test0(i32 %p) { entry: %t = icmp slt i32 %p, 0 @@ -27,9 +29,12 @@ done: ; CHECK-LABEL: test1: ; CHECK: BB1_1: -; CHECK: set_local [[REG0:.*]], (get_local [[REG1:.*]]) -; CHECK: set_local [[REG1]], (get_local [[REG2:.*]]) -; CHECK: set_local [[REG2]], (get_local [[REG0]]) +; CHECK: get_local push, [[REG1:.*]] +; CHECK: set_local [[REG0:.*]], pop +; CHECK: get_local push, [[REG2:.*]] +; CHECK: set_local [[REG1]], pop +; CHECK: [[REG0]] +; CHECK: set_local [[REG2]], pop define i32 @test1(i32 %n) { entry: br label %loop diff --git a/test/CodeGen/WebAssembly/return-int32.ll b/test/CodeGen/WebAssembly/return-int32.ll index 427b07b2c8a..e0f7957b77e 100644 --- a/test/CodeGen/WebAssembly/return-int32.ll +++ b/test/CodeGen/WebAssembly/return-int32.ll @@ -4,7 +4,7 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: return_i32: -; CHECK: return (get_local 0){{$}} +; CHECK: return (get_local 1){{$}} define i32 @return_i32(i32 %p) { ret i32 %p } diff --git a/test/CodeGen/WebAssembly/select.ll b/test/CodeGen/WebAssembly/select.ll index 6b9679f9e5e..3661b9ba07e 100644 --- a/test/CodeGen/WebAssembly/select.ll +++ b/test/CodeGen/WebAssembly/select.ll @@ -7,9 +7,13 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: select_i32: -; CHECK: i32.eq $push, (get_local 2), (get_local 3) -; CHECK: set_local 4, $pop -; CHECK: i32.select $push, (get_local 4), (get_local 0), (get_local 1) +; CHECK: get_local push, 1 +; CHECK: set_local [[LOCAL_B:[0-9]]] +; CHECK: get_local push, 0 +; CHECK: set_local [[LOCAL_A:[0-9]]] +; CHECK: i32.eq push, (get_local 5), (get_local 6) +; CHECK: set_local 7, pop +; CHECK: i32.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]]) define i32 @select_i32(i32 %a, i32 %b, i32 %cond) { %cc = icmp eq i32 %cond, 0 %result = select i1 %cc, i32 %a, i32 %b @@ -17,9 +21,13 @@ define i32 @select_i32(i32 %a, i32 %b, i32 %cond) { } ; CHECK-LABEL: select_i64: -; CHECK: i32.eq $push, (get_local 2), (get_local 3) -; CHECK: set_local 4, $pop -; CHECK: i64.select $push, (get_local 4), (get_local 0), (get_local 1) +; CHECK: get_local push, 1 +; CHECK: set_local [[LOCAL_B:[0-9]]] +; CHECK: get_local push, 0 +; CHECK: set_local [[LOCAL_A:[0-9]]] +; CHECK: i32.eq push, (get_local 5), (get_local 6) +; CHECK: set_local 7, pop +; CHECK: i64.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]]) define i64 @select_i64(i64 %a, i64 %b, i32 %cond) { %cc = icmp eq i32 %cond, 0 %result = select i1 %cc, i64 %a, i64 %b @@ -27,9 +35,13 @@ define i64 @select_i64(i64 %a, i64 %b, i32 %cond) { } ; CHECK-LABEL: select_f32: -; CHECK: i32.eq $push, (get_local 2), (get_local 3) -; CHECK: set_local 4, $pop -; CHECK: f32.select $push, (get_local 4), (get_local 0), (get_local 1) +; CHECK: get_local push, 1 +; CHECK: set_local [[LOCAL_B:[0-9]]] +; CHECK: get_local push, 0 +; CHECK: set_local [[LOCAL_A:[0-9]]] +; CHECK: i32.eq push, (get_local 5), (get_local 6) +; CHECK: set_local 7, pop +; CHECK: f32.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]]) define float @select_f32(float %a, float %b, i32 %cond) { %cc = icmp eq i32 %cond, 0 %result = select i1 %cc, float %a, float %b @@ -37,9 +49,13 @@ define float @select_f32(float %a, float %b, i32 %cond) { } ; CHECK-LABEL: select_f64: -; CHECK: i32.eq $push, (get_local 2), (get_local 3) -; CHECK: set_local 4, $pop -; CHECK: f64.select $push, (get_local 4), (get_local 0), (get_local 1) +; CHECK: get_local push, 1 +; CHECK: set_local [[LOCAL_B:[0-9]]] +; CHECK: get_local push, 0 +; CHECK: set_local [[LOCAL_A:[0-9]]] +; CHECK: i32.eq push, (get_local 5), (get_local 6) +; CHECK: set_local 7, pop +; CHECK: f64.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]]) define double @select_f64(double %a, double %b, i32 %cond) { %cc = icmp eq i32 %cond, 0 %result = select i1 %cc, double %a, double %b diff --git a/test/CodeGen/WebAssembly/store-trunc.ll b/test/CodeGen/WebAssembly/store-trunc.ll index e36bd745c8b..81214dbbadb 100644 --- a/test/CodeGen/WebAssembly/store-trunc.ll +++ b/test/CodeGen/WebAssembly/store-trunc.ll @@ -6,7 +6,7 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: trunc_i8_i32: -; CHECK: i32.store8 (get_local 0), (get_local 1){{$}} +; CHECK: i32.store8 (get_local 3), (get_local 2){{$}} define void @trunc_i8_i32(i8 *%p, i32 %v) { %t = trunc i32 %v to i8 store i8 %t, i8* %p @@ -14,7 +14,7 @@ define void @trunc_i8_i32(i8 *%p, i32 %v) { } ; CHECK-LABEL: trunc_i16_i32: -; CHECK: i32.store16 (get_local 0), (get_local 1){{$}} +; CHECK: i32.store16 (get_local 3), (get_local 2){{$}} define void @trunc_i16_i32(i16 *%p, i32 %v) { %t = trunc i32 %v to i16 store i16 %t, i16* %p @@ -22,7 +22,7 @@ define void @trunc_i16_i32(i16 *%p, i32 %v) { } ; CHECK-LABEL: trunc_i8_i64: -; CHECK: i64.store8 (get_local 0), (get_local 1){{$}} +; CHECK: i64.store8 (get_local 3), (get_local 2){{$}} define void @trunc_i8_i64(i8 *%p, i64 %v) { %t = trunc i64 %v to i8 store i8 %t, i8* %p @@ -30,7 +30,7 @@ define void @trunc_i8_i64(i8 *%p, i64 %v) { } ; CHECK-LABEL: trunc_i16_i64: -; CHECK: i64.store16 (get_local 0), (get_local 1){{$}} +; CHECK: i64.store16 (get_local 3), (get_local 2){{$}} define void @trunc_i16_i64(i16 *%p, i64 %v) { %t = trunc i64 %v to i16 store i16 %t, i16* %p @@ -38,7 +38,7 @@ define void @trunc_i16_i64(i16 *%p, i64 %v) { } ; CHECK-LABEL: trunc_i32_i64: -; CHECK: i64.store32 (get_local 0), (get_local 1){{$}} +; CHECK: i64.store32 (get_local 3), (get_local 2){{$}} define void @trunc_i32_i64(i32 *%p, i64 %v) { %t = trunc i64 %v to i32 store i32 %t, i32* %p diff --git a/test/CodeGen/WebAssembly/store.ll b/test/CodeGen/WebAssembly/store.ll index 206c31a53a3..f89e837d4e2 100644 --- a/test/CodeGen/WebAssembly/store.ll +++ b/test/CodeGen/WebAssembly/store.ll @@ -9,7 +9,11 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .local i32, i32{{$}} -; CHECK-NEXT: i32.store (get_local 0), (get_local 1){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i32.store (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: return{{$}} define void @sti32(i32 *%p, i32 %v) { store i32 %v, i32* %p @@ -20,7 +24,11 @@ define void @sti32(i32 *%p, i32 %v) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .param i64{{$}} ; CHECK-NEXT: .local i64, i32{{$}} -; CHECK-NEXT: i64.store (get_local 0), (get_local 1){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: i64.store (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: return{{$}} define void @sti64(i64 *%p, i64 %v) { store i64 %v, i64* %p @@ -31,7 +39,11 @@ define void @sti64(i64 *%p, i64 %v) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .local f32, i32{{$}} -; CHECK-NEXT: f32.store (get_local 0), (get_local 1){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f32.store (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: return{{$}} define void @stf32(float *%p, float %v) { store float %v, float* %p @@ -42,7 +54,11 @@ define void @stf32(float *%p, float %v) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .param f64{{$}} ; CHECK-NEXT: .local f64, i32{{$}} -; CHECK-NEXT: f64.store (get_local 0), (get_local 1){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 3, pop{{$}} +; CHECK-NEXT: f64.store (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: return{{$}} define void @stf64(double *%p, double %v) { store double %v, double* %p diff --git a/test/CodeGen/WebAssembly/switch.ll b/test/CodeGen/WebAssembly/switch.ll index 8e49fd120e5..3a6a9246283 100644 --- a/test/CodeGen/WebAssembly/switch.ll +++ b/test/CodeGen/WebAssembly/switch.ll @@ -13,26 +13,26 @@ declare void @foo4() declare void @foo5() ; CHECK-LABEL: bar32: -; CHECK: block BB0_8{{$}} -; CHECK: block BB0_7{{$}} -; CHECK: block BB0_6{{$}} -; CHECK: block BB0_5{{$}} -; CHECK: block BB0_4{{$}} -; CHECK: block BB0_3{{$}} -; CHECK: block BB0_2{{$}} -; CHECK: switch {{.*}}, BB0_2, BB0_2, BB0_2, BB0_2, BB0_2, BB0_2, BB0_2, BB0_2, BB0_3, BB0_3, BB0_3, BB0_3, BB0_3, BB0_3, BB0_3, BB0_3, BB0_4, BB0_4, BB0_4, BB0_4, BB0_4, BB0_4, BB0_5, BB0_6, BB0_7{{$}} +; CHECK: block $BB0_8{{$}} +; CHECK: block $BB0_7{{$}} +; CHECK: block $BB0_6{{$}} +; CHECK: block $BB0_5{{$}} +; CHECK: block $BB0_4{{$}} +; CHECK: block $BB0_3{{$}} +; CHECK: block $BB0_2{{$}} +; CHECK: switch {{.*}}, $BB0_2, $BB0_2, $BB0_2, $BB0_2, $BB0_2, $BB0_2, $BB0_2, $BB0_2, $BB0_3, $BB0_3, $BB0_3, $BB0_3, $BB0_3, $BB0_3, $BB0_3, $BB0_3, $BB0_4, $BB0_4, $BB0_4, $BB0_4, $BB0_4, $BB0_4, $BB0_5, $BB0_6, $BB0_7{{$}} ; CHECK: BB0_2: -; CHECK: call foo0 +; CHECK: call $foo0 ; CHECK: BB0_3: -; CHECK: call foo1 +; CHECK: call $foo1 ; CHECK: BB0_4: -; CHECK: call foo2 +; CHECK: call $foo2 ; CHECK: BB0_5: -; CHECK: call foo3 +; CHECK: call $foo3 ; CHECK: BB0_6: -; CHECK: call foo4 +; CHECK: call $foo4 ; CHECK: BB0_7: -; CHECK: call foo5 +; CHECK: call $foo5 ; CHECK: BB0_8: ; CHECK: return{{$}} define void @bar32(i32 %n) { @@ -93,26 +93,26 @@ sw.epilog: ; preds = %entry, %sw.bb.5, %s } ; CHECK-LABEL: bar64: -; CHECK: block BB1_8{{$}} -; CHECK: block BB1_7{{$}} -; CHECK: block BB1_6{{$}} -; CHECK: block BB1_5{{$}} -; CHECK: block BB1_4{{$}} -; CHECK: block BB1_3{{$}} -; CHECK: block BB1_2{{$}} -; CHECK: switch {{.*}}, BB1_2, BB1_2, BB1_2, BB1_2, BB1_2, BB1_2, BB1_2, BB1_2, BB1_3, BB1_3, BB1_3, BB1_3, BB1_3, BB1_3, BB1_3, BB1_3, BB1_4, BB1_4, BB1_4, BB1_4, BB1_4, BB1_4, BB1_5, BB1_6, BB1_7{{$}} +; CHECK: block $BB1_8{{$}} +; CHECK: block $BB1_7{{$}} +; CHECK: block $BB1_6{{$}} +; CHECK: block $BB1_5{{$}} +; CHECK: block $BB1_4{{$}} +; CHECK: block $BB1_3{{$}} +; CHECK: block $BB1_2{{$}} +; CHECK: switch {{.*}}, $BB1_2, $BB1_2, $BB1_2, $BB1_2, $BB1_2, $BB1_2, $BB1_2, $BB1_2, $BB1_3, $BB1_3, $BB1_3, $BB1_3, $BB1_3, $BB1_3, $BB1_3, $BB1_3, $BB1_4, $BB1_4, $BB1_4, $BB1_4, $BB1_4, $BB1_4, $BB1_5, $BB1_6, $BB1_7{{$}} ; CHECK: BB1_2: -; CHECK: call foo0 +; CHECK: call $foo0 ; CHECK: BB1_3: -; CHECK: call foo1 +; CHECK: call $foo1 ; CHECK: BB1_4: -; CHECK: call foo2 +; CHECK: call $foo2 ; CHECK: BB1_5: -; CHECK: call foo3 +; CHECK: call $foo3 ; CHECK: BB1_6: -; CHECK: call foo4 +; CHECK: call $foo4 ; CHECK: BB1_7: -; CHECK: call foo5 +; CHECK: call $foo5 ; CHECK: BB1_8: ; CHECK: return{{$}} define void @bar64(i64 %n) { diff --git a/test/CodeGen/WebAssembly/unreachable.ll b/test/CodeGen/WebAssembly/unreachable.ll index e14c58876ed..a16e4529033 100644 --- a/test/CodeGen/WebAssembly/unreachable.ll +++ b/test/CodeGen/WebAssembly/unreachable.ll @@ -12,7 +12,7 @@ declare void @llvm.debugtrap() declare void @abort() ; CHECK-LABEL: f1: -; CHECK: call abort +; CHECK: call $abort ; CHECK: unreachable define i32 @f1() { call void @abort() diff --git a/test/CodeGen/WebAssembly/unused-argument.ll b/test/CodeGen/WebAssembly/unused-argument.ll index 7b4eef5e4b9..73e39e50388 100644 --- a/test/CodeGen/WebAssembly/unused-argument.ll +++ b/test/CodeGen/WebAssembly/unused-argument.ll @@ -10,7 +10,9 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32{{$}} -; CHECK-NEXT: return (get_local 1){{$}} +; CHECK-NEXT: get_local push, 1{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @unused_first(i32 %x, i32 %y) { ret i32 %y } @@ -20,7 +22,9 @@ define i32 @unused_first(i32 %x, i32 %y) { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: .local i32{{$}} -; CHECK-NEXT: return (get_local 0){{$}} +; CHECK-NEXT: get_local push, 0{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: return (get_local 2){{$}} define i32 @unused_second(i32 %x, i32 %y) { ret i32 %x }