// TODO: What should MaxInstLength be?
- // The s-expression format of WebAssembly uses LISP-style comments.
- CommentString = ";;";
-
PrivateGlobalPrefix = "";
PrivateLabelPrefix = "";
COMMDirectiveAlignmentIsInBytes = false;
LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
- HasDotTypeDotSizeDirective = false;
- HasSingleParameterDotFile = false;
-
SupportsDebugInformation = true;
// For now, WebAssembly does not support exceptions.
ExceptionsType = ExceptionHandling::None;
- // FIXME: modify AsmPrinter to be more flexible, and fix other virtual ISAs.
- WeakDirective = "\t;; .weak\t";
- GlobalDirective = "\t;; .globl\t";
-
// TODO: UseIntegratedAssembler?
}
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
class WebAssemblyAsmPrinter final : public AsmPrinter {
const WebAssemblyInstrInfo *TII;
+ unsigned NumArgs;
public:
WebAssemblyAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
bool runOnMachineFunction(MachineFunction &MF) override {
const auto &Subtarget = MF.getSubtarget<WebAssemblySubtarget>();
TII = Subtarget.getInstrInfo();
+ NumArgs = MF.getInfo<WebAssemblyFunctionInfo>()->getNumArguments();
return AsmPrinter::runOnMachineFunction(MF);
}
// AsmPrinter Implementation.
//===------------------------------------------------------------------===//
- void EmitGlobalVariable(const GlobalVariable *GV) override;
-
void EmitJumpTableInfo() override;
void EmitConstantPool() override;
- void EmitFunctionEntryLabel() override;
void EmitFunctionBodyStart() override;
- void EmitFunctionBodyEnd() override;
void EmitInstruction(const MachineInstr *MI) override;
static std::string toString(const APFloat &APF);
const char *toString(Type *Ty) const;
+ std::string regToString(unsigned RegNo);
+ std::string argToString(unsigned ArgNo);
};
} // end anonymous namespace
return buf;
}
+std::string WebAssemblyAsmPrinter::regToString(unsigned RegNo) {
+ if (TargetRegisterInfo::isPhysicalRegister(RegNo))
+ return WebAssemblyInstPrinter::getRegisterName(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(unsigned ArgNo) {
+ // Same as above, but we don't need to add NumArgs here.
+ return '@' + utostr(ArgNo);
+}
+
const char *WebAssemblyAsmPrinter::toString(Type *Ty) const {
switch (Ty->getTypeID()) {
default:
// WebAssemblyAsmPrinter Implementation.
//===----------------------------------------------------------------------===//
-void WebAssemblyAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
- SmallString<128> Str;
- raw_svector_ostream OS(Str);
- StringRef Name = GV->getName();
- DEBUG(dbgs() << "Global " << Name << '\n');
-
- if (!GV->hasInitializer()) {
- DEBUG(dbgs() << " Skipping declaration.\n");
- return;
- }
-
- // Check to see if this is a special global used by LLVM.
- static const char *Ignored[] = {"llvm.used", "llvm.metadata"};
- for (const char *I : Ignored)
- if (Name == I)
- return;
- // FIXME: Handle the following globals.
- static const char *Unhandled[] = {"llvm.global_ctors", "llvm.global_dtors"};
- for (const char *U : Unhandled)
- if (Name == U)
- report_fatal_error("Unhandled global");
- if (Name.startswith("llvm."))
- report_fatal_error("Unknown LLVM-internal global");
-
- if (GV->isThreadLocal())
- report_fatal_error("TLS isn't yet supported by WebAssembly");
-
- const DataLayout &DL = getDataLayout();
- const Constant *Init = GV->getInitializer();
- if (isa<UndefValue>(Init))
- Init = Constant::getNullValue(Init->getType());
- unsigned Align = DL.getPrefTypeAlignment(Init->getType());
-
- switch (GV->getLinkage()) {
- case GlobalValue::InternalLinkage:
- case GlobalValue::PrivateLinkage:
- break;
- case GlobalValue::AppendingLinkage:
- case GlobalValue::LinkOnceAnyLinkage:
- case GlobalValue::LinkOnceODRLinkage:
- case GlobalValue::WeakAnyLinkage:
- case GlobalValue::WeakODRLinkage:
- case GlobalValue::ExternalLinkage:
- case GlobalValue::CommonLinkage:
- report_fatal_error("Linkage types other than internal and private aren't "
- "supported by WebAssembly yet");
- default:
- llvm_unreachable("Unknown linkage type");
- return;
- }
-
- OS << "(global " << toSymbol(Name) << ' ' << toString(Init->getType()) << ' ';
- if (const auto *C = dyn_cast<ConstantInt>(Init)) {
- assert(C->getBitWidth() <= 64 && "Printing wider types unimplemented");
- OS << C->getZExtValue();
- } else if (const auto *C = dyn_cast<ConstantFP>(Init)) {
- OS << toString(C->getValueAPF());
- } else {
- assert(false && "Only integer and floating-point constants are supported");
- }
- OS << ") ;; align " << Align;
- OutStreamer->EmitRawText(OS.str());
-}
-
void WebAssemblyAsmPrinter::EmitConstantPool() {
assert(MF->getConstantPool()->getConstants().empty() &&
"WebAssembly disables constant pools");
// Nothing to do; jump tables are incorporated into the instruction stream.
}
-void WebAssemblyAsmPrinter::EmitFunctionEntryLabel() {
- SmallString<128> Str;
- raw_svector_ostream OS(Str);
-
- CurrentFnSym->redefineIfPossible();
-
- // The function label could have already been emitted if two symbols end up
- // conflicting due to asm renaming. Detect this and emit an error.
- if (CurrentFnSym->isVariable())
- report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
- "' is a protected alias");
- if (CurrentFnSym->isDefined())
- report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
- "' label emitted multiple times to assembly file");
-
- OS << "(func " << toSymbol(CurrentFnSym->getName());
- OutStreamer->EmitRawText(OS.str());
-}
-
void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
- SmallString<128> Str;
- raw_svector_ostream OS(Str);
const Function *F = MF->getFunction();
Type *Rt = F->getReturnType();
+
if (!Rt->isVoidTy() || !F->arg_empty()) {
- for (const Argument &A : F->args())
- OS << " (param " << toString(A.getType()) << ')';
- if (!Rt->isVoidTy())
- OS << " (result " << toString(Rt) << ')';
+ SmallString<128> Str;
+ raw_svector_ostream OS(Str);
+ bool First = true;
+ for (const Argument &A : F->args()) {
+ OS << (First ? "" : "\n") << "\t"
+ ".param "
+ << toString(A.getType());
+ First = false;
+ }
+ if (!Rt->isVoidTy()) {
+ OS << (First ? "" : "\n") << "\t"
+ ".result "
+ << toString(Rt);
+ First = false;
+ }
OutStreamer->EmitRawText(OS.str());
}
-}
-void WebAssemblyAsmPrinter::EmitFunctionBodyEnd() {
- SmallString<128> Str;
- raw_svector_ostream OS(Str);
- OS << ") ;; end func " << toSymbol(CurrentFnSym->getName());
- OutStreamer->EmitRawText(OS.str());
+ AsmPrinter::EmitFunctionBodyStart();
}
void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
OS << '\t';
- if (NumDefs != 0) {
- const MachineOperand &MO = MI->getOperand(0);
- unsigned Reg = MO.getReg();
- OS << "(set_local @" << TargetRegisterInfo::virtReg2Index(Reg) << ' ';
- }
-
- if (MI->getOpcode() == WebAssembly::COPY) {
- OS << '@' << TargetRegisterInfo::virtReg2Index(MI->getOperand(1).getReg());
- } else {
- OS << '(' << OpcodeName(TII, MI);
- for (const MachineOperand &MO : MI->uses())
+ switch (MI->getOpcode()) {
+ case TargetOpcode::COPY:
+ OS << regToString(MI->getOperand(1).getReg());
+ break;
+ case WebAssembly::GLOBAL:
+ // TODO: wasm64
+ OS << "i32.const " << toSymbol(MI->getOperand(1).getGlobal()->getName());
+ break;
+ case WebAssembly::ARGUMENT_I32:
+ case WebAssembly::ARGUMENT_I64:
+ case WebAssembly::ARGUMENT_F32:
+ case WebAssembly::ARGUMENT_F64:
+ OS << argToString(MI->getOperand(1).getImm());
+ break;
+ case WebAssembly::Immediate_I32:
+ OS << "i32.const " << MI->getOperand(1).getImm();
+ break;
+ case WebAssembly::Immediate_I64:
+ OS << "i64.const " << MI->getOperand(1).getImm();
+ break;
+ case WebAssembly::Immediate_F32:
+ OS << "f32.const " << toString(MI->getOperand(1).getFPImm()->getValueAPF());
+ break;
+ case WebAssembly::Immediate_F64:
+ OS << "f64.const " << toString(MI->getOperand(1).getFPImm()->getValueAPF());
+ break;
+ default: {
+ OS << OpcodeName(TII, MI);
+ bool NeedComma = false;
+ 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: {
- if (MO.isImplicit())
- continue;
- unsigned Reg = MO.getReg();
- OS << " @" << TargetRegisterInfo::virtReg2Index(Reg);
- } 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;
+ case MachineOperand::MO_Register:
+ OS << regToString(MO.getReg());
+ 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;
}
- OS << ')';
+ }
+ break;
+ }
}
-
- if (NumDefs != 0)
- OS << ')';
OutStreamer->EmitRawText(OS.str());
+
+ if (NumDefs != 0) {
+ SmallString<128> Str;
+ raw_svector_ostream OS(Str);
+ OS << "\t" "set_local "
+ << regToString(MI->getOperand(0).getReg()) << ", "
+ "pop";
+ OutStreamer->EmitRawText(OS.str());
+ }
}
// Force static initialization.
++ArgNo;
}
+ // Record the number of arguments, since argument indices and local variable
+ // indices are in the same index space.
+ MF.getInfo<WebAssemblyFunctionInfo>()->setNumArguments(ArgNo);
+
return Chain;
}
MCSection *WebAssemblyTargetObjectFile::SelectSectionForGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
- return getDataSection();
+ // TODO: Be more sophisticated than this.
+ return isa<Function>(GV) ? getTextSection() : getDataSection();
}
class WebAssemblyFunctionInfo final : public MachineFunctionInfo {
MachineFunction &MF;
+ unsigned NumArguments;
+
public:
- explicit WebAssemblyFunctionInfo(MachineFunction &MF) : MF(MF) {}
+ explicit WebAssemblyFunctionInfo(MachineFunction &MF)
+ : MF(MF), NumArguments(0) {}
~WebAssemblyFunctionInfo() override;
+
+ void setNumArguments(unsigned N) { NumArguments = N; }
+ unsigned getNumArguments() const { return NumArguments; }
};
} // end namespace llvm
declare double @double_nullary()
declare void @void_nullary()
-; CHECK-LABEL: (func $call_i32_nullary
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (call $i32_nullary))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: call_i32_nullary:
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: call $i32_nullary
+; CHECK-NEXT: set_local @0, pop
+; CHECK-NEXT: return @0
define i32 @call_i32_nullary() {
%r = call i32 @i32_nullary()
ret i32 %r
}
-; CHECK-LABEL: (func $call_i64_nullary
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (call $i64_nullary))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: call_i64_nullary:
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: call $i64_nullary
+; CHECK-NEXT: set_local @0, pop
+; CHECK-NEXT: return @0
define i64 @call_i64_nullary() {
%r = call i64 @i64_nullary()
ret i64 %r
}
-; CHECK-LABEL: (func $call_float_nullary
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (call $float_nullary))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: call_float_nullary:
+; CHECK-NEXT: .result f32
+; CHECK-NEXT: call $float_nullary
+; CHECK-NEXT: set_local @0, pop
+; CHECK-NEXT: return @0
define float @call_float_nullary() {
%r = call float @float_nullary()
ret float %r
}
-; CHECK-LABEL: (func $call_double_nullary
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (call $double_nullary))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: call_double_nullary:
+; CHECK-NEXT: .result f64
+; CHECK-NEXT: call $double_nullary
+; CHECK-NEXT: set_local @0, pop
+; CHECK-NEXT: return @0
define double @call_double_nullary() {
%r = call double @double_nullary()
ret double %r
}
-; CHECK-LABEL: (func $call_void_nullary
-; CHECK-NEXT: (call $void_nullary)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: call_void_nullary:
+; CHECK-NEXT: call $void_nullary
+; CHECK-NEXT: return
define void @call_void_nullary() {
call void @void_nullary()
ret void
}
-; CHECK-LABEL: (func $call_i32_unary
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (call $i32_unary @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: call_i32_unary:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @0
+; CHECK-NEXT: set_local @1, pop
+; CHECK-NEXT: call $i32_unary, @1
+; CHECK-NEXT: set_local @2, pop
+; CHECK-NEXT: return @2
define i32 @call_i32_unary(i32 %a) {
%r = call i32 @i32_unary(i32 %a)
ret i32 %r
}
-; CHECK-LABEL: (func $call_i32_binary
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (call $i32_binary @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: call_i32_binary:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @1
+; CHECK-NEXT: set_local @2, pop
+; CHECK-NEXT: @0
+; CHECK-NEXT: set_local @3, pop
+; CHECK-NEXT: call $i32_binary, @3, @2
+; CHECK-NEXT: set_local @4, pop
+; CHECK-NEXT: return @4
define i32 @call_i32_binary(i32 %a, i32 %b) {
%r = call i32 @i32_binary(i32 %a, i32 %b)
ret i32 %r
}
-; CHECK-LABEL: (func $call_indirect_void
-; CHECK-NEXT: (param i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (call_indirect @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: call_indirect_void:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: @0
+; CHECK-NEXT: set_local @1, pop
+; CHECK-NEXT: call_indirect @1
+; CHECK-NEXT: return
define void @call_indirect_void(void ()* %callee) {
call void %callee()
ret void
}
-; CHECK-LABEL: (func $call_indirect_i32
-; CHECK-NEXT: (param i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (call_indirect @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: call_indirect_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @0
+; CHECK-NEXT: set_local @1, pop
+; CHECK-NEXT: call_indirect @1
+; CHECK-NEXT: set_local @2, pop
+; CHECK-NEXT: return @2
define i32 @call_indirect_i32(i32 ()* %callee) {
%t = call i32 %callee()
ret i32 %t
}
-; CHECK-LABEL: (func $tail_call_void_nullary
-; CHECK-NEXT: (call $void_nullary)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: tail_call_void_nullary:
+; CHECK-NEXT: call $void_nullary
+; CHECK-NEXT: return{{$}}
define void @tail_call_void_nullary() {
tail call void @void_nullary()
ret void
}
-; CHECK-LABEL: (func $fastcc_tail_call_void_nullary
-; CHECK-NEXT: (call $void_nullary)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: fastcc_tail_call_void_nullary:
+; CHECK-NEXT: call $void_nullary
+; CHECK-NEXT: return{{$}}
define void @fastcc_tail_call_void_nullary() {
tail call fastcc void @void_nullary()
ret void
}
-; CHECK-LABEL: (func $coldcc_tail_call_void_nullary
-; CHECK-NEXT: (call $void_nullary)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: coldcc_tail_call_void_nullary:
+; CHECK-NEXT: call $void_nullary
+; CHECK-NEXT: return{{$}}
define void @coldcc_tail_call_void_nullary() {
tail call coldcc void @void_nullary()
ret void
; Test that loops are made contiguous, even in the presence of split backedges.
-; CHECK-LABEL: test0
-; CHECK: (loop
-; CHECK: (add
-; CHECK: (brif
-; CHECK: (call
-; CHECK: (br $BB0_1)
-; CHECK: (return)
+; CHECK-LABEL: test0:
+; CHECK: loop
+; CHECK: add
+; CHECK: brif
+; CHECK: call
+; CHECK: br $BB0_1{{$}}
+; CHECK: return{{$}}
define void @test0(i32 %n) {
entry:
br label %header
; Same as test0, but the branch condition is reversed.
-; CHECK-LABEL: test1
-; CHECK: (loop
-; CHECK: (add
-; CHECK: (brif
-; CHECK: (call
-; CHECK: (br $BB1_1)
-; CHECK: (return)
+; CHECK-LABEL: test1:
+; CHECK: loop
+; CHECK: add
+; CHECK: brif
+; CHECK: call
+; CHECK: br $BB1_1{{$}}
+; CHECK: return{{$}}
define void @test1(i32 %n) {
entry:
br label %header
; Test that a simple loop is handled as expected.
-; CHECK-LABEL: test2
-; CHECK: (block $BB2_2)
-; CHECK: (brif $BB2_2 {{.*}})
+; CHECK-LABEL: test2:
+; CHECK: block $BB2_2{{$}}
+; CHECK: brif $BB2_2, {{.*}}
; CHECK: BB2_1:
-; CHECK: (brif $BB2_1 @14)
+; CHECK: brif $BB2_1, @16{{$}}
; CHECK: BB2_2:
-; CHECK: (return)
+; CHECK: return{{$}}
define void @test2(double* nocapture %p, i32 %n) {
entry:
%cmp.4 = icmp sgt i32 %n, 0
ret void
}
-; CHECK-LABEL: doublediamond
-; CHECK: (block $BB3_5)
-; CHECK: (block $BB3_4)
-; CHECK: (block $BB3_2)
-; CHECK: (brif $BB3_2 @4)
-; CHECK: (br $BB3_5)
+; CHECK-LABEL: doublediamond:
+; CHECK: block $BB3_5{{$}}
+; CHECK: block $BB3_4{{$}}
+; CHECK: block $BB3_2{{$}}
+; CHECK: brif $BB3_2, @7{{$}}
+; CHECK: br $BB3_5{{$}}
; CHECK: BB3_2:
-; CHECK: (brif $BB3_4 @7)
-; CHECK: (br $BB3_5)
+; CHECK: brif $BB3_4, @10{{$}}
+; CHECK: br $BB3_5{{$}}
; CHECK: BB3_4:
; CHECK: BB3_5:
-; CHECK: (return @3)
+; CHECK: return @6{{$}}
define i32 @doublediamond(i32 %a, i32 %b, i32* %p) {
entry:
%c = icmp eq i32 %a, 0
ret i32 0
}
-; CHECK-LABEL: triangle
-; CHECK: (block $BB4_2)
-; CHECK: (brif $BB4_2 @3)
+; CHECK-LABEL: triangle:
+; CHECK: block $BB4_2{{$}}
+; CHECK: brif $BB4_2, @5{{$}}
; CHECK: BB4_2:
-; CHECK: (return @2)
+; CHECK: return @4{{$}}
define i32 @triangle(i32* %p, i32 %a) {
entry:
%c = icmp eq i32 %a, 0
ret i32 0
}
-; CHECK-LABEL: diamond
-; CHECK: (block $BB5_3)
-; CHECK: (block $BB5_2)
-; CHECK: (brif $BB5_2 @3)
-; CHECK: (br $BB5_3)
+; CHECK-LABEL: diamond:
+; CHECK: block $BB5_3{{$}}
+; CHECK: block $BB5_2{{$}}
+; CHECK: brif $BB5_2, @5{{$}}
+; CHECK: br $BB5_3{{$}}
; CHECK: BB5_2:
; CHECK: BB5_3:
-; CHECK: (return @2)
+; CHECK: return @4{{$}}
define i32 @diamond(i32* %p, i32 %a) {
entry:
%c = icmp eq i32 %a, 0
ret i32 0
}
-; CHECK-LABEL: single_block
+; CHECK-LABEL: single_block:
; CHECK-NOT: br
-; CHECK: (return @1)
+; CHECK: return @2{{$}}
define i32 @single_block(i32* %p) {
entry:
store volatile i32 0, i32* %p
ret i32 0
}
-; CHECK-LABEL: minimal_loop
+; CHECK-LABEL: minimal_loop:
; CHECK-NOT: br
; CHECK: BB7_1:
-; CHECK: (store_i32 @0 @2)
-; CHECK: (br $BB7_1)
+; CHECK: store_i32 @1, @3{{$}}
+; CHECK: br $BB7_1{{$}}
define i32 @minimal_loop(i32* %p) {
entry:
store volatile i32 0, i32* %p
br label %loop
}
-; CHECK-LABEL: simple_loop
+; CHECK-LABEL: simple_loop:
; CHECK-NOT: br
; CHECK: BB8_1:
-; CHECK: (loop $BB8_2)
-; CHECK: (brif $BB8_1 @4)
-; CHECK: (return @2)
+; CHECK: loop $BB8_2{{$}}
+; CHECK: brif $BB8_1, @6{{$}}
+; CHECK: return @4{{$}}
define i32 @simple_loop(i32* %p, i32 %a) {
entry:
%c = icmp eq i32 %a, 0
ret i32 0
}
-; CHECK-LABEL: doubletriangle
-; CHECK: (block $BB9_4)
-; CHECK: (block $BB9_3)
-; CHECK: (brif $BB9_4 @4)
-; CHECK: (brif $BB9_3 @7)
+; CHECK-LABEL: doubletriangle:
+; CHECK: block $BB9_4{{$}}
+; CHECK: block $BB9_3{{$}}
+; CHECK: brif $BB9_4, @7{{$}}
+; CHECK: brif $BB9_3, @10{{$}}
; CHECK: BB9_3:
; CHECK: BB9_4:
-; CHECK: (return @3)
+; CHECK: return @6{{$}}
define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) {
entry:
%c = icmp eq i32 %a, 0
ret i32 0
}
-; CHECK-LABEL: ifelse_earlyexits
-; CHECK: (block $BB10_4)
-; CHECK: (block $BB10_2)
-; CHECK: (brif $BB10_2 @4)
-; CHECK: (br $BB10_4)
+; CHECK-LABEL: ifelse_earlyexits:
+; CHECK: block $BB10_4{{$}}
+; CHECK: block $BB10_2{{$}}
+; CHECK: brif $BB10_2, @7{{$}}
+; CHECK: br $BB10_4{{$}}
; CHECK: BB10_2:
-; CHECK: (brif $BB10_4 @7)
+; CHECK: brif $BB10_4, @10{{$}}
; CHECK: BB10_4:
-; CHECK: (return @3)
+; CHECK: return @6{{$}}
define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) {
entry:
%c = icmp eq i32 %a, 0
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $ord_f32
-; CHECK-NEXT: (param f32) (param f32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (argument 1))
-; CHECK-NEXT: (set_local @2 (eq @1 @1))
-; CHECK-NEXT: (set_local @3 (eq @0 @0))
-; CHECK-NEXT: (set_local @4 (and @3 @2))
-; CHECK-NEXT: (return @4)
+; CHECK-LABEL: ord_f32:
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @3{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: eq @2, @2{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: and @5, @4{{$}}
+; CHECK-NEXT: set_local @6, pop{{$}}
+; CHECK-NEXT: return @6{{$}}
define i32 @ord_f32(float %x, float %y) {
%a = fcmp ord float %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $uno_f32
-; CHECK-NEXT: (param f32) (param f32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (argument 1))
-; CHECK-NEXT: (set_local @2 (ne @1 @1))
-; CHECK-NEXT: (set_local @3 (ne @0 @0))
-; CHECK-NEXT: (set_local @4 (ior @3 @2))
-; CHECK-NEXT: (return @4)
+; CHECK-LABEL: uno_f32:
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: ne @3, @3{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: ne @2, @2{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: ior @5, @4{{$}}
+; CHECK-NEXT: set_local @6, pop{{$}}
+; CHECK-NEXT: return @6{{$}}
define i32 @uno_f32(float %x, float %y) {
%a = fcmp uno float %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $oeq_f32
-; CHECK-NEXT: (param f32) (param f32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (eq @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: oeq_f32:
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @oeq_f32(float %x, float %y) {
%a = fcmp oeq float %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $une_f32
-; CHECK: (set_local @2 (ne @1 @0))
+; CHECK-LABEL: une_f32:
+; CHECK: ne @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $olt_f32
-; CHECK: (set_local @2 (lt @1 @0))
+; CHECK-LABEL: olt_f32:
+; CHECK: lt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ole_f32
-; CHECK: (set_local @2 (le @1 @0))
+; CHECK-LABEL: ole_f32:
+; CHECK: le @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ogt_f32
-; CHECK: (set_local @2 (gt @1 @0))
+; CHECK-LABEL: ogt_f32:
+; CHECK: gt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $oge_f32
-; CHECK: (set_local @2 (ge @1 @0))
+; CHECK-LABEL: oge_f32:
+; CHECK: ge @3, @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
; Expanded comparisons, which also check for NaN.
-; CHECK-LABEL: (func $ueq_f32
-; CHECK-NEXT: (param f32) (param f32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (eq @1 @0))
-; CHECK-NEXT: (set_local @3 (ne @0 @0))
-; CHECK-NEXT: (set_local @4 (ne @1 @1))
-; CHECK-NEXT: (set_local @5 (ior @4 @3))
-; CHECK-NEXT: (set_local @6 (ior @2 @5))
-; CHECK-NEXT: (return @6)
+; CHECK-LABEL: ueq_f32:
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: ne @2, @2{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: ne @3, @3{{$}}
+; CHECK-NEXT: set_local @6, pop{{$}}
+; CHECK-NEXT: ior @6, @5{{$}}
+; CHECK-NEXT: set_local @7, pop{{$}}
+; CHECK-NEXT: ior @4, @7{{$}}
+; CHECK-NEXT: set_local @8, pop{{$}}
+; CHECK-NEXT: return @8{{$}}
define i32 @ueq_f32(float %x, float %y) {
%a = fcmp ueq float %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $one_f32
-; CHECK: (set_local @2 (ne @1 @0))
+; CHECK-LABEL: one_f32:
+; CHECK: ne @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ult_f32
-; CHECK: (set_local @2 (lt @1 @0))
+; CHECK-LABEL: ult_f32:
+; CHECK: lt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ule_f32
-; CHECK: (set_local @2 (le @1 @0))
+; CHECK-LABEL: ule_f32:
+; CHECK: le @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ugt_f32
-; CHECK: (set_local @2 (gt @1 @0))
+; CHECK-LABEL: ugt_f32:
+; CHECK: gt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $uge_f32
-; CHECK: (set_local @2 (ge @1 @0))
+; CHECK-LABEL: uge_f32:
+; CHECK: ge @3, @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
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $ord_f64
-; CHECK-NEXT: (param f64) (param f64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (argument 1))
-; CHECK-NEXT: (set_local @2 (eq @1 @1))
-; CHECK-NEXT: (set_local @3 (eq @0 @0))
-; CHECK-NEXT: (set_local @4 (and @3 @2))
-; CHECK-NEXT: (return @4)
+; CHECK-LABEL: ord_f64:
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @3{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: eq @2, @2{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: and @5, @4{{$}}
+; CHECK-NEXT: set_local @6, pop{{$}}
+; CHECK-NEXT: return @6{{$}}
define i32 @ord_f64(double %x, double %y) {
%a = fcmp ord double %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $uno_f64
-; CHECK-NEXT: (param f64) (param f64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (argument 1))
-; CHECK-NEXT: (set_local @2 (ne @1 @1))
-; CHECK-NEXT: (set_local @3 (ne @0 @0))
-; CHECK-NEXT: (set_local @4 (ior @3 @2))
-; CHECK-NEXT: (return @4)
+; CHECK-LABEL: uno_f64:
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: ne @3, @3{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: ne @2, @2{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: ior @5, @4{{$}}
+; CHECK-NEXT: set_local @6, pop{{$}}
+; CHECK-NEXT: return @6{{$}}
define i32 @uno_f64(double %x, double %y) {
%a = fcmp uno double %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $oeq_f64
-; CHECK-NEXT: (param f64) (param f64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (eq @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: oeq_f64:
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @oeq_f64(double %x, double %y) {
%a = fcmp oeq double %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $une_f64
-; CHECK: (set_local @2 (ne @1 @0))
+; CHECK-LABEL: une_f64:
+; CHECK: ne @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $olt_f64
-; CHECK: (set_local @2 (lt @1 @0))
+; CHECK-LABEL: olt_f64:
+; CHECK: lt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ole_f64
-; CHECK: (set_local @2 (le @1 @0))
+; CHECK-LABEL: ole_f64:
+; CHECK: le @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ogt_f64
-; CHECK: (set_local @2 (gt @1 @0))
+; CHECK-LABEL: ogt_f64:
+; CHECK: gt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $oge_f64
-; CHECK: (set_local @2 (ge @1 @0))
+; CHECK-LABEL: oge_f64:
+; CHECK: ge @3, @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
; Expanded comparisons, which also check for NaN.
-; CHECK-LABEL: (func $ueq_f64
-; CHECK-NEXT: (param f64) (param f64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (eq @1 @0))
-; CHECK-NEXT: (set_local @3 (ne @0 @0))
-; CHECK-NEXT: (set_local @4 (ne @1 @1))
-; CHECK-NEXT: (set_local @5 (ior @4 @3))
-; CHECK-NEXT: (set_local @6 (ior @2 @5))
-; CHECK-NEXT: (return @6)
+; CHECK-LABEL: ueq_f64:
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: ne @2, @2{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: ne @3, @3{{$}}
+; CHECK-NEXT: set_local @6, pop{{$}}
+; CHECK-NEXT: ior @6, @5{{$}}
+; CHECK-NEXT: set_local @7, pop{{$}}
+; CHECK-NEXT: ior @4, @7{{$}}
+; CHECK-NEXT: set_local @8, pop{{$}}
+; CHECK-NEXT: return @8{{$}}
define i32 @ueq_f64(double %x, double %y) {
%a = fcmp ueq double %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $one_f64
-; CHECK: (set_local @2 (ne @1 @0))
+; CHECK-LABEL: one_f64:
+; CHECK: ne @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ult_f64
-; CHECK: (set_local @2 (lt @1 @0))
+; CHECK-LABEL: ult_f64:
+; CHECK: lt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ule_f64
-; CHECK: (set_local @2 (le @1 @0))
+; CHECK-LABEL: ule_f64:
+; CHECK: le @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ugt_f64
-; CHECK: (set_local @2 (gt @1 @0))
+; CHECK-LABEL: ugt_f64:
+; CHECK: gt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $uge_f64
-; CHECK: (set_local @2 (ge @1 @0))
+; CHECK-LABEL: uge_f64:
+; CHECK: ge @3, @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
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $eq_i32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (eq @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: eq_i32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @eq_i32(i32 %x, i32 %y) {
%a = icmp eq i32 %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $ne_i32
-; CHECK: (set_local @2 (ne @1 @0))
+; CHECK-LABEL: ne_i32:
+; CHECK: ne @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $slt_i32
-; CHECK: (set_local @2 (slt @1 @0))
+; CHECK-LABEL: slt_i32:
+; CHECK: slt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $sle_i32
-; CHECK: (set_local @2 (sle @1 @0))
+; CHECK-LABEL: sle_i32:
+; CHECK: sle @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ult_i32
-; CHECK: (set_local @2 (ult @1 @0))
+; CHECK-LABEL: ult_i32:
+; CHECK: ult @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ule_i32
-; CHECK: (set_local @2 (ule @1 @0))
+; CHECK-LABEL: ule_i32:
+; CHECK: ule @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $sgt_i32
-; CHECK: (set_local @2 (sgt @1 @0))
+; CHECK-LABEL: sgt_i32:
+; CHECK: sgt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $sge_i32
-; CHECK: (set_local @2 (sge @1 @0))
+; CHECK-LABEL: sge_i32:
+; CHECK: sge @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ugt_i32
-; CHECK: (set_local @2 (ugt @1 @0))
+; CHECK-LABEL: ugt_i32:
+; CHECK: ugt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $uge_i32
-; CHECK: (set_local @2 (uge @1 @0))
+; CHECK-LABEL: uge_i32:
+; CHECK: uge @3, @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
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $eq_i64
-; CHECK-NEXT: (param i64) (param i64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (eq @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: eq_i64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: eq @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @eq_i64(i64 %x, i64 %y) {
%a = icmp eq i64 %x, %y
%b = zext i1 %a to i32
ret i32 %b
}
-; CHECK-LABEL: (func $ne_i64
-; CHECK: (set_local @2 (ne @1 @0))
+; CHECK-LABEL: ne_i64:
+; CHECK: ne @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $slt_i64
-; CHECK: (set_local @2 (slt @1 @0))
+; CHECK-LABEL: slt_i64:
+; CHECK: slt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $sle_i64
-; CHECK: (set_local @2 (sle @1 @0))
+; CHECK-LABEL: sle_i64:
+; CHECK: sle @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ult_i64
-; CHECK: (set_local @2 (ult @1 @0))
+; CHECK-LABEL: ult_i64:
+; CHECK: ult @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ule_i64
-; CHECK: (set_local @2 (ule @1 @0))
+; CHECK-LABEL: ule_i64:
+; CHECK: ule @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $sgt_i64
-; CHECK: (set_local @2 (sgt @1 @0))
+; CHECK-LABEL: sgt_i64:
+; CHECK: sgt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $sge_i64
-; CHECK: (set_local @2 (sge @1 @0))
+; CHECK-LABEL: sge_i64:
+; CHECK: sge @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $ugt_i64
-; CHECK: (set_local @2 (ugt @1 @0))
+; CHECK-LABEL: ugt_i64:
+; CHECK: ugt @3, @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
ret i32 %b
}
-; CHECK-LABEL: (func $uge_i64
-; CHECK: (set_local @2 (uge @1 @0))
+; CHECK-LABEL: uge_i64:
+; CHECK: uge @3, @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
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: $i32_wrap_i64
-; CHECK-NEXT: (param i64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i32_wrap @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i32_wrap_i64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i32_wrap @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @i32_wrap_i64(i64 %x) {
%a = trunc i64 %x to i32
ret i32 %a
}
-; CHECK-LABEL: $i64_extend_s_i32
-; CHECK-NEXT: (param i32) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i64_extend_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i64_extend_s_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i64_extend_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @i64_extend_s_i32(i32 %x) {
%a = sext i32 %x to i64
ret i64 %a
}
-; CHECK-LABEL: $i64_extend_u_i32
-; CHECK-NEXT: (param i32) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i64_extend_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i64_extend_u_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i64_extend_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @i64_extend_u_i32(i32 %x) {
%a = zext i32 %x to i64
ret i64 %a
}
-; CHECK-LABEL: $i32_trunc_s_f32
-; CHECK-NEXT: (param f32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i32_trunc_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i32_trunc_s_f32:
+; CHECK-NEXT: .param f32
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i32_trunc_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @i32_trunc_s_f32(float %x) {
%a = fptosi float %x to i32
ret i32 %a
}
-; CHECK-LABEL: $i32_trunc_u_f32
-; CHECK-NEXT: (param f32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i32_trunc_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i32_trunc_u_f32:
+; CHECK-NEXT: .param f32
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i32_trunc_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @i32_trunc_u_f32(float %x) {
%a = fptoui float %x to i32
ret i32 %a
}
-; CHECK-LABEL: $i32_trunc_s_f64
-; CHECK-NEXT: (param f64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i32_trunc_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i32_trunc_s_f64:
+; CHECK-NEXT: .param f64
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i32_trunc_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @i32_trunc_s_f64(double %x) {
%a = fptosi double %x to i32
ret i32 %a
}
-; CHECK-LABEL: $i32_trunc_u_f64
-; CHECK-NEXT: (param f64) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i32_trunc_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i32_trunc_u_f64:
+; CHECK-NEXT: .param f64
+; CHECK-NEXT: .result i32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i32_trunc_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @i32_trunc_u_f64(double %x) {
%a = fptoui double %x to i32
ret i32 %a
}
-; CHECK-LABEL: $i64_trunc_s_f32
-; CHECK-NEXT: (param f32) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i64_trunc_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i64_trunc_s_f32:
+; CHECK-NEXT: .param f32
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i64_trunc_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @i64_trunc_s_f32(float %x) {
%a = fptosi float %x to i64
ret i64 %a
}
-; CHECK-LABEL: $i64_trunc_u_f32
-; CHECK-NEXT: (param f32) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i64_trunc_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i64_trunc_u_f32:
+; CHECK-NEXT: .param f32
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i64_trunc_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @i64_trunc_u_f32(float %x) {
%a = fptoui float %x to i64
ret i64 %a
}
-; CHECK-LABEL: $i64_trunc_s_f64
-; CHECK-NEXT: (param f64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i64_trunc_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i64_trunc_s_f64:
+; CHECK-NEXT: .param f64
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i64_trunc_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @i64_trunc_s_f64(double %x) {
%a = fptosi double %x to i64
ret i64 %a
}
-; CHECK-LABEL: $i64_trunc_u_f64
-; CHECK-NEXT: (param f64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (i64_trunc_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: i64_trunc_u_f64:
+; CHECK-NEXT: .param f64
+; CHECK-NEXT: .result i64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: i64_trunc_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @i64_trunc_u_f64(double %x) {
%a = fptoui double %x to i64
ret i64 %a
}
-; CHECK-LABEL: $f32_convert_s_i32
-; CHECK-NEXT: (param i32) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f32_convert_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f32_convert_s_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result f32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f32_convert_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define float @f32_convert_s_i32(i32 %x) {
%a = sitofp i32 %x to float
ret float %a
}
-; CHECK-LABEL: $f32_convert_u_i32
-; CHECK-NEXT: (param i32) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f32_convert_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f32_convert_u_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result f32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f32_convert_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define float @f32_convert_u_i32(i32 %x) {
%a = uitofp i32 %x to float
ret float %a
}
-; CHECK-LABEL: $f64_convert_s_i32
-; CHECK-NEXT: (param i32) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f64_convert_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f64_convert_s_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result f64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f64_convert_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define double @f64_convert_s_i32(i32 %x) {
%a = sitofp i32 %x to double
ret double %a
}
-; CHECK-LABEL: $f64_convert_u_i32
-; CHECK-NEXT: (param i32) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f64_convert_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f64_convert_u_i32:
+; CHECK-NEXT: .param i32
+; CHECK-NEXT: .result f64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f64_convert_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define double @f64_convert_u_i32(i32 %x) {
%a = uitofp i32 %x to double
ret double %a
}
-; CHECK-LABEL: $f32_convert_s_i64
-; CHECK-NEXT: (param i64) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f32_convert_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f32_convert_s_i64:
+; CHECK-NEXT: .param i64
+; CHECK-NEXT: .result f32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f32_convert_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define float @f32_convert_s_i64(i64 %x) {
%a = sitofp i64 %x to float
ret float %a
}
-; CHECK-LABEL: $f32_convert_u_i64
-; CHECK-NEXT: (param i64) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f32_convert_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f32_convert_u_i64:
+; CHECK-NEXT: .param i64
+; CHECK-NEXT: .result f32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f32_convert_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define float @f32_convert_u_i64(i64 %x) {
%a = uitofp i64 %x to float
ret float %a
}
-; CHECK-LABEL: $f64_convert_s_i64
-; CHECK-NEXT: (param i64) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f64_convert_s @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f64_convert_s_i64:
+; CHECK-NEXT: .param i64
+; CHECK-NEXT: .result f64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f64_convert_s @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define double @f64_convert_s_i64(i64 %x) {
%a = sitofp i64 %x to double
ret double %a
}
-; CHECK-LABEL: $f64_convert_u_i64
-; CHECK-NEXT: (param i64) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f64_convert_u @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f64_convert_u_i64:
+; CHECK-NEXT: .param i64
+; CHECK-NEXT: .result f64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f64_convert_u @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define double @f64_convert_u_i64(i64 %x) {
%a = uitofp i64 %x to double
ret double %a
}
-; CHECK-LABEL: $f64_promote_f32
-; CHECK-NEXT: (param f32) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f64_promote @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f64_promote_f32:
+; CHECK-NEXT: .param f32
+; CHECK-NEXT: .result f64
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f64_promote @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define double @f64_promote_f32(float %x) {
%a = fpext float %x to double
ret double %a
}
-; CHECK-LABEL: $f32_demote_f64
-; CHECK-NEXT: (param f64) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (f32_demote @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: f32_demote_f64:
+; CHECK-NEXT: .param f64
+; CHECK-NEXT: .result f32
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: f32_demote @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define float @f32_demote_f64(double %x) {
%a = fptrunc double %x to float
ret float %a
declare float @llvm.nearbyint.f32(float)
declare float @llvm.rint.f32(float)
-; CHECK-LABEL: (func $fadd32
-; CHECK-NEXT: (param f32) (param f32) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (fadd @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: fadd32:
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: fadd @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define float @fadd32(float %x, float %y) {
%a = fadd float %x, %y
ret float %a
}
-; CHECK-LABEL: (func $fsub32
-; CHECK: (set_local @2 (fsub @1 @0))
+; CHECK-LABEL: fsub32:
+; CHECK: fsub @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
define float @fsub32(float %x, float %y) {
%a = fsub float %x, %y
ret float %a
}
-; CHECK-LABEL: (func $fmul32
-; CHECK: (set_local @2 (fmul @1 @0))
+; CHECK-LABEL: fmul32:
+; CHECK: fmul @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
define float @fmul32(float %x, float %y) {
%a = fmul float %x, %y
ret float %a
}
-; CHECK-LABEL: (func $fdiv32
-; CHECK: (set_local @2 (fdiv @1 @0))
+; CHECK-LABEL: fdiv32:
+; CHECK: fdiv @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
define float @fdiv32(float %x, float %y) {
%a = fdiv float %x, %y
ret float %a
}
-; CHECK-LABEL: (func $fabs32
-; CHECK: (set_local @1 (fabs @0))
+; CHECK-LABEL: fabs32:
+; CHECK: fabs @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: (func $fneg32
-; CHECK: (set_local @1 (fneg @0))
+; CHECK-LABEL: fneg32:
+; CHECK: fneg @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
define float @fneg32(float %x) {
%a = fsub float -0., %x
ret float %a
}
-; CHECK-LABEL: (func $copysign32
-; CHECK: (set_local @2 (copysign @1 @0))
+; CHECK-LABEL: copysign32:
+; CHECK: copysign @3, @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: (func $sqrt32
-; CHECK: (set_local @1 (sqrt @0))
+; CHECK-LABEL: sqrt32:
+; CHECK: sqrt @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: (func $ceil32
-; CHECK: (set_local @1 (ceil @0))
+; CHECK-LABEL: ceil32:
+; CHECK: ceil @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: (func $floor32
-; CHECK: (set_local @1 (floor @0))
+; CHECK-LABEL: floor32:
+; CHECK: floor @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: (func $trunc32
-; CHECK: (set_local @1 (trunc @0))
+; CHECK-LABEL: trunc32:
+; CHECK: trunc @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: (func $nearest32
-; CHECK: (set_local @1 (nearest @0))
+; CHECK-LABEL: nearest32:
+; CHECK: nearest @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: (func $nearest32_via_rint
-; CHECK: (set_local @1 (nearest @0))
+; CHECK-LABEL: nearest32_via_rint:
+; CHECK: nearest @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
declare double @llvm.nearbyint.f64(double)
declare double @llvm.rint.f64(double)
-; CHECK-LABEL: (func $fadd64
-; CHECK-NEXT: (param f64) (param f64) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (fadd @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: fadd64:
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: fadd @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define double @fadd64(double %x, double %y) {
%a = fadd double %x, %y
ret double %a
}
-; CHECK-LABEL: (func $fsub64
-; CHECK: (set_local @2 (fsub @1 @0))
+; CHECK-LABEL: fsub64:
+; CHECK: fsub @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
define double @fsub64(double %x, double %y) {
%a = fsub double %x, %y
ret double %a
}
-; CHECK-LABEL: (func $fmul64
-; CHECK: (set_local @2 (fmul @1 @0))
+; CHECK-LABEL: fmul64:
+; CHECK: fmul @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
define double @fmul64(double %x, double %y) {
%a = fmul double %x, %y
ret double %a
}
-; CHECK-LABEL: (func $fdiv64
-; CHECK: (set_local @2 (fdiv @1 @0))
+; CHECK-LABEL: fdiv64:
+; CHECK: fdiv @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
define double @fdiv64(double %x, double %y) {
%a = fdiv double %x, %y
ret double %a
}
-; CHECK-LABEL: (func $fabs64
-; CHECK: (set_local @1 (fabs @0))
+; CHECK-LABEL: fabs64:
+; CHECK: fabs @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: (func $fneg64
-; CHECK: (set_local @1 (fneg @0))
+; CHECK-LABEL: fneg64:
+; CHECK: fneg @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
define double @fneg64(double %x) {
%a = fsub double -0., %x
ret double %a
}
-; CHECK-LABEL: (func $copysign64
-; CHECK: (set_local @2 (copysign @1 @0))
+; CHECK-LABEL: copysign64:
+; CHECK: copysign @3, @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: (func $sqrt64
-; CHECK: (set_local @1 (sqrt @0))
+; CHECK-LABEL: sqrt64:
+; CHECK: sqrt @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: (func $ceil64
-; CHECK: (set_local @1 (ceil @0))
+; CHECK-LABEL: ceil64:
+; CHECK: ceil @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: (func $floor64
-; CHECK: (set_local @1 (floor @0))
+; CHECK-LABEL: floor64:
+; CHECK: floor @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: (func $trunc64
-; CHECK: (set_local @1 (trunc @0))
+; CHECK-LABEL: trunc64:
+; CHECK: trunc @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: (func $nearest64
-; CHECK: (set_local @1 (nearest @0))
+; CHECK-LABEL: nearest64:
+; CHECK: nearest @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: (func $nearest64_via_rint
-; CHECK: (set_local @1 (nearest @0))
+; CHECK-LABEL: nearest64_via_rint:
+; CHECK: nearest @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
; This tests very minimal fast-isel functionality.
-; CHECK-LABEL: (func $immediate_f32
-; CHECK: (immediate 0x1.4p1)
+; CHECK-LABEL: immediate_f32:
+; CHECK: f32.const 0x1.4p1{{$}}
define float @immediate_f32() {
ret float 2.5
}
-; CHECK-LABEL: (func $immediate_f64
-; CHECK: (immediate 0x1.4p1)
+; CHECK-LABEL: immediate_f64:
+; CHECK: f64.const 0x1.4p1{{$}}
define double @immediate_f64() {
ret double 2.5
}
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $f0{{$}}
-; CHECK: (return){{$}}
-; CHECK-NEXT: ) ;; end func $f0{{$}}
+; CHECK-LABEL: f0:
+; CHECK: return{{$}}
+; CHECK: .size f0,
define void @f0() {
ret void
}
-; CHECK-LABEL: (func $f1{{$}}
-; CHECK-NEXT: (result i32){{$}}
-; CHECK-NEXT: (set_local @0 (immediate 0)){{$}}
-; CHECK-NEXT: (return @0){{$}}
-; CHECK-NEXT: ) ;; end func $f1{{$}}
+; CHECK-LABEL: f1:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: i32.const 0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
+; CHECK: .size f1,
define i32 @f1() {
ret i32 0
}
-; CHECK-LABEL: (func $f2{{$}}
-; CHECK-NEXT: (param i32) (param f32) (result i32){{$}}
-; CHECK-NEXT: (set_local @0 (immediate 0)){{$}}
-; CHECK-NEXT: (return @0){{$}}
-; CHECK-NEXT: ) ;; end func $f2{{$}}
+; CHECK-LABEL: f2:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: i32.const 0{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
+; CHECK: .size f2,
define i32 @f2(i32 %p1, float %p2) {
ret i32 0
}
-; CHECK-LABEL: (func $f3{{$}}
-; CHECK-NEXT: (param i32) (param f32){{$}}
-; CHECK-NEXT: (return){{$}}
-; CHECK-NEXT: ) ;; end func $f3{{$}}
+; CHECK-LABEL: f3:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: return{{$}}
+; CHECK: .size f3,
define void @f3(i32 %p1, float %p2) {
ret void
}
; CHECK-NOT: llvm.metadata
@llvm.used = appending global [1 x i32*] [i32* @g], section "llvm.metadata"
-@g = private global i32 1337; ; CHECK: (global $g i32 1337)
-
-@ud = internal global i32 undef; ; CHECK: (global $ud i32 0)
-@nil = internal global i32 zeroinitializer; ; CHECK: (global $nil i32 0)
-@z = internal global i32 0; ; CHECK: (global $z i32 0)
-@one = internal global i32 1; ; CHECK: (global $one i32 1)
-@answer = internal global i32 42; ; CHECK: (global $answer i32 42)
-@u32max = internal global i32 -1; ; CHECK: (global $u32max i32 4294967295)
-
-@ud64 = internal global i64 undef; ; CHECK: (global $ud64 i64 0)
-@nil64 = internal global i64 zeroinitializer; ; CHECK: (global $nil64 i64 0)
-@z64 = internal global i64 0; ; CHECK: (global $z64 i64 0)
-@twoP32 = internal global i64 4294967296; ; CHECK: (global $twoP32 i64 4294967296)
-@u64max = internal global i64 -1; ; CHECK: (global $u64max i64 18446744073709551615)
-
-@f32ud = internal global float undef; ; CHECK: (global $f32ud f32 0x0p0)
-@f32nil = internal global float zeroinitializer; ; CHECK: (global $f32nil f32 0x0p0)
-@f32z = internal global float 0.0; ; CHECK: (global $f32z f32 0x0p0)
-@f32nz = internal global float -0.0; ; CHECK: (global $f32nz f32 -0x0p0)
-@f32two = internal global float 2.0; ; CHECK: (global $f32two f32 0x1p1)
-
-@f64ud = internal global double undef; ; CHECK: (global $f64ud f64 0x0p0)
-@f64nil = internal global double zeroinitializer; ; CHECK: (global $f64nil f64 0x0p0)
-@f64z = internal global double 0.0; ; CHECK: (global $f64z f64 0x0p0)
-@f64nz = internal global double -0.0; ; CHECK: (global $f64nz f64 -0x0p0)
-@f64two = internal global double 2.0; ; CHECK: (global $f64two f64 0x1p1)
+; CHECK: .type g,@object
+; CHECK: .align 2{{$}}
+; CHECK-NEXT: g:
+; CHECK-NEXT: .int32 1337{{$}}
+; CHECK-NEXT: .size g, 4{{$}}
+@g = private global i32 1337
+
+; CHECK-LABEL: ud:
+; CHECK-NEXT: .zero 4{{$}}
+; CHECK-NEXT: .size ud, 4{{$}}
+@ud = internal global i32 undef
+
+; CHECK: .type nil,@object
+; CHECK-NEXT: .lcomm nil,4,2{{$}}
+@nil = internal global i32 zeroinitializer
+
+; CHECK: .type z,@object
+; CHECK-NEXT: .lcomm z,4,2{{$}}
+@z = internal global i32 0
+
+; CHECK-NEXT: .type one,@object
+; CHECK-NEXT: .align 2{{$}}
+; CHECK-NEXT: one:
+; CHECK-NEXT: .int32 1{{$}}
+; CHECK-NEXT: .size one, 4{{$}}
+@one = internal global i32 1
+
+; CHECK: .type answer,@object
+; CHECK: .align 2{{$}}
+; CHECK-NEXT: answer:
+; CHECK-NEXT: .int32 42{{$}}
+; CHECK-NEXT: .size answer, 4{{$}}
+@answer = internal global i32 42
+
+; CHECK: .type u32max,@object
+; CHECK: .align 2{{$}}
+; CHECK-NEXT: u32max:
+; CHECK-NEXT: .int32 4294967295{{$}}
+; CHECK-NEXT: .size u32max, 4{{$}}
+@u32max = internal global i32 -1
+
+; CHECK: .type ud64,@object
+; CHECK: .align 3{{$}}
+; CHECK-NEXT: ud64:
+; CHECK-NEXT: .zero 8{{$}}
+; CHECK-NEXT: .size ud64, 8{{$}}
+@ud64 = internal global i64 undef
+
+; CHECK: .type nil64,@object
+; CHECK: .lcomm nil64,8,3{{$}}
+@nil64 = internal global i64 zeroinitializer
+
+; CHECK: .type z64,@object
+; CHECK: .lcomm z64,8,3{{$}}
+@z64 = internal global i64 0
+
+; CHECK: .type twoP32,@object
+; CHECK: .align 3{{$}}
+; CHECK-NEXT: twoP32:
+; CHECK-NEXT: .int64 4294967296{{$}}
+; CHECK-NEXT: .size twoP32, 8{{$}}
+@twoP32 = internal global i64 4294967296
+
+; CHECK: .type u64max,@object
+; CHECK: .align 3{{$}}
+; CHECK-NEXT: u64max:
+; CHECK-NEXT: .int64 -1{{$}}
+; CHECK-NEXT: .size u64max, 8{{$}}
+@u64max = internal global i64 -1
+
+; CHECK: .type f32ud,@object
+; CHECK: .align 2{{$}}
+; CHECK-NEXT: f32ud:
+; CHECK-NEXT: .zero 4{{$}}
+; CHECK-NEXT: .size f32ud, 4{{$}}
+@f32ud = internal global float undef
+
+; CHECK: .type f32nil,@object
+; CHECK: .lcomm f32nil,4,2{{$}}
+@f32nil = internal global float zeroinitializer
+
+; CHECK: .type f32z,@object
+; CHECK: .lcomm f32z,4,2{{$}}
+@f32z = internal global float 0.0
+
+; CHECK: .type f32nz,@object
+; CHECK: .align 2{{$}}
+; CHECK: f32nz:
+; CHECK: .int32 2147483648{{$}}
+; CHECK: .size f32nz, 4{{$}}
+@f32nz = internal global float -0.0
+
+; CHECK: .type f32two,@object
+; CHECK: .align 2{{$}}
+; CHECK-NEXT: f32two:
+; CHECK-NEXT: .int32 1073741824{{$}}
+; CHECK-NEXT: .size f32two, 4{{$}}
+@f32two = internal global float 2.0
+
+; CHECK: .type f64ud,@object
+; CHECK: .align 3{{$}}
+; CHECK-NEXT: f64ud:
+; CHECK-NEXT: .zero 8{{$}}
+; CHECK-NEXT: .size f64ud, 8{{$}}
+@f64ud = internal global double undef
+
+; CHECK: .type f64nil,@object
+; CHECK: .lcomm f64nil,8,3{{$}}
+@f64nil = internal global double zeroinitializer
+
+; CHECK: .type f64z,@object
+; CHECK: .lcomm f64z,8,3{{$}}
+@f64z = internal global double 0.0
+
+; CHECK: .type f64nz,@object
+; CHECK: .align 3{{$}}
+; CHECK-NEXT: f64nz:
+; CHECK-NEXT: .int64 -9223372036854775808{{$}}
+; CHECK-NEXT: .size f64nz, 8{{$}}
+@f64nz = internal global double -0.0
+
+; CHECK: .type f64two,@object
+; CHECK: .align 3{{$}}
+; CHECK-NEXT: f64two:
+; CHECK-NEXT: .int64 4611686018427387904{{$}}
+; CHECK-NEXT: .size f64two, 8{{$}}
+@f64two = internal global double 2.0
; RUN: llc < %s -asm-verbose=false | FileCheck %s
-; Test that the `.globl` directive is commented out.
-
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-NOT: globl
-; CHECK: ;; .globl foo
-; CHECK-NOT: globl
-; CHECK-LABEL: (func $foo
+; CHECK: .globl foo
+; CHECK-LABEL: foo:
define void @foo() {
ret void
}
declare i32 @llvm.cttz.i32(i32, i1)
declare i32 @llvm.ctpop.i32(i32)
-; CHECK-LABEL: (func $add32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (add @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: add32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: add @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @add32(i32 %x, i32 %y) {
%a = add i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $sub32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (sub @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: sub32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: sub @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @sub32(i32 %x, i32 %y) {
%a = sub i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $mul32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (mul @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: mul32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: mul @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @mul32(i32 %x, i32 %y) {
%a = mul i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $sdiv32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (sdiv @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: sdiv32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: sdiv @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @sdiv32(i32 %x, i32 %y) {
%a = sdiv i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $udiv32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (udiv @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: udiv32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: udiv @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @udiv32(i32 %x, i32 %y) {
%a = udiv i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $srem32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (srem @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: srem32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: srem @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @srem32(i32 %x, i32 %y) {
%a = srem i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $urem32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (urem @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: urem32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: urem @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @urem32(i32 %x, i32 %y) {
%a = urem i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $and32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (and @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: and32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: and @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @and32(i32 %x, i32 %y) {
%a = and i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $ior32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (ior @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: ior32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: ior @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @ior32(i32 %x, i32 %y) {
%a = or i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $xor32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (xor @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: xor32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: xor @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @xor32(i32 %x, i32 %y) {
%a = xor i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $shl32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (shl @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: shl32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shl @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @shl32(i32 %x, i32 %y) {
%a = shl i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $shr32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (shr_u @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: shr32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shr_u @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @shr32(i32 %x, i32 %y) {
%a = lshr i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $sar32
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (shr_s @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: sar32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shr_s @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i32 @sar32(i32 %x, i32 %y) {
%a = ashr i32 %x, %y
ret i32 %a
}
-; CHECK-LABEL: (func $clz32
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (clz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: clz32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: clz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @clz32(i32 %x) {
%a = call i32 @llvm.ctlz.i32(i32 %x, i1 false)
ret i32 %a
}
-; CHECK-LABEL: (func $clz32_zero_undef
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (clz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: clz32_zero_undef:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: clz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @clz32_zero_undef(i32 %x) {
%a = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
ret i32 %a
}
-; CHECK-LABEL: (func $ctz32
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (ctz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ctz32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: ctz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @ctz32(i32 %x) {
%a = call i32 @llvm.cttz.i32(i32 %x, i1 false)
ret i32 %a
}
-; CHECK-LABEL: (func $ctz32_zero_undef
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (ctz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ctz32_zero_undef:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: ctz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @ctz32_zero_undef(i32 %x) {
%a = call i32 @llvm.cttz.i32(i32 %x, i1 true)
ret i32 %a
}
-; CHECK-LABEL: (func $popcnt32
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (popcnt @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: popcnt32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: popcnt @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @popcnt32(i32 %x) {
%a = call i32 @llvm.ctpop.i32(i32 %x)
ret i32 %a
declare i64 @llvm.cttz.i64(i64, i1)
declare i64 @llvm.ctpop.i64(i64)
-; CHECK-LABEL: (func $add64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (add @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: add64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: add @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @add64(i64 %x, i64 %y) {
%a = add i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $sub64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (sub @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: sub64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: sub @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @sub64(i64 %x, i64 %y) {
%a = sub i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $mul64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (mul @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: mul64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: mul @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @mul64(i64 %x, i64 %y) {
%a = mul i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $sdiv64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (sdiv @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: sdiv64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: sdiv @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @sdiv64(i64 %x, i64 %y) {
%a = sdiv i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $udiv64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (udiv @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: udiv64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: udiv @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @udiv64(i64 %x, i64 %y) {
%a = udiv i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $srem64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (srem @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: srem64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: srem @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @srem64(i64 %x, i64 %y) {
%a = srem i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $urem64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (urem @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: urem64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: urem @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @urem64(i64 %x, i64 %y) {
%a = urem i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $and64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (and @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: and64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: and @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @and64(i64 %x, i64 %y) {
%a = and i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $ior64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (ior @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: ior64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: ior @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @ior64(i64 %x, i64 %y) {
%a = or i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $xor64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (xor @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: xor64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: xor @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @xor64(i64 %x, i64 %y) {
%a = xor i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $shl64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (shl @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: shl64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shl @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @shl64(i64 %x, i64 %y) {
%a = shl i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $shr64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (shr_u @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: shr64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shr_u @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @shr64(i64 %x, i64 %y) {
%a = lshr i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $sar64
-; CHECK-NEXT: (param i64) (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (set_local @2 (shr_s @1 @0))
-; CHECK-NEXT: (return @2)
+; CHECK-LABEL: sar64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shr_s @3, @2{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: return @4{{$}}
define i64 @sar64(i64 %x, i64 %y) {
%a = ashr i64 %x, %y
ret i64 %a
}
-; CHECK-LABEL: (func $clz64
-; CHECK-NEXT: (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (clz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: clz64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: clz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @clz64(i64 %x) {
%a = call i64 @llvm.ctlz.i64(i64 %x, i1 false)
ret i64 %a
}
-; CHECK-LABEL: (func $clz64_zero_undef
-; CHECK-NEXT: (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (clz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: clz64_zero_undef:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: clz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @clz64_zero_undef(i64 %x) {
%a = call i64 @llvm.ctlz.i64(i64 %x, i1 true)
ret i64 %a
}
-; CHECK-LABEL: (func $ctz64
-; CHECK-NEXT: (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (ctz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ctz64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: ctz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @ctz64(i64 %x) {
%a = call i64 @llvm.cttz.i64(i64 %x, i1 false)
ret i64 %a
}
-; CHECK-LABEL: (func $ctz64_zero_undef
-; CHECK-NEXT: (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (ctz @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ctz64_zero_undef:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: ctz @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @ctz64_zero_undef(i64 %x) {
%a = call i64 @llvm.cttz.i64(i64 %x, i1 true)
ret i64 %a
}
-; CHECK-LABEL: (func $popcnt64
-; CHECK-NEXT: (param i64) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (popcnt @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: popcnt64:
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: popcnt @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @popcnt64(i64 %x) {
%a = call i64 @llvm.ctpop.i64(i64 %x)
ret i64 %a
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $zero_i32
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (immediate 0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: zero_i32:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: i32.const 0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i32 @zero_i32() {
ret i32 0
}
-; CHECK-LABEL: (func $one_i32
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (immediate 1))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: one_i32:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: i32.const 1{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i32 @one_i32() {
ret i32 1
}
-; CHECK-LABEL: (func $max_i32
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (immediate 2147483647))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: max_i32:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: i32.const 2147483647{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i32 @max_i32() {
ret i32 2147483647
}
-; CHECK-LABEL: (func $min_i32
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (immediate -2147483648))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: min_i32:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: i32.const -2147483648{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i32 @min_i32() {
ret i32 -2147483648
}
-; CHECK-LABEL: (func $zero_i64
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (immediate 0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: zero_i64:
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: i64.const 0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i64 @zero_i64() {
ret i64 0
}
-; CHECK-LABEL: (func $one_i64
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (immediate 1))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: one_i64:
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: i64.const 1{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i64 @one_i64() {
ret i64 1
}
-; CHECK-LABEL: (func $max_i64
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (immediate 9223372036854775807))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: max_i64:
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: i64.const 9223372036854775807{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i64 @max_i64() {
ret i64 9223372036854775807
}
-; CHECK-LABEL: (func $min_i64
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (immediate -9223372036854775808))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: min_i64:
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: i64.const -9223372036854775808{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i64 @min_i64() {
ret i64 -9223372036854775808
}
-; CHECK-LABEL: (func $negzero_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate -0x0p0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: negzero_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const -0x0p0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @negzero_f32() {
ret float -0.0
}
-; CHECK-LABEL: (func $zero_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate 0x0p0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: zero_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const 0x0p0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @zero_f32() {
ret float 0.0
}
-; CHECK-LABEL: (func $one_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate 0x1p0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: one_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const 0x1p0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @one_f32() {
ret float 1.0
}
-; CHECK-LABEL: (func $two_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate 0x1p1))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: two_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const 0x1p1{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @two_f32() {
ret float 2.0
}
-; CHECK-LABEL: (func $nan_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate nan))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: nan_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const nan
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @nan_f32() {
ret float 0x7FF8000000000000
}
-; CHECK-LABEL: (func $negnan_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate -nan))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: negnan_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const -nan
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @negnan_f32() {
ret float 0xFFF8000000000000
}
-; CHECK-LABEL: (func $inf_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate infinity))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: inf_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const infinity
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @inf_f32() {
ret float 0x7FF0000000000000
}
-; CHECK-LABEL: (func $neginf_f32
-; CHECK-NEXT: (result f32)
-; CHECK-NEXT: (set_local @0 (immediate -infinity))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: neginf_f32:
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: f32.const -infinity
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define float @neginf_f32() {
ret float 0xFFF0000000000000
}
-; CHECK-LABEL: (func $negzero_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate -0x0p0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: negzero_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const -0x0p0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @negzero_f64() {
ret double -0.0
}
-; CHECK-LABEL: (func $zero_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate 0x0p0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: zero_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const 0x0p0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @zero_f64() {
ret double 0.0
}
-; CHECK-LABEL: (func $one_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate 0x1p0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: one_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const 0x1p0{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @one_f64() {
ret double 1.0
}
-; CHECK-LABEL: (func $two_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate 0x1p1))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: two_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const 0x1p1{{$}}
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @two_f64() {
ret double 2.0
}
-; CHECK-LABEL: (func $nan_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate nan))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: nan_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const nan
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @nan_f64() {
ret double 0x7FF8000000000000
}
-; CHECK-LABEL: (func $negnan_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate -nan))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: negnan_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const -nan
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @negnan_f64() {
ret double 0xFFF8000000000000
}
-; CHECK-LABEL: (func $inf_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate infinity))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: inf_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const infinity
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @inf_f64() {
ret double 0x7FF0000000000000
}
-; CHECK-LABEL: (func $neginf_f64
-; CHECK-NEXT: (result f64)
-; CHECK-NEXT: (set_local @0 (immediate -infinity))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: neginf_f64:
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: f64.const -infinity
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define double @neginf_f64() {
ret double 0xFFF0000000000000
}
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $sext_i8_i32
-; CHECK: (set_local @1 (load_s_i8_i32 @0))
+; CHECK-LABEL: sext_i8_i32:
+; CHECK: load_s_i8_i32 @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
ret i32 %e
}
-; CHECK-LABEL: (func $zext_i8_i32
-; CHECK: (set_local @1 (load_u_i8_i32 @0))
+; CHECK-LABEL: zext_i8_i32:
+; CHECK: load_u_i8_i32 @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
ret i32 %e
}
-; CHECK-LABEL: (func $sext_i16_i32
-; CHECK: (set_local @1 (load_s_i16_i32 @0))
+; CHECK-LABEL: sext_i16_i32:
+; CHECK: load_s_i16_i32 @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
ret i32 %e
}
-; CHECK-LABEL: (func $zext_i16_i32
-; CHECK: (set_local @1 (load_u_i16_i32 @0))
+; CHECK-LABEL: zext_i16_i32:
+; CHECK: load_u_i16_i32 @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
ret i32 %e
}
-; CHECK-LABEL: (func $sext_i8_i64
-; CHECK: (set_local @1 (load_s_i8_i64 @0))
+; CHECK-LABEL: sext_i8_i64:
+; CHECK: load_s_i8_i64 @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
ret i64 %e
}
-; CHECK-LABEL: (func $zext_i8_i64
-; CHECK: (set_local @1 (load_u_i8_i64 @0))
+; CHECK-LABEL: zext_i8_i64:
+; CHECK: load_u_i8_i64 @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
ret i64 %e
}
-; CHECK-LABEL: (func $sext_i16_i64
-; CHECK: (set_local @1 (load_s_i16_i64 @0))
+; CHECK-LABEL: sext_i16_i64:
+; CHECK: load_s_i16_i64 @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
ret i64 %e
}
-; CHECK-LABEL: (func $zext_i16_i64
-; CHECK: (set_local @1 (load_u_i16_i64 @0))
+; CHECK-LABEL: zext_i16_i64:
+; CHECK: load_u_i16_i64 @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
ret i64 %e
}
-; CHECK-LABEL: (func $sext_i32_i64
-; CHECK: (set_local @1 (load_s_i32_i64 @0))
+; CHECK-LABEL: sext_i32_i64:
+; CHECK: load_s_i32_i64 @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
ret i64 %e
}
-; CHECK-LABEL: (func $zext_i32_i64
-; CHECK: (set_local @1 (load_u_i32_i64 @0))
+; CHECK-LABEL: zext_i32_i64:
+; CHECK: load_u_i32_i64 @1{{$}}
+; CHECK: set_local @2, pop{{$}}
define i64 @zext_i32_i64(i32 *%p) {
%v = load i32, i32* %p
%e = zext i32 %v to i64
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $load_u_i1_i32
-; CHECK: (set_local @1 (load_u_i8_i32 @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: load_u_i1_i32:
+; CHECK: load_u_i8_i32 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @load_u_i1_i32(i1* %p) {
%v = load i1, i1* %p
%e = zext i1 %v to i32
ret i32 %e
}
-; CHECK-LABEL: (func $load_s_i1_i32
-; CHECK: (set_local @1 (load_u_i8_i32 @0))
-; CHECK-NEXT: (set_local @2 (immediate 31))
-; CHECK-NEXT: (set_local @3 (shl @1 @2))
-; CHECK-NEXT: (set_local @4 (shr_s @3 @2))
-; CHECK-NEXT: (return @4)
+; CHECK-LABEL: load_s_i1_i32:
+; CHECK: load_u_i8_i32 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: i32.const 31{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shl @2, @3{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: shr_s @4, @3{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: return @5{{$}}
define i32 @load_s_i1_i32(i1* %p) {
%v = load i1, i1* %p
%e = sext i1 %v to i32
ret i32 %e
}
-; CHECK-LABEL: (func $load_u_i1_i64
-; CHECK: (set_local @1 (load_u_i8_i64 @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: load_u_i1_i64:
+; CHECK: load_u_i8_i64 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @load_u_i1_i64(i1* %p) {
%v = load i1, i1* %p
%e = zext i1 %v to i64
ret i64 %e
}
-; CHECK-LABEL: (func $load_s_i1_i64
-; CHECK: (set_local @1 (load_u_i8_i64 @0))
-; CHECK-NEXT: (set_local @2 (immediate 63))
-; CHECK-NEXT: (set_local @3 (shl @1 @2))
-; CHECK-NEXT: (set_local @4 (shr_s @3 @2))
-; CHECK-NEXT: (return @4)
+; CHECK-LABEL: load_s_i1_i64:
+; CHECK: load_u_i8_i64 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: i64.const 63{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: shl @2, @3{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: shr_s @4, @3{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: return @5{{$}}
define i64 @load_s_i1_i64(i1* %p) {
%v = load i1, i1* %p
%e = sext i1 %v to i64
ret i64 %e
}
-; CHECK-LABEL: (func $store_i32_i1
-; CHECK: (set_local @2 (immediate 1))
-; CHECK-NEXT: (set_local @3 (and @1 @2))
-; CHECK-NEXT: (store_i8 @0 @3)
+; CHECK-LABEL: store_i32_i1:
+; CHECK: i32.const 1{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: and @3, @4{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: store_i8 @2, @5{{$}}
define void @store_i32_i1(i1* %p, i32 %v) {
%t = trunc i32 %v to i1
store i1 %t, i1* %p
ret void
}
-; CHECK-LABEL: (func $store_i64_i1
-; CHECK: (set_local @2 (immediate 1))
-; CHECK-NEXT: (set_local @3 (and @1 @2))
-; CHECK-NEXT: (store_i8 @0 @3)
+; CHECK-LABEL: store_i64_i1:
+; CHECK: i64.const 1{{$}}
+; CHECK-NEXT: set_local @4, pop{{$}}
+; CHECK-NEXT: and @3, @4{{$}}
+; CHECK-NEXT: set_local @5, pop{{$}}
+; CHECK-NEXT: store_i8 @2, @5{{$}}
define void @store_i64_i1(i1* %p, i64 %v) {
%t = trunc i64 %v to i1
store i1 %t, i1* %p
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $ldi32
-; CHECK-NEXT: (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (load_i32 @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ldi32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: load_i32 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @ldi32(i32 *%p) {
%v = load i32, i32* %p
ret i32 %v
}
-; CHECK-LABEL: (func $ldi64
-; CHECK-NEXT: (param i32) (result i64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (load_i64 @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ldi64:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: load_i64 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i64 @ldi64(i64 *%p) {
%v = load i64, i64* %p
ret i64 %v
}
-; CHECK-LABEL: (func $ldf32
-; CHECK-NEXT: (param i32) (result f32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (load_f32 @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ldf32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result f32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: load_f32 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define float @ldf32(float *%p) {
%v = load float, float* %p
ret float %v
}
-; CHECK-LABEL: (func $ldf64
-; CHECK-NEXT: (param i32) (result f64)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (set_local @1 (load_f64 @0))
-; CHECK-NEXT: (return @1)
+; CHECK-LABEL: ldf64:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result f64{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @1, pop{{$}}
+; CHECK-NEXT: load_f64 @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define double @ldf64(double *%p) {
%v = load double, double* %p
ret double %v
declare i32 @llvm.wasm.memory.size.i32() nounwind readnone
declare void @llvm.wasm.resize.memory.i32(i32) nounwind
-; CHECK-LABEL: (func $page_size
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (page_size))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: page_size:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: page_size
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i32 @page_size() {
%a = call i32 @llvm.wasm.page.size.i32()
ret i32 %a
}
-; CHECK-LABEL: (func $memory_size
-; CHECK-NEXT: (result i32)
-; CHECK-NEXT: (set_local @0 (memory_size))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: memory_size:
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: memory_size
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i32 @memory_size() {
%a = call i32 @llvm.wasm.memory.size.i32()
ret i32 %a
}
-; CHECK-LABEL: (func $resize_memory
-; CHECK-NEXT: (param i32)
-; CHECK: (resize_memory @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: resize_memory:
+; CHECK-NEXT: .param i32
+; CHECK: resize_memory @1
+; CHECK-NEXT: return
define void @resize_memory(i32 %n) {
call void @llvm.wasm.resize.memory.i32(i32 %n)
ret void
declare i64 @llvm.wasm.memory.size.i64() nounwind readnone
declare void @llvm.wasm.resize.memory.i64(i64) nounwind
-; CHECK-LABEL: (func $page_size
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (page_size))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: page_size:
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: page_size
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i64 @page_size() {
%a = call i64 @llvm.wasm.page.size.i64()
ret i64 %a
}
-; CHECK-LABEL: (func $memory_size
-; CHECK-NEXT: (result i64)
-; CHECK-NEXT: (set_local @0 (memory_size))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: memory_size:
+; CHECK-NEXT: .result i64{{$}}
+; CHECK-NEXT: memory_size
+; CHECK-NEXT: set_local @0, pop{{$}}
+; CHECK-NEXT: return @0{{$}}
define i64 @memory_size() {
%a = call i64 @llvm.wasm.memory.size.i64()
ret i64 %a
}
-; CHECK-LABEL: (func $resize_memory
-; CHECK-NEXT: (param i64)
-; CHECK: (resize_memory @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: resize_memory:
+; CHECK-NEXT: .param i64
+; CHECK: resize_memory @1
+; CHECK-NEXT: return
define void @resize_memory(i64 %n) {
call void @llvm.wasm.resize.memory.i64(i64 %n)
ret void
; Basic phi triangle.
-; CHECK-LABEL: test0
-; CHECK: (set_local [[REG:@.*]] (argument 0))
-; CHECK: (set_local [[REG]] (sdiv [[REG]] {{.*}}))
-; CHECK: (return [[REG]])
+; CHECK-LABEL: test0:
+; CHECK: @0{{$}}
+; CHECK: set_local [[REG:@.*]], pop
+; CHECK: sdiv [[REG]], {{.*}}
+; CHECK: set_local [[REG]], pop
+; CHECK: return [[REG]]
define i32 @test0(i32 %p) {
entry:
%t = icmp slt i32 %p, 0
; Swap phis.
-; CHECK-LABEL: test1
+; CHECK-LABEL: test1:
; CHECK: BB1_1:
-; CHECK: (set_local [[REG0:@.*]] [[REG1:@.*]])
-; CHECK: (set_local [[REG1]] [[REG2:@.*]])
-; CHECK: (set_local [[REG2]] [[REG0]])
+; CHECK: [[REG1:@.*]]
+; CHECK: set_local [[REG0:@.*]], pop
+; CHECK: [[REG2:@.*]]
+; CHECK: set_local [[REG1]], pop
+; CHECK: [[REG0]]
+; CHECK: set_local [[REG2]], pop
define i32 @test1(i32 %n) {
entry:
br label %loop
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $return_void
-; CHECK: (return)
+; CHECK-LABEL: return_void:
+; CHECK: return{{$}}
define void @return_void() {
ret void
}
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $trunc_i8_i32
-; CHECK: (store_i8 @1 @0)
+; CHECK-LABEL: trunc_i8_i32:
+; CHECK: store_i8 @3, @2{{$}}
define void @trunc_i8_i32(i8 *%p, i32 %v) {
%t = trunc i32 %v to i8
store i8 %t, i8* %p
ret void
}
-; CHECK-LABEL: (func $trunc_i16_i32
-; CHECK: (store_i16 @1 @0)
+; CHECK-LABEL: trunc_i16_i32:
+; CHECK: store_i16 @3, @2{{$}}
define void @trunc_i16_i32(i16 *%p, i32 %v) {
%t = trunc i32 %v to i16
store i16 %t, i16* %p
ret void
}
-; CHECK-LABEL: (func $trunc_i8_i64
-; CHECK: (store_i8 @1 @0)
+; CHECK-LABEL: trunc_i8_i64:
+; CHECK: store_i8 @3, @2{{$}}
define void @trunc_i8_i64(i8 *%p, i64 %v) {
%t = trunc i64 %v to i8
store i8 %t, i8* %p
ret void
}
-; CHECK-LABEL: (func $trunc_i16_i64
-; CHECK: (store_i16 @1 @0)
+; CHECK-LABEL: trunc_i16_i64:
+; CHECK: store_i16 @3, @2{{$}}
define void @trunc_i16_i64(i16 *%p, i64 %v) {
%t = trunc i64 %v to i16
store i16 %t, i16* %p
ret void
}
-; CHECK-LABEL: (func $trunc_i32_i64
-; CHECK: (store_i32 @1 @0)
+; CHECK-LABEL: trunc_i32_i64:
+; CHECK: store_i32 @3, @2{{$}}
define void @trunc_i32_i64(i32 *%p, i64 %v) {
%t = trunc i64 %v to i32
store i32 %t, i32* %p
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $sti32
-; CHECK-NEXT: (param i32) (param i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (store_i32 @1 @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: sti32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: store_i32 @3, @2{{$}}
+; CHECK-NEXT: return{{$}}
define void @sti32(i32 *%p, i32 %v) {
store i32 %v, i32* %p
ret void
}
-; CHECK-LABEL: (func $sti64
-; CHECK-NEXT: (param i32) (param i64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (store_i64 @1 @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: sti64:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: store_i64 @3, @2{{$}}
+; CHECK-NEXT: return{{$}}
define void @sti64(i64 *%p, i64 %v) {
store i64 %v, i64* %p
ret void
}
-; CHECK-LABEL: (func $stf32
-; CHECK-NEXT: (param i32) (param f32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (store_f32 @1 @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: stf32:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param f32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: store_f32 @3, @2{{$}}
+; CHECK-NEXT: return{{$}}
define void @stf32(float *%p, float %v) {
store float %v, float* %p
ret void
}
-; CHECK-LABEL: (func $stf64
-; CHECK-NEXT: (param i32) (param f64)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (set_local @1 (argument 0))
-; CHECK-NEXT: (store_f64 @1 @0)
-; CHECK-NEXT: (return)
+; CHECK-LABEL: stf64:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param f64{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @3, pop{{$}}
+; CHECK-NEXT: store_f64 @3, @2{{$}}
+; CHECK-NEXT: return{{$}}
define void @stf64(double *%p, double %v) {
store double %v, double* %p
ret void
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: BB0_2:
-; CHECK: (call $foo0)
+; 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: BB0_2:
+; 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)
+; CHECK: return{{$}}
define void @bar32(i32 %n) {
entry:
switch i32 %n, label %sw.epilog [
ret void
}
-; 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: BB1_2:
-; CHECK: (call $foo0)
+; 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: BB1_2:
+; 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)
+; CHECK: return{{$}}
define void @bar64(i64 %n) {
entry:
switch i64 %n, label %sw.epilog [
target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
-; CHECK-LABEL: (func $unused_first
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 1))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: unused_first:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @1{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @unused_first(i32 %x, i32 %y) {
ret i32 %y
}
-; CHECK-LABEL: (func $unused_second
-; CHECK-NEXT: (param i32) (param i32) (result i32)
-; CHECK-NEXT: (set_local @0 (argument 0))
-; CHECK-NEXT: (return @0)
+; CHECK-LABEL: unused_second:
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .param i32{{$}}
+; CHECK-NEXT: .result i32{{$}}
+; CHECK-NEXT: @0{{$}}
+; CHECK-NEXT: set_local @2, pop{{$}}
+; CHECK-NEXT: return @2{{$}}
define i32 @unused_second(i32 %x, i32 %y) {
ret i32 %x
}