[WebAssembly] Enable register coloring and register stackifying.

This also takes the push/pop syntax another step forward, introducing stack
slot numbers to make it easier to see how expressions are connected. For
example, the value pushed in $push7 is popped in $pop7.

And, this begins an experiment with making get_local and set_local implicit
when an operation directly uses or defines a register. This greatly reduces
clutter. If this experiment succeeds, it may make sense to do this for
const instructions as well.

And, this introduces more special code for ARGUMENTS; hopefully this code
will soon be obviated by proper support for live-in virtual registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2015-11-18 16:12:01 +00:00
parent fc0981ecbc
commit 94401ce9c8
37 changed files with 684 additions and 832 deletions

View File

@ -38,8 +38,8 @@ WebAssemblyInstPrinter::WebAssemblyInstPrinter(const MCAsmInfo &MAI,
void WebAssemblyInstPrinter::printRegName(raw_ostream &OS,
unsigned RegNo) const {
assert(RegNo != WebAssemblyFunctionInfo::UnusedReg);
// FIXME: Revisit whether we actually print the get_local explicitly.
OS << "(get_local " << RegNo << ")";
// Note that there's an implicit get_local/set_local here!
OS << "$" << RegNo;
}
void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
@ -56,20 +56,6 @@ void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
}
printAnnotation(OS, Annot);
unsigned NumDefs = MII.get(MI->getOpcode()).getNumDefs();
assert(NumDefs <= 1 &&
"Instructions with multiple result values not implemented");
// FIXME: Revisit whether we actually print the set_local explicitly.
if (NumDefs != 0) {
unsigned WAReg = MI->getOperand(0).getReg();
// Only print the set_local if the register is used.
// TODO: Revisit this once the spec explains what should happen here.
if (WAReg != WebAssemblyFunctionInfo::UnusedReg)
OS << "\n"
"\t" "set_local " << WAReg << ", $pop";
}
}
static std::string toString(const APFloat &FP) {
@ -93,14 +79,15 @@ void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
raw_ostream &O) {
const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isReg()) {
if (OpNo >= MII.get(MI->getOpcode()).getNumDefs())
printRegName(O, Op.getReg());
else {
if (Op.getReg() != WebAssemblyFunctionInfo::UnusedReg)
O << "$push";
else
O << "$discard";
}
unsigned WAReg = Op.getReg();
if (int(WAReg) >= 0)
printRegName(O, WAReg);
else if (OpNo >= MII.get(MI->getOpcode()).getNumDefs())
O << "$pop" << (WAReg & INT32_MAX);
else if (WAReg != WebAssemblyFunctionInfo::UnusedReg)
O << "$push" << (WAReg & INT32_MAX);
else
O << "$discard";
} else if (Op.isImm())
O << Op.getImm();
else if (Op.isFPImm())

View File

@ -110,9 +110,10 @@ std::string WebAssemblyAsmPrinter::regToString(const MachineOperand &MO) {
if (TargetRegisterInfo::isPhysicalRegister(RegNo))
return WebAssemblyInstPrinter::getRegisterName(RegNo);
assert(!MFI->isVRegStackified(RegNo));
unsigned WAReg = MFI->getWAReg(RegNo);
assert(WAReg != WebAssemblyFunctionInfo::UnusedReg);
return utostr(WAReg);
return '$' + utostr(WAReg);
}
const char *WebAssemblyAsmPrinter::toString(MVT VT) const {
@ -179,19 +180,27 @@ void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
if (ResultVTs.size() == 1)
OS << "\t" ".result " << toString(ResultVTs.front()) << '\n';
bool FirstVReg = true;
bool FirstWAReg = true;
for (unsigned Idx = 0, IdxE = MRI->getNumVirtRegs(); Idx != IdxE; ++Idx) {
unsigned VReg = TargetRegisterInfo::index2VirtReg(Idx);
if (!MRI->use_empty(VReg)) {
if (FirstVReg)
OS << "\t" ".local ";
else
OS << ", ";
OS << getRegTypeName(VReg);
FirstVReg = false;
}
unsigned WAReg = MFI->getWAReg(VReg);
// Don't declare unused registers.
if (WAReg == WebAssemblyFunctionInfo::UnusedReg)
continue;
// Don't redeclare parameters.
if (WAReg < MFI->getParams().size())
continue;
// Don't declare stackified registers.
if (int(WAReg) < 0)
continue;
if (FirstWAReg)
OS << "\t" ".local ";
else
OS << ", ";
OS << getRegTypeName(VReg);
FirstWAReg = false;
}
if (!FirstVReg)
if (!FirstWAReg)
OS << '\n';
// EmitRawText appends a newline, so strip off the last newline.
@ -204,19 +213,7 @@ void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
DEBUG(dbgs() << "EmitInstruction: " << *MI << '\n');
assert(MI->getDesc().getNumDefs() <= 1 &&
"Instructions with multiple result values not implemented");
switch (MI->getOpcode()) {
case TargetOpcode::COPY: {
// TODO: Figure out a way to lower COPY instructions to MCInst form.
SmallString<128> Str;
raw_svector_ostream OS(Str);
OS << "\t" "set_local " << regToString(MI->getOperand(0)) << ", "
"(get_local " << regToString(MI->getOperand(1)) << ")";
OutStreamer->EmitRawText(OS.str());
break;
}
case WebAssembly::ARGUMENT_I32:
case WebAssembly::ARGUMENT_I64:
case WebAssembly::ARGUMENT_F32:
@ -234,8 +231,6 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
}
}
void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) {
const DataLayout &DL = M.getDataLayout();

View File

@ -34,7 +34,22 @@ void WebAssemblyInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
DebugLoc DL, unsigned DestReg,
unsigned SrcReg, bool KillSrc) const {
BuildMI(MBB, I, DL, get(WebAssembly::COPY), DestReg)
const TargetRegisterClass *RC =
MBB.getParent()->getRegInfo().getRegClass(SrcReg);
unsigned SetLocalOpcode;
if (RC == &WebAssembly::I32RegClass)
SetLocalOpcode = WebAssembly::SET_LOCAL_I32;
else if (RC == &WebAssembly::I64RegClass)
SetLocalOpcode = WebAssembly::SET_LOCAL_I64;
else if (RC == &WebAssembly::F32RegClass)
SetLocalOpcode = WebAssembly::SET_LOCAL_F32;
else if (RC == &WebAssembly::F64RegClass)
SetLocalOpcode = WebAssembly::SET_LOCAL_F64;
else
llvm_unreachable("Unexpected register class");
BuildMI(MBB, I, DL, get(SetLocalOpcode), DestReg)
.addReg(SrcReg, KillSrc ? RegState::Kill : 0);
}

View File

@ -66,13 +66,6 @@ def WebAssemblywrapper : SDNode<"WebAssemblyISD::Wrapper",
// WebAssembly-specific Operands.
//===----------------------------------------------------------------------===//
/*
* TODO(jfb): Add the following.
*
* get_local: read the current value of a local variable
* set_local: set the current value of a local variable
*/
def bb_op : Operand<OtherVT>;
def tjumptable_op : Operand<iPTR>;
def global : Operand<iPTR>;
@ -83,6 +76,10 @@ def global : Operand<iPTR>;
include "WebAssemblyInstrFormats.td"
//===----------------------------------------------------------------------===//
// Additional instructions.
//===----------------------------------------------------------------------===//
multiclass ARGUMENT<WebAssemblyRegClass vt> {
def ARGUMENT_#vt : I<(outs vt:$res), (ins i32imm:$argno),
[(set vt:$res, (WebAssemblyargument timm:$argno))]>;
@ -92,6 +89,20 @@ defm : ARGUMENT<I64>;
defm : ARGUMENT<F32>;
defm : ARGUMENT<F64>;
// get_local and set_local are not generated by instruction selection; they
// are implied by virtual register uses and defs in most contexts. However,
// they are explicitly emitted for special purposes.
multiclass LOCAL<WebAssemblyRegClass vt> {
def GET_LOCAL_#vt : I<(outs vt:$res), (ins i32imm:$regno), [],
"get_local\t$res, $regno">;
// TODO: set_local returns its operand value
def SET_LOCAL_#vt : I<(outs), (ins i32imm:$regno, vt:$src), [],
"set_local\t$regno, $src">;
}
defm : LOCAL<I32>;
defm : LOCAL<I64>;
defm : LOCAL<F32>;
defm : LOCAL<F64>;
def CONST_I32 : I<(outs I32:$res), (ins i32imm:$imm),
[(set I32:$res, imm:$imm)],
@ -106,7 +117,6 @@ def CONST_F64 : I<(outs F64:$res), (ins f64imm:$imm),
[(set F64:$res, fpimm:$imm)],
"f64.const\t$res, $imm">;
def : Pat<(i32 (WebAssemblywrapper tglobaladdr :$dst)),
(CONST_I32 tglobaladdr :$dst)>;

View File

@ -19,6 +19,7 @@
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h" // for WebAssembly::ARGUMENT_*
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
@ -45,6 +46,7 @@ public:
AU.addRequired<MachineBlockFrequencyInfo>();
AU.addPreserved<MachineBlockFrequencyInfo>();
AU.addPreservedID(MachineDominatorsID);
AU.addRequired<SlotIndexes>(); // for ARGUMENT fixups
MachineFunctionPass::getAnalysisUsage(AU);
}
@ -94,6 +96,32 @@ bool WebAssemblyRegColoring::runOnMachineFunction(MachineFunction &MF) {
SmallVector<LiveInterval *, 0> SortedIntervals;
SortedIntervals.reserve(NumVRegs);
// FIXME: If scheduling has moved an ARGUMENT virtual register, move it back,
// and recompute liveness. This is a temporary hack.
bool SawNonArg = false;
bool MovedArg = false;
MachineBasicBlock &EntryMBB = MF.front();
for (auto MII = EntryMBB.begin(); MII != EntryMBB.end(); ) {
MachineInstr *MI = &*MII++;
if (MI->getOpcode() == WebAssembly::ARGUMENT_I32 ||
MI->getOpcode() == WebAssembly::ARGUMENT_I64 ||
MI->getOpcode() == WebAssembly::ARGUMENT_F32 ||
MI->getOpcode() == WebAssembly::ARGUMENT_F64) {
EntryMBB.insert(EntryMBB.begin(), MI->removeFromParent());
if (SawNonArg)
MovedArg = true;
} else {
SawNonArg = true;
}
}
if (MovedArg) {
SlotIndexes &Slots = getAnalysis<SlotIndexes>();
Liveness->releaseMemory();
Slots.releaseMemory();
Slots.runOnMachineFunction(MF);
Liveness->runOnMachineFunction(MF);
}
DEBUG(dbgs() << "Interesting register intervals:\n");
for (unsigned i = 0; i < NumVRegs; ++i) {
unsigned VReg = TargetRegisterInfo::index2VirtReg(i);

View File

@ -65,18 +65,17 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) {
// WebAssembly argument registers are in the same index space as local
// variables. Assign the numbers for them first.
for (MachineBasicBlock &MBB : MF) {
for (MachineInstr &MI : MBB) {
switch (MI.getOpcode()) {
case WebAssembly::ARGUMENT_I32:
case WebAssembly::ARGUMENT_I64:
case WebAssembly::ARGUMENT_F32:
case WebAssembly::ARGUMENT_F64:
MFI.setWAReg(MI.getOperand(0).getReg(), MI.getOperand(1).getImm());
break;
default:
break;
}
MachineBasicBlock &EntryMBB = MF.front();
for (MachineInstr &MI : EntryMBB) {
switch (MI.getOpcode()) {
case WebAssembly::ARGUMENT_I32:
case WebAssembly::ARGUMENT_I64:
case WebAssembly::ARGUMENT_F32:
case WebAssembly::ARGUMENT_F64:
MFI.setWAReg(MI.getOperand(0).getReg(), MI.getOperand(1).getImm());
break;
default:
break;
}
}
@ -84,9 +83,15 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) {
// virtual registers.
unsigned NumArgRegs = MFI.getParams().size();
unsigned NumVRegs = MF.getRegInfo().getNumVirtRegs();
unsigned NumStackRegs = 0;
unsigned CurReg = 0;
for (unsigned VRegIdx = 0; VRegIdx < NumVRegs; ++VRegIdx) {
unsigned VReg = TargetRegisterInfo::index2VirtReg(VRegIdx);
// Handle stackified registers.
if (MFI.isVRegStackified(VReg)) {
MFI.setWAReg(VReg, INT32_MIN | NumStackRegs++);
continue;
}
// Skip unused registers.
if (MRI.use_empty(VReg))
continue;

View File

@ -22,6 +22,7 @@
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h" // for WebAssembly::ARGUMENT_*
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
@ -98,6 +99,14 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) {
if (Def->getOpcode() == TargetOpcode::IMPLICIT_DEF)
continue;
// Argument instructions represent live-in registers and not real
// instructions.
if (Def->getOpcode() == WebAssembly::ARGUMENT_I32 ||
Def->getOpcode() == WebAssembly::ARGUMENT_I64 ||
Def->getOpcode() == WebAssembly::ARGUMENT_F32 ||
Def->getOpcode() == WebAssembly::ARGUMENT_F64)
continue;
// Single-use expression trees require defs that have one use, or that
// they be trivially clonable.
// TODO: Eventually we'll relax this, to take advantage of set_local

View File

@ -155,7 +155,10 @@ bool WebAssemblyPassConfig::addInstSelector() {
bool WebAssemblyPassConfig::addILPOpts() { return true; }
void WebAssemblyPassConfig::addPreRegAlloc() {}
void WebAssemblyPassConfig::addPreRegAlloc() {
// Mark registers as representing wasm's expression stack.
addPass(createWebAssemblyRegStackify());
}
void WebAssemblyPassConfig::addPostRegAlloc() {
// FIXME: the following passes dislike virtual registers. Disable them for now
@ -169,6 +172,9 @@ void WebAssemblyPassConfig::addPostRegAlloc() {
// TODO: Until we get ReverseBranchCondition support, MachineBlockPlacement
// can create ugly-looking control flow.
disablePass(&MachineBlockPlacementID);
// Run the register coloring pass to reduce the total number of registers.
addPass(createWebAssemblyRegColoring());
}
void WebAssemblyPassConfig::addPreSched2() {}

View File

@ -15,10 +15,8 @@ declare void @void_nullary()
; CHECK-LABEL: call_i32_nullary:
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local i32
; CHECK-NEXT: call i32_nullary, $push{{$}}
; CHECK-NEXT: set_local 0, $pop
; CHECK-NEXT: return (get_local 0)
; CHECK-NEXT: call i32_nullary, $push[[NUM:[0-9]+]]{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @call_i32_nullary() {
%r = call i32 @i32_nullary()
ret i32 %r
@ -26,10 +24,8 @@ define i32 @call_i32_nullary() {
; CHECK-LABEL: call_i64_nullary:
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local i64
; CHECK-NEXT: call i64_nullary, $push{{$}}
; CHECK-NEXT: set_local 0, $pop
; CHECK-NEXT: return (get_local 0)
; CHECK-NEXT: call i64_nullary, $push[[NUM:[0-9]+]]{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @call_i64_nullary() {
%r = call i64 @i64_nullary()
ret i64 %r
@ -37,10 +33,8 @@ define i64 @call_i64_nullary() {
; CHECK-LABEL: call_float_nullary:
; CHECK-NEXT: .result f32
; CHECK-NEXT: .local f32
; CHECK-NEXT: call float_nullary, $push{{$}}
; CHECK-NEXT: set_local 0, $pop
; CHECK-NEXT: return (get_local 0)
; CHECK-NEXT: call float_nullary, $push[[NUM:[0-9]+]]{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @call_float_nullary() {
%r = call float @float_nullary()
ret float %r
@ -48,10 +42,8 @@ define float @call_float_nullary() {
; CHECK-LABEL: call_double_nullary:
; CHECK-NEXT: .result f64
; CHECK-NEXT: .local f64
; CHECK-NEXT: call double_nullary, $push{{$}}
; CHECK-NEXT: set_local 0, $pop
; CHECK-NEXT: return (get_local 0)
; CHECK-NEXT: call double_nullary, $push[[NUM:[0-9]+]]{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @call_double_nullary() {
%r = call double @double_nullary()
ret double %r
@ -59,7 +51,7 @@ define double @call_double_nullary() {
; CHECK-LABEL: call_void_nullary:
; CHECK-NEXT: call void_nullary{{$}}
; CHECK-NEXT: return
; CHECK-NEXT: return{{$}}
define void @call_void_nullary() {
call void @void_nullary()
ret void
@ -68,10 +60,8 @@ define void @call_void_nullary() {
; CHECK-LABEL: call_i32_unary:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local i32, i32
; CHECK-NEXT: call i32_unary, $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop
; CHECK-NEXT: return (get_local 1)
; CHECK-NEXT: call i32_unary, $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @call_i32_unary(i32 %a) {
%r = call i32 @i32_unary(i32 %a)
ret i32 %r
@ -81,10 +71,8 @@ define i32 @call_i32_unary(i32 %a) {
; CHECK-NEXT: .param i32
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local i32, i32, i32
; CHECK-NEXT: call i32_binary, $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop
; CHECK-NEXT: return (get_local 2)
; CHECK-NEXT: call i32_binary, $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @call_i32_binary(i32 %a, i32 %b) {
%r = call i32 @i32_binary(i32 %a, i32 %b)
ret i32 %r
@ -92,9 +80,8 @@ define i32 @call_i32_binary(i32 %a, i32 %b) {
; CHECK-LABEL: call_indirect_void:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .local i32
; CHECK-NEXT: call_indirect (get_local 0){{$}}
; CHECK-NEXT: return
; CHECK-NEXT: call_indirect $0{{$}}
; CHECK-NEXT: return{{$}}
define void @call_indirect_void(void ()* %callee) {
call void %callee()
ret void
@ -103,10 +90,8 @@ define void @call_indirect_void(void ()* %callee) {
; CHECK-LABEL: call_indirect_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local i32, i32
; CHECK-NEXT: call_indirect (get_local 0), $push{{$}}
; CHECK-NEXT: set_local 1, $pop
; CHECK-NEXT: return (get_local 1)
; CHECK-NEXT: call_indirect $0, $push[[NUM:[0-9]+]]{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @call_indirect_i32(i32 ()* %callee) {
%t = call i32 %callee()
ret i32 %t

View File

@ -69,7 +69,7 @@ back:
; CHECK: block BB2_2{{$}}
; CHECK: br_if {{.*}}, BB2_2{{$}}
; CHECK: BB2_1:
; CHECK: br_if (get_local 10), BB2_1{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB2_1{{$}}
; CHECK: BB2_2:
; CHECK: return{{$}}
define void @test2(double* nocapture %p, i32 %n) {
@ -101,14 +101,12 @@ for.end:
; CHECK: block BB3_5{{$}}
; CHECK: block BB3_4{{$}}
; CHECK: block BB3_2{{$}}
; CHECK: br_if (get_local 4), BB3_2{{$}}
; CHECK: br BB3_5{{$}}
; CHECK: BB3_2:
; CHECK: br_if (get_local 6), BB3_4{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB3_2{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB3_4{{$}}
; CHECK: br BB3_5{{$}}
; CHECK: BB3_4:
; CHECK: BB3_5:
; CHECK: return (get_local 3){{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @doublediamond(i32 %a, i32 %b, i32* %p) {
entry:
%c = icmp eq i32 %a, 0
@ -134,9 +132,9 @@ exit:
; CHECK-LABEL: triangle:
; CHECK: block BB4_2{{$}}
; CHECK: br_if (get_local 3), BB4_2{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB4_2{{$}}
; CHECK: BB4_2:
; CHECK: return (get_local 2){{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @triangle(i32* %p, i32 %a) {
entry:
%c = icmp eq i32 %a, 0
@ -153,11 +151,11 @@ exit:
; CHECK-LABEL: diamond:
; CHECK: block BB5_3{{$}}
; CHECK: block BB5_2{{$}}
; CHECK: br_if (get_local 3), BB5_2{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB5_2{{$}}
; CHECK: br BB5_3{{$}}
; CHECK: BB5_2:
; CHECK: BB5_3:
; CHECK: return (get_local 2){{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @diamond(i32* %p, i32 %a) {
entry:
%c = icmp eq i32 %a, 0
@ -176,7 +174,7 @@ exit:
; CHECK-LABEL: single_block:
; CHECK-NOT: br
; CHECK: return (get_local 1){{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @single_block(i32* %p) {
entry:
store volatile i32 0, i32* %p
@ -186,7 +184,7 @@ entry:
; CHECK-LABEL: minimal_loop:
; CHECK-NOT: br
; CHECK: BB7_1:
; CHECK: i32.store (get_local 0), (get_local 2){{$}}
; CHECK: i32.store $0, $pop{{[0-9]+}}{{$}}
; CHECK: br BB7_1{{$}}
define i32 @minimal_loop(i32* %p) {
entry:
@ -201,8 +199,8 @@ loop:
; CHECK-NOT: br
; CHECK: BB8_1:
; CHECK: loop BB8_2{{$}}
; CHECK: br_if (get_local 3), BB8_1{{$}}
; CHECK: return (get_local 2){{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB8_1{{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @simple_loop(i32* %p, i32 %a) {
entry:
%c = icmp eq i32 %a, 0
@ -219,11 +217,11 @@ exit:
; CHECK-LABEL: doubletriangle:
; CHECK: block BB9_4{{$}}
; CHECK: block BB9_3{{$}}
; CHECK: br_if (get_local 4), BB9_4{{$}}
; CHECK: br_if (get_local 6), BB9_3{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB9_4{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB9_3{{$}}
; CHECK: BB9_3:
; CHECK: BB9_4:
; CHECK: return (get_local 3){{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) {
entry:
%c = icmp eq i32 %a, 0
@ -247,12 +245,12 @@ exit:
; CHECK-LABEL: ifelse_earlyexits:
; CHECK: block BB10_4{{$}}
; CHECK: block BB10_2{{$}}
; CHECK: br_if (get_local 4), BB10_2{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB10_2{{$}}
; CHECK: br BB10_4{{$}}
; CHECK: BB10_2:
; CHECK: br_if (get_local 6), BB10_4{{$}}
; CHECK: br_if $pop{{[0-9]+}}, BB10_4{{$}}
; CHECK: BB10_4:
; CHECK: return (get_local 3){{$}}
; CHECK: return ${{[0-9]+}}{{$}}
define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) {
entry:
%c = icmp eq i32 %a, 0

View File

@ -10,14 +10,10 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f32, f32, i32, i32, i32{{$}}
; CHECK-NEXT: f32.eq $push, (get_local 1), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: f32.eq $push, (get_local 0), (get_local 0){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: i32.and $push, (get_local 3), (get_local 2){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: return (get_local 4){{$}}
; CHECK-NEXT: f32.eq $push[[NUM0:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.eq $push[[NUM1:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.and $push[[NUM2:[0-9]+]], $pop[[NUM0]], $pop[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM2]]{{$}}
define i32 @ord_f32(float %x, float %y) {
%a = fcmp ord float %x, %y
%b = zext i1 %a to i32
@ -28,14 +24,10 @@ define i32 @ord_f32(float %x, float %y) {
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f32, f32, i32, i32, i32{{$}}
; CHECK-NEXT: f32.ne $push, (get_local 1), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: f32.ne $push, (get_local 0), (get_local 0){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: i32.or $push, (get_local 3), (get_local 2){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: return (get_local 4){{$}}
; CHECK-NEXT: f32.ne $push[[NUM0:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.ne $push[[NUM1:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM2:[0-9]+]], $pop[[NUM0]], $pop[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM2]]{{$}}
define i32 @uno_f32(float %x, float %y) {
%a = fcmp uno float %x, %y
%b = zext i1 %a to i32
@ -46,10 +38,8 @@ define i32 @uno_f32(float %x, float %y) {
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f32, f32, i32{{$}}
; CHECK-NEXT: f32.eq $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: f32.eq $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @oeq_f32(float %x, float %y) {
%a = fcmp oeq float %x, %y
%b = zext i1 %a to i32
@ -57,8 +47,8 @@ define i32 @oeq_f32(float %x, float %y) {
}
; CHECK-LABEL: une_f32:
; CHECK: f32.ne $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.ne $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @une_f32(float %x, float %y) {
%a = fcmp une float %x, %y
%b = zext i1 %a to i32
@ -66,8 +56,8 @@ define i32 @une_f32(float %x, float %y) {
}
; CHECK-LABEL: olt_f32:
; CHECK: f32.lt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.lt $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @olt_f32(float %x, float %y) {
%a = fcmp olt float %x, %y
%b = zext i1 %a to i32
@ -75,8 +65,8 @@ define i32 @olt_f32(float %x, float %y) {
}
; CHECK-LABEL: ole_f32:
; CHECK: f32.le $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.le $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ole_f32(float %x, float %y) {
%a = fcmp ole float %x, %y
%b = zext i1 %a to i32
@ -84,8 +74,8 @@ define i32 @ole_f32(float %x, float %y) {
}
; CHECK-LABEL: ogt_f32:
; CHECK: f32.gt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.gt $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ogt_f32(float %x, float %y) {
%a = fcmp ogt float %x, %y
%b = zext i1 %a to i32
@ -93,8 +83,8 @@ define i32 @ogt_f32(float %x, float %y) {
}
; CHECK-LABEL: oge_f32:
; CHECK: f32.ge $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.ge $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @oge_f32(float %x, float %y) {
%a = fcmp oge float %x, %y
%b = zext i1 %a to i32
@ -107,18 +97,12 @@ define i32 @oge_f32(float %x, float %y) {
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f32, f32, i32, i32, i32, i32, i32{{$}}
; CHECK-NEXT: f32.eq $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: f32.ne $push, (get_local 1), (get_local 1){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: f32.ne $push, (get_local 0), (get_local 0){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: i32.or $push, (get_local 4), (get_local 3){{$}}
; CHECK-NEXT: set_local 5, $pop{{$}}
; CHECK-NEXT: i32.or $push, (get_local 2), (get_local 5){{$}}
; CHECK-NEXT: set_local 6, $pop{{$}}
; CHECK-NEXT: return (get_local 6){{$}}
; CHECK-NEXT: f32.eq $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f32.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ueq_f32(float %x, float %y) {
%a = fcmp ueq float %x, %y
%b = zext i1 %a to i32
@ -126,8 +110,15 @@ define i32 @ueq_f32(float %x, float %y) {
}
; CHECK-LABEL: one_f32:
; CHECK: f32.ne $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f32
; CHECK-NEXT: .param f32
; CHECK-NEXT: .result i32
; CHECK-NEXT: f32.ne $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f32.eq $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.eq $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.and $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.and $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]
define i32 @one_f32(float %x, float %y) {
%a = fcmp one float %x, %y
%b = zext i1 %a to i32
@ -135,8 +126,15 @@ define i32 @one_f32(float %x, float %y) {
}
; CHECK-LABEL: ult_f32:
; CHECK: f32.lt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f32.lt $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f32.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ult_f32(float %x, float %y) {
%a = fcmp ult float %x, %y
%b = zext i1 %a to i32
@ -144,8 +142,15 @@ define i32 @ult_f32(float %x, float %y) {
}
; CHECK-LABEL: ule_f32:
; CHECK: f32.le $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f32.le $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f32.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ule_f32(float %x, float %y) {
%a = fcmp ule float %x, %y
%b = zext i1 %a to i32
@ -153,8 +158,15 @@ define i32 @ule_f32(float %x, float %y) {
}
; CHECK-LABEL: ugt_f32:
; CHECK: f32.gt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f32.gt $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f32.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ugt_f32(float %x, float %y) {
%a = fcmp ugt float %x, %y
%b = zext i1 %a to i32
@ -162,8 +174,15 @@ define i32 @ugt_f32(float %x, float %y) {
}
; CHECK-LABEL: uge_f32:
; CHECK: f32.ge $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f32.ge $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f32.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f32.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @uge_f32(float %x, float %y) {
%a = fcmp uge float %x, %y
%b = zext i1 %a to i32

View File

@ -10,14 +10,10 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f64, f64, i32, i32, i32{{$}}
; CHECK-NEXT: f64.eq $push, (get_local 1), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: f64.eq $push, (get_local 0), (get_local 0){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: i32.and $push, (get_local 3), (get_local 2){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: return (get_local 4){{$}}
; CHECK-NEXT: f64.eq $push[[NUM0:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.eq $push[[NUM1:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.and $push[[NUM2:[0-9]+]], $pop[[NUM0]], $pop[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM2]]{{$}}
define i32 @ord_f64(double %x, double %y) {
%a = fcmp ord double %x, %y
%b = zext i1 %a to i32
@ -28,14 +24,10 @@ define i32 @ord_f64(double %x, double %y) {
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f64, f64, i32, i32, i32{{$}}
; CHECK-NEXT: f64.ne $push, (get_local 1), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: f64.ne $push, (get_local 0), (get_local 0){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: i32.or $push, (get_local 3), (get_local 2){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: return (get_local 4){{$}}
; CHECK-NEXT: f64.ne $push[[NUM0:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.ne $push[[NUM1:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM2:[0-9]+]], $pop[[NUM0]], $pop[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM2]]{{$}}
define i32 @uno_f64(double %x, double %y) {
%a = fcmp uno double %x, %y
%b = zext i1 %a to i32
@ -46,10 +38,8 @@ define i32 @uno_f64(double %x, double %y) {
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f64, f64, i32{{$}}
; CHECK-NEXT: f64.eq $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: f64.eq $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @oeq_f64(double %x, double %y) {
%a = fcmp oeq double %x, %y
%b = zext i1 %a to i32
@ -57,8 +47,8 @@ define i32 @oeq_f64(double %x, double %y) {
}
; CHECK-LABEL: une_f64:
; CHECK: f64.ne $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.ne $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @une_f64(double %x, double %y) {
%a = fcmp une double %x, %y
%b = zext i1 %a to i32
@ -66,8 +56,8 @@ define i32 @une_f64(double %x, double %y) {
}
; CHECK-LABEL: olt_f64:
; CHECK: f64.lt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.lt $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @olt_f64(double %x, double %y) {
%a = fcmp olt double %x, %y
%b = zext i1 %a to i32
@ -75,8 +65,8 @@ define i32 @olt_f64(double %x, double %y) {
}
; CHECK-LABEL: ole_f64:
; CHECK: f64.le $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.le $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ole_f64(double %x, double %y) {
%a = fcmp ole double %x, %y
%b = zext i1 %a to i32
@ -84,8 +74,8 @@ define i32 @ole_f64(double %x, double %y) {
}
; CHECK-LABEL: ogt_f64:
; CHECK: f64.gt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.gt $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ogt_f64(double %x, double %y) {
%a = fcmp ogt double %x, %y
%b = zext i1 %a to i32
@ -93,8 +83,8 @@ define i32 @ogt_f64(double %x, double %y) {
}
; CHECK-LABEL: oge_f64:
; CHECK: f64.ge $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.ge $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @oge_f64(double %x, double %y) {
%a = fcmp oge double %x, %y
%b = zext i1 %a to i32
@ -107,18 +97,12 @@ define i32 @oge_f64(double %x, double %y) {
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local f64, f64, i32, i32, i32, i32, i32{{$}}
; CHECK-NEXT: f64.eq $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: f64.ne $push, (get_local 1), (get_local 1){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: f64.ne $push, (get_local 0), (get_local 0){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: i32.or $push, (get_local 4), (get_local 3){{$}}
; CHECK-NEXT: set_local 5, $pop{{$}}
; CHECK-NEXT: i32.or $push, (get_local 2), (get_local 5){{$}}
; CHECK-NEXT: set_local 6, $pop{{$}}
; CHECK-NEXT: return (get_local 6){{$}}
; CHECK-NEXT: f64.eq $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f64.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ueq_f64(double %x, double %y) {
%a = fcmp ueq double %x, %y
%b = zext i1 %a to i32
@ -126,8 +110,15 @@ define i32 @ueq_f64(double %x, double %y) {
}
; CHECK-LABEL: one_f64:
; CHECK: f64.ne $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f64
; CHECK-NEXT: .param f64
; CHECK-NEXT: .result i32
; CHECK-NEXT: f64.ne $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f64.eq $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.eq $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.and $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.and $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]
define i32 @one_f64(double %x, double %y) {
%a = fcmp one double %x, %y
%b = zext i1 %a to i32
@ -135,8 +126,15 @@ define i32 @one_f64(double %x, double %y) {
}
; CHECK-LABEL: ult_f64:
; CHECK: f64.lt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f64.lt $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f64.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ult_f64(double %x, double %y) {
%a = fcmp ult double %x, %y
%b = zext i1 %a to i32
@ -144,8 +142,15 @@ define i32 @ult_f64(double %x, double %y) {
}
; CHECK-LABEL: ule_f64:
; CHECK: f64.le $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f64.le $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f64.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ule_f64(double %x, double %y) {
%a = fcmp ule double %x, %y
%b = zext i1 %a to i32
@ -153,8 +158,15 @@ define i32 @ule_f64(double %x, double %y) {
}
; CHECK-LABEL: ugt_f64:
; CHECK: f64.gt $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f64.gt $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f64.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @ugt_f64(double %x, double %y) {
%a = fcmp ugt double %x, %y
%b = zext i1 %a to i32
@ -162,8 +174,15 @@ define i32 @ugt_f64(double %x, double %y) {
}
; CHECK-LABEL: uge_f64:
; CHECK: f64.ge $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: f64.ge $push[[NUM0:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: f64.ne $push[[NUM1:[0-9]+]], $0, $0{{$}}
; CHECK-NEXT: f64.ne $push[[NUM2:[0-9]+]], $1, $1{{$}}
; CHECK-NEXT: i32.or $push[[NUM3:[0-9]+]], $pop[[NUM1]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.or $push[[NUM4:[0-9]+]], $pop[[NUM0]], $pop[[NUM3]]{{$}}
; CHECK-NEXT: return $pop[[NUM4]]{{$}}
define i32 @uge_f64(double %x, double %y) {
%a = fcmp uge double %x, %y
%b = zext i1 %a to i32

View File

@ -9,10 +9,8 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.eq $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.eq $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @eq_i32(i32 %x, i32 %y) {
%a = icmp eq i32 %x, %y
%b = zext i1 %a to i32
@ -20,8 +18,8 @@ define i32 @eq_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: ne_i32:
; CHECK: i32.ne $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.ne $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ne_i32(i32 %x, i32 %y) {
%a = icmp ne i32 %x, %y
%b = zext i1 %a to i32
@ -29,8 +27,8 @@ define i32 @ne_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: slt_i32:
; CHECK: i32.lt_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.lt_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @slt_i32(i32 %x, i32 %y) {
%a = icmp slt i32 %x, %y
%b = zext i1 %a to i32
@ -38,8 +36,8 @@ define i32 @slt_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: sle_i32:
; CHECK: i32.le_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.le_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @sle_i32(i32 %x, i32 %y) {
%a = icmp sle i32 %x, %y
%b = zext i1 %a to i32
@ -47,8 +45,8 @@ define i32 @sle_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: ult_i32:
; CHECK: i32.lt_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.lt_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ult_i32(i32 %x, i32 %y) {
%a = icmp ult i32 %x, %y
%b = zext i1 %a to i32
@ -56,8 +54,8 @@ define i32 @ult_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: ule_i32:
; CHECK: i32.le_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.le_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ule_i32(i32 %x, i32 %y) {
%a = icmp ule i32 %x, %y
%b = zext i1 %a to i32
@ -65,8 +63,8 @@ define i32 @ule_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: sgt_i32:
; CHECK: i32.gt_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.gt_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @sgt_i32(i32 %x, i32 %y) {
%a = icmp sgt i32 %x, %y
%b = zext i1 %a to i32
@ -74,8 +72,8 @@ define i32 @sgt_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: sge_i32:
; CHECK: i32.ge_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.ge_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @sge_i32(i32 %x, i32 %y) {
%a = icmp sge i32 %x, %y
%b = zext i1 %a to i32
@ -83,8 +81,8 @@ define i32 @sge_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: ugt_i32:
; CHECK: i32.gt_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.gt_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ugt_i32(i32 %x, i32 %y) {
%a = icmp ugt i32 %x, %y
%b = zext i1 %a to i32
@ -92,8 +90,8 @@ define i32 @ugt_i32(i32 %x, i32 %y) {
}
; CHECK-LABEL: uge_i32:
; CHECK: i32.ge_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i32.ge_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @uge_i32(i32 %x, i32 %y) {
%a = icmp uge i32 %x, %y
%b = zext i1 %a to i32

View File

@ -9,10 +9,8 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i64, i64, i32{{$}}
; CHECK-NEXT: i64.eq $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.eq $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @eq_i64(i64 %x, i64 %y) {
%a = icmp eq i64 %x, %y
%b = zext i1 %a to i32
@ -20,8 +18,8 @@ define i32 @eq_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: ne_i64:
; CHECK: i64.ne $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.ne $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ne_i64(i64 %x, i64 %y) {
%a = icmp ne i64 %x, %y
%b = zext i1 %a to i32
@ -29,8 +27,8 @@ define i32 @ne_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: slt_i64:
; CHECK: i64.lt_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.lt_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @slt_i64(i64 %x, i64 %y) {
%a = icmp slt i64 %x, %y
%b = zext i1 %a to i32
@ -38,8 +36,8 @@ define i32 @slt_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: sle_i64:
; CHECK: i64.le_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.le_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @sle_i64(i64 %x, i64 %y) {
%a = icmp sle i64 %x, %y
%b = zext i1 %a to i32
@ -47,8 +45,8 @@ define i32 @sle_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: ult_i64:
; CHECK: i64.lt_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.lt_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ult_i64(i64 %x, i64 %y) {
%a = icmp ult i64 %x, %y
%b = zext i1 %a to i32
@ -56,8 +54,8 @@ define i32 @ult_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: ule_i64:
; CHECK: i64.le_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.le_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ule_i64(i64 %x, i64 %y) {
%a = icmp ule i64 %x, %y
%b = zext i1 %a to i32
@ -65,8 +63,8 @@ define i32 @ule_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: sgt_i64:
; CHECK: i64.gt_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.gt_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @sgt_i64(i64 %x, i64 %y) {
%a = icmp sgt i64 %x, %y
%b = zext i1 %a to i32
@ -74,8 +72,8 @@ define i32 @sgt_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: sge_i64:
; CHECK: i64.ge_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.ge_s $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @sge_i64(i64 %x, i64 %y) {
%a = icmp sge i64 %x, %y
%b = zext i1 %a to i32
@ -83,8 +81,8 @@ define i32 @sge_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: ugt_i64:
; CHECK: i64.gt_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.gt_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @ugt_i64(i64 %x, i64 %y) {
%a = icmp ugt i64 %x, %y
%b = zext i1 %a to i32
@ -92,8 +90,8 @@ define i32 @ugt_i64(i64 %x, i64 %y) {
}
; CHECK-LABEL: uge_i64:
; CHECK: i64.ge_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: i64.ge_u $push[[NUM:[0-9]+]], $0, $1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @uge_i64(i64 %x, i64 %y) {
%a = icmp uge i64 %x, %y
%b = zext i1 %a to i32

View File

@ -8,10 +8,8 @@ target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: i32_wrap_i64:
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i64, i32{{$}}
; CHECK-NEXT: i32.wrap/i64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.wrap/i64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @i32_wrap_i64(i64 %x) {
%a = trunc i64 %x to i32
ret i32 %a
@ -20,10 +18,8 @@ define i32 @i32_wrap_i64(i64 %x) {
; CHECK-LABEL: i64_extend_s_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local i32, i64{{$}}
; CHECK-NEXT: i64.extend_s/i32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.extend_s/i32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @i64_extend_s_i32(i32 %x) {
%a = sext i32 %x to i64
ret i64 %a
@ -32,10 +28,8 @@ define i64 @i64_extend_s_i32(i32 %x) {
; CHECK-LABEL: i64_extend_u_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local i32, i64{{$}}
; CHECK-NEXT: i64.extend_u/i32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.extend_u/i32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @i64_extend_u_i32(i32 %x) {
%a = zext i32 %x to i64
ret i64 %a
@ -44,10 +38,8 @@ define i64 @i64_extend_u_i32(i32 %x) {
; CHECK-LABEL: i32_trunc_s_f32:
; CHECK-NEXT: .param f32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local f32, i32{{$}}
; CHECK-NEXT: i32.trunc_s/f32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.trunc_s/f32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @i32_trunc_s_f32(float %x) {
%a = fptosi float %x to i32
ret i32 %a
@ -56,10 +48,8 @@ define i32 @i32_trunc_s_f32(float %x) {
; CHECK-LABEL: i32_trunc_u_f32:
; CHECK-NEXT: .param f32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local f32, i32{{$}}
; CHECK-NEXT: i32.trunc_u/f32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.trunc_u/f32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @i32_trunc_u_f32(float %x) {
%a = fptoui float %x to i32
ret i32 %a
@ -68,10 +58,8 @@ define i32 @i32_trunc_u_f32(float %x) {
; CHECK-LABEL: i32_trunc_s_f64:
; CHECK-NEXT: .param f64
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local f64, i32{{$}}
; CHECK-NEXT: i32.trunc_s/f64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.trunc_s/f64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @i32_trunc_s_f64(double %x) {
%a = fptosi double %x to i32
ret i32 %a
@ -80,10 +68,8 @@ define i32 @i32_trunc_s_f64(double %x) {
; CHECK-LABEL: i32_trunc_u_f64:
; CHECK-NEXT: .param f64
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local f64, i32{{$}}
; CHECK-NEXT: i32.trunc_u/f64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.trunc_u/f64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @i32_trunc_u_f64(double %x) {
%a = fptoui double %x to i32
ret i32 %a
@ -92,10 +78,8 @@ define i32 @i32_trunc_u_f64(double %x) {
; CHECK-LABEL: i64_trunc_s_f32:
; CHECK-NEXT: .param f32
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local f32, i64{{$}}
; CHECK-NEXT: i64.trunc_s/f32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.trunc_s/f32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @i64_trunc_s_f32(float %x) {
%a = fptosi float %x to i64
ret i64 %a
@ -104,10 +88,8 @@ define i64 @i64_trunc_s_f32(float %x) {
; CHECK-LABEL: i64_trunc_u_f32:
; CHECK-NEXT: .param f32
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local f32, i64{{$}}
; CHECK-NEXT: i64.trunc_u/f32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.trunc_u/f32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @i64_trunc_u_f32(float %x) {
%a = fptoui float %x to i64
ret i64 %a
@ -116,10 +98,8 @@ define i64 @i64_trunc_u_f32(float %x) {
; CHECK-LABEL: i64_trunc_s_f64:
; CHECK-NEXT: .param f64
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local f64, i64{{$}}
; CHECK-NEXT: i64.trunc_s/f64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.trunc_s/f64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @i64_trunc_s_f64(double %x) {
%a = fptosi double %x to i64
ret i64 %a
@ -128,10 +108,8 @@ define i64 @i64_trunc_s_f64(double %x) {
; CHECK-LABEL: i64_trunc_u_f64:
; CHECK-NEXT: .param f64
; CHECK-NEXT: .result i64
; CHECK-NEXT: .local f64, i64{{$}}
; CHECK-NEXT: i64.trunc_u/f64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.trunc_u/f64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @i64_trunc_u_f64(double %x) {
%a = fptoui double %x to i64
ret i64 %a
@ -140,10 +118,8 @@ define i64 @i64_trunc_u_f64(double %x) {
; CHECK-LABEL: f32_convert_s_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result f32
; CHECK-NEXT: .local i32, f32{{$}}
; CHECK-NEXT: f32.convert_s/i32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f32.convert_s/i32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @f32_convert_s_i32(i32 %x) {
%a = sitofp i32 %x to float
ret float %a
@ -152,10 +128,8 @@ define float @f32_convert_s_i32(i32 %x) {
; CHECK-LABEL: f32_convert_u_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result f32
; CHECK-NEXT: .local i32, f32{{$}}
; CHECK-NEXT: f32.convert_u/i32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f32.convert_u/i32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @f32_convert_u_i32(i32 %x) {
%a = uitofp i32 %x to float
ret float %a
@ -164,10 +138,8 @@ define float @f32_convert_u_i32(i32 %x) {
; CHECK-LABEL: f64_convert_s_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result f64
; CHECK-NEXT: .local i32, f64{{$}}
; CHECK-NEXT: f64.convert_s/i32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f64.convert_s/i32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @f64_convert_s_i32(i32 %x) {
%a = sitofp i32 %x to double
ret double %a
@ -176,10 +148,8 @@ define double @f64_convert_s_i32(i32 %x) {
; CHECK-LABEL: f64_convert_u_i32:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result f64
; CHECK-NEXT: .local i32, f64{{$}}
; CHECK-NEXT: f64.convert_u/i32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f64.convert_u/i32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @f64_convert_u_i32(i32 %x) {
%a = uitofp i32 %x to double
ret double %a
@ -188,10 +158,8 @@ define double @f64_convert_u_i32(i32 %x) {
; CHECK-LABEL: f32_convert_s_i64:
; CHECK-NEXT: .param i64
; CHECK-NEXT: .result f32
; CHECK-NEXT: .local i64, f32{{$}}
; CHECK-NEXT: f32.convert_s/i64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f32.convert_s/i64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @f32_convert_s_i64(i64 %x) {
%a = sitofp i64 %x to float
ret float %a
@ -200,10 +168,8 @@ define float @f32_convert_s_i64(i64 %x) {
; CHECK-LABEL: f32_convert_u_i64:
; CHECK-NEXT: .param i64
; CHECK-NEXT: .result f32
; CHECK-NEXT: .local i64, f32{{$}}
; CHECK-NEXT: f32.convert_u/i64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f32.convert_u/i64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @f32_convert_u_i64(i64 %x) {
%a = uitofp i64 %x to float
ret float %a
@ -212,10 +178,8 @@ define float @f32_convert_u_i64(i64 %x) {
; CHECK-LABEL: f64_convert_s_i64:
; CHECK-NEXT: .param i64
; CHECK-NEXT: .result f64
; CHECK-NEXT: .local i64, f64{{$}}
; CHECK-NEXT: f64.convert_s/i64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f64.convert_s/i64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @f64_convert_s_i64(i64 %x) {
%a = sitofp i64 %x to double
ret double %a
@ -224,10 +188,8 @@ define double @f64_convert_s_i64(i64 %x) {
; CHECK-LABEL: f64_convert_u_i64:
; CHECK-NEXT: .param i64
; CHECK-NEXT: .result f64
; CHECK-NEXT: .local i64, f64{{$}}
; CHECK-NEXT: f64.convert_u/i64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f64.convert_u/i64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @f64_convert_u_i64(i64 %x) {
%a = uitofp i64 %x to double
ret double %a
@ -236,10 +198,8 @@ define double @f64_convert_u_i64(i64 %x) {
; CHECK-LABEL: f64_promote_f32:
; CHECK-NEXT: .param f32
; CHECK-NEXT: .result f64
; CHECK-NEXT: .local f32, f64{{$}}
; CHECK-NEXT: f64.promote/f32 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f64.promote/f32 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @f64_promote_f32(float %x) {
%a = fpext float %x to double
ret double %a
@ -248,10 +208,8 @@ define double @f64_promote_f32(float %x) {
; CHECK-LABEL: f32_demote_f64:
; CHECK-NEXT: .param f64
; CHECK-NEXT: .result f32
; CHECK-NEXT: .local f64, f32{{$}}
; CHECK-NEXT: f32.demote/f64 $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: f32.demote/f64 $push[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @f32_demote_f64(double %x) {
%a = fptrunc double %x to float
ret float %a

View File

@ -10,7 +10,7 @@ define void @foo(i32* nocapture %a, i32 %w, i32 %h) {
; CHECK-NEXT: .param i32
; CHECK-NEXT: .param i32
; CHECK-NEXT: .param i32
; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32{{$}}
; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32, i32, i32{{$}}
entry:
%cmp.19 = icmp sgt i32 %h, 0
br i1 %cmp.19, label %for.cond.1.preheader.lr.ph, label %for.end.7

View File

@ -18,106 +18,104 @@ declare float @llvm.rint.f32(float)
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local f32, f32, f32{{$}}
; CHECK-NEXT: f32.add $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: f32.add $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @fadd32(float %x, float %y) {
%a = fadd float %x, %y
ret float %a
}
; CHECK-LABEL: fsub32:
; CHECK: f32.sub $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.sub $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @fsub32(float %x, float %y) {
%a = fsub float %x, %y
ret float %a
}
; CHECK-LABEL: fmul32:
; CHECK: f32.mul $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.mul $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @fmul32(float %x, float %y) {
%a = fmul float %x, %y
ret float %a
}
; CHECK-LABEL: fdiv32:
; CHECK: f32.div $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.div $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @fdiv32(float %x, float %y) {
%a = fdiv float %x, %y
ret float %a
}
; CHECK-LABEL: fabs32:
; CHECK: f32.abs $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.abs $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @fabs32(float %x) {
%a = call float @llvm.fabs.f32(float %x)
ret float %a
}
; CHECK-LABEL: fneg32:
; CHECK: f32.neg $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.neg $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @fneg32(float %x) {
%a = fsub float -0., %x
ret float %a
}
; CHECK-LABEL: copysign32:
; CHECK: f32.copysign $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.copysign $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @copysign32(float %x, float %y) {
%a = call float @llvm.copysign.f32(float %x, float %y)
ret float %a
}
; CHECK-LABEL: sqrt32:
; CHECK: f32.sqrt $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.sqrt $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @sqrt32(float %x) {
%a = call float @llvm.sqrt.f32(float %x)
ret float %a
}
; CHECK-LABEL: ceil32:
; CHECK: f32.ceil $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.ceil $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @ceil32(float %x) {
%a = call float @llvm.ceil.f32(float %x)
ret float %a
}
; CHECK-LABEL: floor32:
; CHECK: f32.floor $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.floor $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @floor32(float %x) {
%a = call float @llvm.floor.f32(float %x)
ret float %a
}
; CHECK-LABEL: trunc32:
; CHECK: f32.trunc $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.trunc $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @trunc32(float %x) {
%a = call float @llvm.trunc.f32(float %x)
ret float %a
}
; CHECK-LABEL: nearest32:
; CHECK: f32.nearest $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.nearest $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @nearest32(float %x) {
%a = call float @llvm.nearbyint.f32(float %x)
ret float %a
}
; CHECK-LABEL: nearest32_via_rint:
; CHECK: f32.nearest $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f32.nearest $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @nearest32_via_rint(float %x) {
%a = call float @llvm.rint.f32(float %x)
ret float %a
@ -130,8 +128,8 @@ define float @nearest32_via_rint(float %x) {
; tests.
; CHECK-LABEL: fmin32:
; CHECK: f32.min $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.min $push1, $0, $pop0{{$}}
; CHECK-NEXT: return $pop1{{$}}
define float @fmin32(float %x) {
%a = fcmp ult float %x, 0.0
%b = select i1 %a, float %x, float 0.0
@ -139,8 +137,8 @@ define float @fmin32(float %x) {
}
; CHECK-LABEL: fmax32:
; CHECK: f32.max $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f32.max $push1, $0, $pop0{{$}}
; CHECK-NEXT: return $pop1{{$}}
define float @fmax32(float %x) {
%a = fcmp ugt float %x, 0.0
%b = select i1 %a, float %x, float 0.0

View File

@ -18,106 +18,104 @@ declare double @llvm.rint.f64(double)
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local f64, f64, f64{{$}}
; CHECK-NEXT: f64.add $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: f64.add $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @fadd64(double %x, double %y) {
%a = fadd double %x, %y
ret double %a
}
; CHECK-LABEL: fsub64:
; CHECK: f64.sub $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.sub $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @fsub64(double %x, double %y) {
%a = fsub double %x, %y
ret double %a
}
; CHECK-LABEL: fmul64:
; CHECK: f64.mul $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.mul $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @fmul64(double %x, double %y) {
%a = fmul double %x, %y
ret double %a
}
; CHECK-LABEL: fdiv64:
; CHECK: f64.div $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.div $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @fdiv64(double %x, double %y) {
%a = fdiv double %x, %y
ret double %a
}
; CHECK-LABEL: fabs64:
; CHECK: f64.abs $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.abs $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @fabs64(double %x) {
%a = call double @llvm.fabs.f64(double %x)
ret double %a
}
; CHECK-LABEL: fneg64:
; CHECK: f64.neg $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.neg $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @fneg64(double %x) {
%a = fsub double -0., %x
ret double %a
}
; CHECK-LABEL: copysign64:
; CHECK: f64.copysign $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.copysign $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @copysign64(double %x, double %y) {
%a = call double @llvm.copysign.f64(double %x, double %y)
ret double %a
}
; CHECK-LABEL: sqrt64:
; CHECK: f64.sqrt $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.sqrt $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @sqrt64(double %x) {
%a = call double @llvm.sqrt.f64(double %x)
ret double %a
}
; CHECK-LABEL: ceil64:
; CHECK: f64.ceil $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.ceil $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @ceil64(double %x) {
%a = call double @llvm.ceil.f64(double %x)
ret double %a
}
; CHECK-LABEL: floor64:
; CHECK: f64.floor $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.floor $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @floor64(double %x) {
%a = call double @llvm.floor.f64(double %x)
ret double %a
}
; CHECK-LABEL: trunc64:
; CHECK: f64.trunc $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.trunc $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @trunc64(double %x) {
%a = call double @llvm.trunc.f64(double %x)
ret double %a
}
; CHECK-LABEL: nearest64:
; CHECK: f64.nearest $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.nearest $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @nearest64(double %x) {
%a = call double @llvm.nearbyint.f64(double %x)
ret double %a
}
; CHECK-LABEL: nearest64_via_rint:
; CHECK: f64.nearest $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: f64.nearest $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @nearest64_via_rint(double %x) {
%a = call double @llvm.rint.f64(double %x)
ret double %a
@ -130,8 +128,8 @@ define double @nearest64_via_rint(double %x) {
; tests.
; CHECK-LABEL: fmin64:
; CHECK: f64.min $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.min $push1, $0, $pop0{{$}}
; CHECK-NEXT: return $pop1{{$}}
define double @fmin64(double %x) {
%a = fcmp ult double %x, 0.0
%b = select i1 %a, double %x, double 0.0
@ -139,8 +137,8 @@ define double @fmin64(double %x) {
}
; CHECK-LABEL: fmax64:
; CHECK: f64.max $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK: f64.max $push1, $0, $pop0{{$}}
; CHECK-NEXT: return $pop1{{$}}
define double @fmax64(double %x) {
%a = fcmp ugt double %x, 0.0
%b = select i1 %a, double %x, double 0.0

View File

@ -8,13 +8,13 @@ target triple = "wasm32-unknown-unknown"
; This tests very minimal fast-isel functionality.
; CHECK-LABEL: immediate_f32:
; CHECK: f32.const $push, 0x1.4p1{{$}}
; CHECK: f32.const $push{{[0-9]+}}, 0x1.4p1{{$}}
define float @immediate_f32() {
ret float 2.5
}
; CHECK-LABEL: immediate_f64:
; CHECK: f64.const $push, 0x1.4p1{{$}}
; CHECK: f64.const $push{{[0-9]+}}, 0x1.4p1{{$}}
define double @immediate_f64() {
ret double 2.5
}

View File

@ -14,10 +14,8 @@ define void @f0() {
; CHECK-LABEL: f1:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: i32.const $push, 0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]], 0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
; CHECK: .size f1,
define i32 @f1() {
ret i32 0
@ -27,10 +25,8 @@ define i32 @f1() {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: i32.const $push, 0{{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]], 0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
; CHECK: .size f2,
define i32 @f2(i32 %p1, float %p2) {
ret i32 0

View File

@ -10,7 +10,9 @@ target triple = "wasm32-unknown-unknown"
@llvm.used = appending global [1 x i32*] [i32* @g], section "llvm.metadata"
; CHECK: foo:
; CHECK: i32.const $push, answer
; CHECK: i32.const $push0, answer{{$}}
; CHECK-NEXT: i32.load $0, $pop0{{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @foo() {
%a = load i32, i32* @answer
ret i32 %a

View File

@ -13,10 +13,8 @@ declare i32 @llvm.ctpop.i32(i32)
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.add $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.add $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @add32(i32 %x, i32 %y) {
%a = add i32 %x, %y
ret i32 %a
@ -26,10 +24,8 @@ define i32 @add32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.sub $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.sub $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @sub32(i32 %x, i32 %y) {
%a = sub i32 %x, %y
ret i32 %a
@ -39,10 +35,8 @@ define i32 @sub32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.mul $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.mul $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @mul32(i32 %x, i32 %y) {
%a = mul i32 %x, %y
ret i32 %a
@ -52,10 +46,8 @@ define i32 @mul32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.div_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.div_s $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @sdiv32(i32 %x, i32 %y) {
%a = sdiv i32 %x, %y
ret i32 %a
@ -65,10 +57,8 @@ define i32 @sdiv32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.div_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.div_u $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @udiv32(i32 %x, i32 %y) {
%a = udiv i32 %x, %y
ret i32 %a
@ -78,10 +68,8 @@ define i32 @udiv32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.rem_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.rem_s $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @srem32(i32 %x, i32 %y) {
%a = srem i32 %x, %y
ret i32 %a
@ -91,10 +79,8 @@ define i32 @srem32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.rem_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.rem_u $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @urem32(i32 %x, i32 %y) {
%a = urem i32 %x, %y
ret i32 %a
@ -104,10 +90,8 @@ define i32 @urem32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.and $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.and $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @and32(i32 %x, i32 %y) {
%a = and i32 %x, %y
ret i32 %a
@ -117,10 +101,8 @@ define i32 @and32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.or $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.or $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @or32(i32 %x, i32 %y) {
%a = or i32 %x, %y
ret i32 %a
@ -130,10 +112,8 @@ define i32 @or32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.xor $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.xor $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @xor32(i32 %x, i32 %y) {
%a = xor i32 %x, %y
ret i32 %a
@ -143,10 +123,8 @@ define i32 @xor32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.shl $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.shl $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @shl32(i32 %x, i32 %y) {
%a = shl i32 %x, %y
ret i32 %a
@ -156,10 +134,8 @@ define i32 @shl32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.shr_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.shr_u $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @shr32(i32 %x, i32 %y) {
%a = lshr i32 %x, %y
ret i32 %a
@ -169,10 +145,8 @@ define i32 @shr32(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.shr_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.shr_s $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @sar32(i32 %x, i32 %y) {
%a = ashr i32 %x, %y
ret i32 %a
@ -181,10 +155,8 @@ define i32 @sar32(i32 %x, i32 %y) {
; CHECK-LABEL: clz32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.clz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.clz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @clz32(i32 %x) {
%a = call i32 @llvm.ctlz.i32(i32 %x, i1 false)
ret i32 %a
@ -193,10 +165,8 @@ define i32 @clz32(i32 %x) {
; CHECK-LABEL: clz32_zero_undef:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.clz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.clz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @clz32_zero_undef(i32 %x) {
%a = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
ret i32 %a
@ -205,10 +175,8 @@ define i32 @clz32_zero_undef(i32 %x) {
; CHECK-LABEL: ctz32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.ctz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.ctz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @ctz32(i32 %x) {
%a = call i32 @llvm.cttz.i32(i32 %x, i1 false)
ret i32 %a
@ -217,10 +185,8 @@ define i32 @ctz32(i32 %x) {
; CHECK-LABEL: ctz32_zero_undef:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.ctz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.ctz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @ctz32_zero_undef(i32 %x) {
%a = call i32 @llvm.cttz.i32(i32 %x, i1 true)
ret i32 %a
@ -229,10 +195,8 @@ define i32 @ctz32_zero_undef(i32 %x) {
; CHECK-LABEL: popcnt32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.popcnt $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.popcnt $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i32 @popcnt32(i32 %x) {
%a = call i32 @llvm.ctpop.i32(i32 %x)
ret i32 %a

View File

@ -13,10 +13,8 @@ declare i64 @llvm.ctpop.i64(i64)
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.add $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.add $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @add64(i64 %x, i64 %y) {
%a = add i64 %x, %y
ret i64 %a
@ -26,10 +24,8 @@ define i64 @add64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.sub $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.sub $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @sub64(i64 %x, i64 %y) {
%a = sub i64 %x, %y
ret i64 %a
@ -39,10 +35,8 @@ define i64 @sub64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.mul $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.mul $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @mul64(i64 %x, i64 %y) {
%a = mul i64 %x, %y
ret i64 %a
@ -52,10 +46,8 @@ define i64 @mul64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.div_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.div_s $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @sdiv64(i64 %x, i64 %y) {
%a = sdiv i64 %x, %y
ret i64 %a
@ -65,10 +57,8 @@ define i64 @sdiv64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.div_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.div_u $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @udiv64(i64 %x, i64 %y) {
%a = udiv i64 %x, %y
ret i64 %a
@ -78,10 +68,8 @@ define i64 @udiv64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.rem_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.rem_s $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @srem64(i64 %x, i64 %y) {
%a = srem i64 %x, %y
ret i64 %a
@ -91,10 +79,8 @@ define i64 @srem64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.rem_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.rem_u $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @urem64(i64 %x, i64 %y) {
%a = urem i64 %x, %y
ret i64 %a
@ -104,10 +90,8 @@ define i64 @urem64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.and $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.and $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @and64(i64 %x, i64 %y) {
%a = and i64 %x, %y
ret i64 %a
@ -117,10 +101,8 @@ define i64 @and64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.or $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.or $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @or64(i64 %x, i64 %y) {
%a = or i64 %x, %y
ret i64 %a
@ -130,10 +112,8 @@ define i64 @or64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.xor $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.xor $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @xor64(i64 %x, i64 %y) {
%a = xor i64 %x, %y
ret i64 %a
@ -143,10 +123,8 @@ define i64 @xor64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.shl $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.shl $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @shl64(i64 %x, i64 %y) {
%a = shl i64 %x, %y
ret i64 %a
@ -156,10 +134,8 @@ define i64 @shl64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.shr_u $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.shr_u $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @shr64(i64 %x, i64 %y) {
%a = lshr i64 %x, %y
ret i64 %a
@ -169,10 +145,8 @@ define i64 @shr64(i64 %x, i64 %y) {
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64, i64{{$}}
; CHECK-NEXT: i64.shr_s $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i64.shr_s $push0, $0, $1{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @sar64(i64 %x, i64 %y) {
%a = ashr i64 %x, %y
ret i64 %a
@ -181,10 +155,8 @@ define i64 @sar64(i64 %x, i64 %y) {
; CHECK-LABEL: clz64:
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64{{$}}
; CHECK-NEXT: i64.clz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.clz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @clz64(i64 %x) {
%a = call i64 @llvm.ctlz.i64(i64 %x, i1 false)
ret i64 %a
@ -193,10 +165,8 @@ define i64 @clz64(i64 %x) {
; CHECK-LABEL: clz64_zero_undef:
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64{{$}}
; CHECK-NEXT: i64.clz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.clz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @clz64_zero_undef(i64 %x) {
%a = call i64 @llvm.ctlz.i64(i64 %x, i1 true)
ret i64 %a
@ -205,10 +175,8 @@ define i64 @clz64_zero_undef(i64 %x) {
; CHECK-LABEL: ctz64:
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64{{$}}
; CHECK-NEXT: i64.ctz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.ctz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @ctz64(i64 %x) {
%a = call i64 @llvm.cttz.i64(i64 %x, i1 false)
ret i64 %a
@ -217,10 +185,8 @@ define i64 @ctz64(i64 %x) {
; CHECK-LABEL: ctz64_zero_undef:
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64{{$}}
; CHECK-NEXT: i64.ctz $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.ctz $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @ctz64_zero_undef(i64 %x) {
%a = call i64 @llvm.cttz.i64(i64 %x, i1 true)
ret i64 %a
@ -229,10 +195,8 @@ define i64 @ctz64_zero_undef(i64 %x) {
; CHECK-LABEL: popcnt64:
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64, i64{{$}}
; CHECK-NEXT: i64.popcnt $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i64.popcnt $push0, $0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define i64 @popcnt64(i64 %x) {
%a = call i64 @llvm.ctpop.i64(i64 %x)
ret i64 %a

View File

@ -7,240 +7,192 @@ target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: zero_i32:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i32.const $push, 0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]], 0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @zero_i32() {
ret i32 0
}
; CHECK-LABEL: one_i32:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i32.const $push, 1{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]], 1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @one_i32() {
ret i32 1
}
; CHECK-LABEL: max_i32:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i32.const $push, 2147483647{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]], 2147483647{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @max_i32() {
ret i32 2147483647
}
; CHECK-LABEL: min_i32:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i32.const $push, -2147483648{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]], -2147483648{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i32 @min_i32() {
ret i32 -2147483648
}
; CHECK-LABEL: zero_i64:
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i64.const $push, 0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]], 0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @zero_i64() {
ret i64 0
}
; CHECK-LABEL: one_i64:
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i64.const $push, 1{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]], 1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @one_i64() {
ret i64 1
}
; CHECK-LABEL: max_i64:
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i64.const $push, 9223372036854775807{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]], 9223372036854775807{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @max_i64() {
ret i64 9223372036854775807
}
; CHECK-LABEL: min_i64:
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: i64.const $push, -9223372036854775808{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]], -9223372036854775808{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define i64 @min_i64() {
ret i64 -9223372036854775808
}
; CHECK-LABEL: negzero_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, -0x0p0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], -0x0p0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @negzero_f32() {
ret float -0.0
}
; CHECK-LABEL: zero_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, 0x0p0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], 0x0p0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @zero_f32() {
ret float 0.0
}
; CHECK-LABEL: one_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, 0x1p0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], 0x1p0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @one_f32() {
ret float 1.0
}
; CHECK-LABEL: two_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, 0x1p1{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], 0x1p1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @two_f32() {
ret float 2.0
}
; CHECK-LABEL: nan_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, nan
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], nan
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @nan_f32() {
ret float 0x7FF8000000000000
}
; CHECK-LABEL: negnan_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, -nan
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], -nan
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @negnan_f32() {
ret float 0xFFF8000000000000
}
; CHECK-LABEL: inf_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, infinity
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], infinity
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @inf_f32() {
ret float 0x7FF0000000000000
}
; CHECK-LABEL: neginf_f32:
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f32.const $push, -infinity
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]], -infinity
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define float @neginf_f32() {
ret float 0xFFF0000000000000
}
; CHECK-LABEL: negzero_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, -0x0p0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], -0x0p0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @negzero_f64() {
ret double -0.0
}
; CHECK-LABEL: zero_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, 0x0p0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], 0x0p0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @zero_f64() {
ret double 0.0
}
; CHECK-LABEL: one_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, 0x1p0{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], 0x1p0{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @one_f64() {
ret double 1.0
}
; CHECK-LABEL: two_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, 0x1p1{{$}}
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], 0x1p1{{$}}
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @two_f64() {
ret double 2.0
}
; CHECK-LABEL: nan_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, nan
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], nan
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @nan_f64() {
ret double 0x7FF8000000000000
}
; CHECK-LABEL: negnan_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, -nan
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], -nan
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @negnan_f64() {
ret double 0xFFF8000000000000
}
; CHECK-LABEL: inf_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, infinity
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], infinity
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @inf_f64() {
ret double 0x7FF0000000000000
}
; CHECK-LABEL: neginf_f64:
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local
; CHECK-NEXT: f64.const $push, -infinity
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]], -infinity
; CHECK-NEXT: return $pop[[NUM]]{{$}}
define double @neginf_f64() {
ret double 0xFFF0000000000000
}

View File

@ -8,11 +8,10 @@ target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: foo:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: #APP{{$}}
; CHECK-NEXT: 1 = aaa(0){{$}}
; CHECK-NEXT: $0 = aaa($0){{$}}
; CHECK-NEXT: #NO_APP{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @foo(i32 %r) {
entry:
%0 = tail call i32 asm sideeffect "$0 = aaa($1)", "=r,r"(i32 %r) #0, !srcloc !0
@ -22,9 +21,8 @@ entry:
; CHECK-LABEL: bar:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: #APP{{$}}
; CHECK-NEXT: 1 = bbb(0){{$}}
; CHECK-NEXT: $1 = bbb($0){{$}}
; CHECK-NEXT: #NO_APP{{$}}
; CHECK-NEXT: return{{$}}
define void @bar(i32* %r, i32* %s) {
@ -37,9 +35,9 @@ entry:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: #APP{{$}}
; CHECK-NEXT: 0 = ccc(42){{$}}
; CHECK-NEXT: $0 = ccc(42){{$}}
; CHECK-NEXT: #NO_APP{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @imm() {
entry:
%0 = tail call i32 asm sideeffect "$0 = ccc($1)", "=r,i"(i32 42) #0, !srcloc !2

View File

@ -6,8 +6,8 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: sext_i8_i32:
; CHECK: i32.load8_s $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i32.load8_s $0, $0{{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @sext_i8_i32(i8 *%p) {
%v = load i8, i8* %p
%e = sext i8 %v to i32
@ -15,8 +15,8 @@ define i32 @sext_i8_i32(i8 *%p) {
}
; CHECK-LABEL: zext_i8_i32:
; CHECK: i32.load8_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i32.load8_u $0, $0{{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @zext_i8_i32(i8 *%p) {
%v = load i8, i8* %p
%e = zext i8 %v to i32
@ -24,8 +24,8 @@ define i32 @zext_i8_i32(i8 *%p) {
}
; CHECK-LABEL: sext_i16_i32:
; CHECK: i32.load16_s $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i32.load16_s $0, $0{{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @sext_i16_i32(i16 *%p) {
%v = load i16, i16* %p
%e = sext i16 %v to i32
@ -33,8 +33,8 @@ define i32 @sext_i16_i32(i16 *%p) {
}
; CHECK-LABEL: zext_i16_i32:
; CHECK: i32.load16_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i32.load16_u $0, $0{{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @zext_i16_i32(i16 *%p) {
%v = load i16, i16* %p
%e = zext i16 %v to i32
@ -42,8 +42,8 @@ define i32 @zext_i16_i32(i16 *%p) {
}
; CHECK-LABEL: sext_i8_i64:
; CHECK: i64.load8_s $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i64.load8_s $1, $0{{$}}
; CHECK-NEXT: return $1{{$}}
define i64 @sext_i8_i64(i8 *%p) {
%v = load i8, i8* %p
%e = sext i8 %v to i64
@ -51,8 +51,8 @@ define i64 @sext_i8_i64(i8 *%p) {
}
; CHECK-LABEL: zext_i8_i64:
; CHECK: i64.load8_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i64.load8_u $1, $0{{$}}
; CHECK-NEXT: return $1{{$}}
define i64 @zext_i8_i64(i8 *%p) {
%v = load i8, i8* %p
%e = zext i8 %v to i64
@ -60,8 +60,8 @@ define i64 @zext_i8_i64(i8 *%p) {
}
; CHECK-LABEL: sext_i16_i64:
; CHECK: i64.load16_s $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i64.load16_s $1, $0{{$}}
; CHECK-NEXT: return $1{{$}}
define i64 @sext_i16_i64(i16 *%p) {
%v = load i16, i16* %p
%e = sext i16 %v to i64
@ -69,8 +69,8 @@ define i64 @sext_i16_i64(i16 *%p) {
}
; CHECK-LABEL: zext_i16_i64:
; CHECK: i64.load16_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i64.load16_u $1, $0{{$}}
; CHECK-NEXT: return $1{{$}}
define i64 @zext_i16_i64(i16 *%p) {
%v = load i16, i16* %p
%e = zext i16 %v to i64
@ -78,8 +78,8 @@ define i64 @zext_i16_i64(i16 *%p) {
}
; CHECK-LABEL: sext_i32_i64:
; CHECK: i64.load32_s $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK: i64.load32_s $1, $0{{$}}
; CHECK-NEXT: return $1{{$}}
define i64 @sext_i32_i64(i32 *%p) {
%v = load i32, i32* %p
%e = sext i32 %v to i64
@ -87,8 +87,8 @@ define i64 @sext_i32_i64(i32 *%p) {
}
; CHECK-LABEL: zext_i32_i64:
; CHECK: i64.load32_u $push, (get_local 0){{$}}
; CHECK: set_local 1, $pop{{$}}
; CHECK: i64.load32_u $1, $0{{$}}
; CHECK: return $1{{$}}
define i64 @zext_i32_i64(i32 *%p) {
%v = load i32, i32* %p
%e = zext i32 %v to i64

View File

@ -6,9 +6,8 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: load_u_i1_i32:
; CHECK: i32.load8_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK: i32.load8_u $[[NUM0:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $[[NUM0]]{{$}}
define i32 @load_u_i1_i32(i1* %p) {
%v = load i1, i1* %p
%e = zext i1 %v to i32
@ -16,15 +15,11 @@ define i32 @load_u_i1_i32(i1* %p) {
}
; CHECK-LABEL: load_s_i1_i32:
; CHECK: i32.load8_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: i32.const $push, 31{{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: shl $push, (get_local 1), (get_local 2){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: shr_s $push, (get_local 3), (get_local 2){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: return (get_local 4){{$}}
; CHECK: i32.load8_u $[[NUM0:[0-9]+]], $0{{$}}
; CHECK-NEXT: i32.const $[[NUM1:[0-9]+]], 31{{$}}
; CHECK-NEXT: shl $push[[NUM2:[0-9]+]], $[[NUM0]], $[[NUM1]]{{$}}
; CHECK-NEXT: shr_s $push[[NUM3:[0-9]+]], $pop[[NUM2]], $[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM3]]{{$}}
define i32 @load_s_i1_i32(i1* %p) {
%v = load i1, i1* %p
%e = sext i1 %v to i32
@ -32,9 +27,8 @@ define i32 @load_s_i1_i32(i1* %p) {
}
; CHECK-LABEL: load_u_i1_i64:
; CHECK: i64.load8_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK: i64.load8_u $[[NUM0:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $[[NUM0]]{{$}}
define i64 @load_u_i1_i64(i1* %p) {
%v = load i1, i1* %p
%e = zext i1 %v to i64
@ -42,15 +36,11 @@ define i64 @load_u_i1_i64(i1* %p) {
}
; CHECK-LABEL: load_s_i1_i64:
; CHECK: i64.load8_u $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: i64.const $push, 63{{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: shl $push, (get_local 1), (get_local 2){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: shr_s $push, (get_local 3), (get_local 2){{$}}
; CHECK-NEXT: set_local 4, $pop{{$}}
; CHECK-NEXT: return (get_local 4){{$}}
; CHECK: i64.load8_u $[[NUM0:[0-9]+]], $0{{$}}
; CHECK-NEXT: i64.const $[[NUM1:[0-9]+]], 63{{$}}
; CHECK-NEXT: shl $push[[NUM2:[0-9]+]], $[[NUM0]], $[[NUM1]]{{$}}
; CHECK-NEXT: shr_s $push[[NUM3:[0-9]+]], $pop[[NUM2]], $[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM3]]{{$}}
define i64 @load_s_i1_i64(i1* %p) {
%v = load i1, i1* %p
%e = sext i1 %v to i64
@ -58,11 +48,9 @@ define i64 @load_s_i1_i64(i1* %p) {
}
; CHECK-LABEL: store_i32_i1:
; CHECK: i32.const $push, 1{{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: i32.and $push, (get_local 1), (get_local 2){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: i32.store8 (get_local 0), (get_local 3){{$}}
; CHECK: i32.const $push[[NUM0:[0-9]+]], 1{{$}}
; CHECK-NEXT: i32.and $push[[NUM1:[0-9]+]], $1, $pop[[NUM0]]{{$}}
; CHECK-NEXT: i32.store8 $0, $pop[[NUM1]]{{$}}
define void @store_i32_i1(i1* %p, i32 %v) {
%t = trunc i32 %v to i1
store i1 %t, i1* %p
@ -70,11 +58,9 @@ define void @store_i32_i1(i1* %p, i32 %v) {
}
; CHECK-LABEL: store_i64_i1:
; CHECK: i64.const $push, 1{{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: i64.and $push, (get_local 1), (get_local 2){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: i64.store8 (get_local 0), (get_local 3){{$}}
; CHECK: i64.const $push[[NUM0:[0-9]+]], 1{{$}}
; CHECK-NEXT: i64.and $push[[NUM1:[0-9]+]], $1, $pop[[NUM0]]{{$}}
; CHECK-NEXT: i64.store8 $0, $pop[[NUM1]]{{$}}
define void @store_i64_i1(i1* %p, i64 %v) {
%t = trunc i64 %v to i1
store i1 %t, i1* %p

View File

@ -8,10 +8,8 @@ target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: ldi32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: i32.load $[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $[[NUM]]{{$}}
define i32 @ldi32(i32 *%p) {
%v = load i32, i32* %p
ret i32 %v
@ -20,10 +18,9 @@ define i32 @ldi32(i32 *%p) {
; CHECK-LABEL: ldi64:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i32, i64{{$}}
; CHECK-NEXT: i64.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: .local i64{{$}}
; CHECK-NEXT: i64.load $[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $[[NUM]]{{$}}
define i64 @ldi64(i64 *%p) {
%v = load i64, i64* %p
ret i64 %v
@ -32,10 +29,9 @@ define i64 @ldi64(i64 *%p) {
; CHECK-LABEL: ldf32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result f32{{$}}
; CHECK-NEXT: .local i32, f32{{$}}
; CHECK-NEXT: f32.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: .local f32{{$}}
; CHECK-NEXT: f32.load $[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $[[NUM]]{{$}}
define float @ldf32(float *%p) {
%v = load float, float* %p
ret float %v
@ -44,10 +40,9 @@ define float @ldf32(float *%p) {
; CHECK-LABEL: ldf64:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result f64{{$}}
; CHECK-NEXT: .local i32, f64{{$}}
; CHECK-NEXT: f64.load $push, (get_local 0){{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: .local f64{{$}}
; CHECK-NEXT: f64.load $[[NUM:[0-9]+]], $0{{$}}
; CHECK-NEXT: return $[[NUM]]{{$}}
define double @ldf64(double *%p) {
%v = load double, double* %p
ret double %v

View File

@ -11,9 +11,8 @@ declare void @llvm.wasm.grow.memory.i32(i32) nounwind
; CHECK-LABEL: memory_size:
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: memory_size
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: memory_size $0{{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @memory_size() {
%a = call i32 @llvm.wasm.memory.size.i32()
ret i32 %a
@ -21,9 +20,8 @@ define i32 @memory_size() {
; CHECK-LABEL: grow_memory:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .local i32{{$}}
; CHECK: grow_memory (get_local 0)
; CHECK-NEXT: return
; CHECK: grow_memory $0{{$}}
; CHECK-NEXT: return{{$}}
define void @grow_memory(i32 %n) {
call void @llvm.wasm.grow.memory.i32(i32 %n)
ret void

View File

@ -11,9 +11,8 @@ declare void @llvm.wasm.grow.memory.i64(i64) nounwind
; CHECK-LABEL: memory_size:
; CHECK-NEXT: .result i64{{$}}
; CHECK-NEXT: .local i64{{$}}
; CHECK-NEXT: memory_size
; CHECK-NEXT: set_local 0, $pop{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: memory_size $0{{$}}
; CHECK-NEXT: return $0{{$}}
define i64 @memory_size() {
%a = call i64 @llvm.wasm.memory.size.i64()
ret i64 %a
@ -21,9 +20,8 @@ define i64 @memory_size() {
; CHECK-LABEL: grow_memory:
; CHECK-NEXT: .param i64
; CHECK-NEXT: .local i64{{$}}
; CHECK: grow_memory (get_local 0)
; CHECK-NEXT: return
; CHECK: grow_memory $0{{$}}
; CHECK-NEXT: return{{$}}
define void @grow_memory(i64 %n) {
call void @llvm.wasm.grow.memory.i64(i64 %n)
ret void

View File

@ -8,9 +8,8 @@ target triple = "wasm32-unknown-unknown"
; Basic phi triangle.
; CHECK-LABEL: test0:
; CHECK: div_s $push, (get_local 0), (get_local 3){{$}}
; CHECK: set_local 0, $pop
; CHECK: return (get_local 0)
; CHECK: div_s $[[NUM0:[0-9]+]], $0, $pop[[NUM1:[0-9]+]]{{$}}
; CHECK: return $[[NUM0]]{{$}}
define i32 @test0(i32 %p) {
entry:
%t = icmp slt i32 %p, 0
@ -27,9 +26,9 @@ done:
; CHECK-LABEL: test1:
; CHECK: BB1_1:
; CHECK: set_local [[REG0:.*]], (get_local [[REG1:.*]])
; CHECK: set_local [[REG1]], (get_local [[REG2:.*]])
; CHECK: set_local [[REG2]], (get_local [[REG0]])
; CHECK: set_local $[[NUM0:[0-9]+]], $[[NUM1:[0-9]+]]{{$}}
; CHECK: set_local $[[NUM1]], $[[NUM2:[0-9]+]]{{$}}
; CHECK: set_local $[[NUM2]], $[[NUM0]]{{$}}
define i32 @test1(i32 %n) {
entry:
br label %loop

View File

@ -4,7 +4,7 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: return_i32:
; CHECK: return (get_local 0){{$}}
; CHECK: return $0{{$}}
define i32 @return_i32(i32 %p) {
ret i32 %p
}

View File

@ -7,9 +7,8 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: select_i32:
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
; CHECK: set_local 4, $pop
; CHECK: i32.select $push, (get_local 4), (get_local 0), (get_local 1)
; CHECK: i32.eq $push[[NUM1:[0-9]+]], $2, $pop[[NUM0:[0-9]+]]{{$}}
; CHECK: i32.select $push{{[0-9]+}}, $pop[[NUM1]], $0, $1
define i32 @select_i32(i32 %a, i32 %b, i32 %cond) {
%cc = icmp eq i32 %cond, 0
%result = select i1 %cc, i32 %a, i32 %b
@ -17,9 +16,8 @@ define i32 @select_i32(i32 %a, i32 %b, i32 %cond) {
}
; CHECK-LABEL: select_i64:
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
; CHECK: set_local 4, $pop
; CHECK: i64.select $push, (get_local 4), (get_local 0), (get_local 1)
; CHECK: i32.eq $push[[NUM1:[0-9]+]], $2, $pop[[NUM0:[0-9]+]]{{$}}
; CHECK: i64.select $push{{[0-9]+}}, $pop[[NUM1]], $0, $1
define i64 @select_i64(i64 %a, i64 %b, i32 %cond) {
%cc = icmp eq i32 %cond, 0
%result = select i1 %cc, i64 %a, i64 %b
@ -27,9 +25,8 @@ define i64 @select_i64(i64 %a, i64 %b, i32 %cond) {
}
; CHECK-LABEL: select_f32:
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
; CHECK: set_local 4, $pop
; CHECK: f32.select $push, (get_local 4), (get_local 0), (get_local 1)
; CHECK: i32.eq $push[[NUM1:[0-9]+]], $2, $pop[[NUM0:[0-9]+]]{{$}}
; CHECK: f32.select $push{{[0-9]+}}, $pop[[NUM1]], $0, $1
define float @select_f32(float %a, float %b, i32 %cond) {
%cc = icmp eq i32 %cond, 0
%result = select i1 %cc, float %a, float %b
@ -37,9 +34,8 @@ define float @select_f32(float %a, float %b, i32 %cond) {
}
; CHECK-LABEL: select_f64:
; CHECK: i32.eq $push, (get_local 2), (get_local 3)
; CHECK: set_local 4, $pop
; CHECK: f64.select $push, (get_local 4), (get_local 0), (get_local 1)
; CHECK: i32.eq $push[[NUM1:[0-9]+]], $2, $pop[[NUM0:[0-9]+]]{{$}}
; CHECK: f64.select $push{{[0-9]+}}, $pop[[NUM1]], $0, $1
define double @select_f64(double %a, double %b, i32 %cond) {
%cc = icmp eq i32 %cond, 0
%result = select i1 %cc, double %a, double %b

View File

@ -8,14 +8,11 @@ target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: z2s_func:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32, i32{{$}}
; CHECK-NEXT: i32.const $push, 24{{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: i32.shl $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: i32.shr_s $push, (get_local 2), (get_local 1){{$}}
; CHECK-NEXT: set_local 3, $pop{{$}}
; CHECK-NEXT: return (get_local 3){{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: i32.const $[[NUM0:[0-9]+]], 24{{$}}
; CHECK-NEXT: i32.shl $push[[NUM2:[0-9]+]], $0, $[[NUM0]]{{$}}
; CHECK-NEXT: i32.shr_s $push[[NUM3:[0-9]+]], $pop[[NUM2]], $[[NUM0]]{{$}}
; CHECK-NEXT: return $pop[[NUM3]]{{$}}
define signext i8 @z2s_func(i8 zeroext %t) {
ret i8 %t
}
@ -23,12 +20,9 @@ define signext i8 @z2s_func(i8 zeroext %t) {
; CHECK-LABEL: s2z_func:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32, i32, i32{{$}}
; CHECK-NEXT: i32.const $push, 255{{$}}
; CHECK-NEXT: set_local 1, $pop{{$}}
; CHECK-NEXT: i32.and $push, (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: set_local 2, $pop{{$}}
; CHECK-NEXT: return (get_local 2){{$}}
; CHECK-NEXT: i32.const $push[[NUM0:[0-9]+]], 255{{$}}
; CHECK-NEXT: i32.and $push[[NUM1:[0-9]+]], $0, $pop[[NUM0]]{{$}}
; CHECK-NEXT: return $pop[[NUM1]]{{$}}
define zeroext i8 @s2z_func(i8 signext %t) {
ret i8 %t
}
@ -36,14 +30,10 @@ define zeroext i8 @s2z_func(i8 signext %t) {
; CHECK-LABEL: z2s_call:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local i32, i32, i32, i32
; CHECK-NEXT: i32.const $push, 255
; CHECK-NEXT: set_local 1, $pop
; CHECK-NEXT: i32.and $push, (get_local 0), (get_local 1)
; CHECK-NEXT: set_local 2, $pop
; CHECK-NEXT: call z2s_func, $push, (get_local 2)
; CHECK-NEXT: set_local 3, $pop
; CHECK-NEXT: return (get_local 3)
; CHECK-NEXT: i32.const $push[[NUM0:[0-9]+]], 255{{$}}
; CHECK-NEXT: i32.and $push[[NUM1:[0-9]+]], $0, $pop[[NUM0]]{{$}}
; CHECK-NEXT: call z2s_func, $push[[NUM2:[0-9]+]], $pop[[NUM1]]{{$}}
; CHECK-NEXT: return $pop[[NUM2]]{{$}}
define i32 @z2s_call(i32 %t) {
%s = trunc i32 %t to i8
%u = call signext i8 @z2s_func(i8 zeroext %s)
@ -54,20 +44,14 @@ define i32 @z2s_call(i32 %t) {
; CHECK-LABEL: s2z_call:
; CHECK-NEXT: .param i32
; CHECK-NEXT: .result i32
; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32
; CHECK-NEXT: i32.const $push, 24
; CHECK-NEXT: set_local 1, $pop
; CHECK-NEXT: i32.shl $push, (get_local 0), (get_local 1)
; CHECK-NEXT: set_local 2, $pop
; CHECK-NEXT: i32.shr_s $push, (get_local 2), (get_local 1)
; CHECK-NEXT: set_local 3, $pop
; CHECK-NEXT: call s2z_func, $push, (get_local 3)
; CHECK-NEXT: set_local 4, $pop
; CHECK-NEXT: i32.shl $push, (get_local 4), (get_local 1)
; CHECK-NEXT: set_local 5, $pop
; CHECK-NEXT: i32.shr_s $push, (get_local 5), (get_local 1)
; CHECK-NEXT: set_local 6, $pop
; CHECK-NEXT: return (get_local 6)
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: i32.const $[[NUM0:[0-9]+]], 24{{$}}
; CHECK-NEXT: i32.shl $push[[NUM1:[0-9]+]], $0, $[[NUM0]]{{$}}
; CHECK-NEXT: i32.shr_s $push[[NUM2:[0-9]+]], $pop[[NUM1]], $[[NUM0]]{{$}}
; CHECK-NEXT: call s2z_func, $push[[NUM3:[0-9]]], $pop[[NUM2]]{{$}}
; CHECK-NEXT: i32.shl $push[[NUM4:[0-9]+]], $pop[[NUM3]], $[[NUM0]]{{$}}
; CHECK-NEXT: i32.shr_s $push[[NUM5:[0-9]+]], $pop[[NUM4]], $[[NUM0]]{{$}}
; CHECK-NEXT: return $pop[[NUM5]]{{$}}
define i32 @s2z_call(i32 %t) {
%s = trunc i32 %t to i8
%u = call zeroext i8 @s2z_func(i8 signext %s)

View File

@ -6,7 +6,7 @@ target datalayout = "e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: trunc_i8_i32:
; CHECK: i32.store8 (get_local 0), (get_local 1){{$}}
; CHECK: i32.store8 $0, $1{{$}}
define void @trunc_i8_i32(i8 *%p, i32 %v) {
%t = trunc i32 %v to i8
store i8 %t, i8* %p
@ -14,7 +14,7 @@ define void @trunc_i8_i32(i8 *%p, i32 %v) {
}
; CHECK-LABEL: trunc_i16_i32:
; CHECK: i32.store16 (get_local 0), (get_local 1){{$}}
; CHECK: i32.store16 $0, $1{{$}}
define void @trunc_i16_i32(i16 *%p, i32 %v) {
%t = trunc i32 %v to i16
store i16 %t, i16* %p
@ -22,7 +22,7 @@ define void @trunc_i16_i32(i16 *%p, i32 %v) {
}
; CHECK-LABEL: trunc_i8_i64:
; CHECK: i64.store8 (get_local 0), (get_local 1){{$}}
; CHECK: i64.store8 $0, $1{{$}}
define void @trunc_i8_i64(i8 *%p, i64 %v) {
%t = trunc i64 %v to i8
store i8 %t, i8* %p
@ -30,7 +30,7 @@ define void @trunc_i8_i64(i8 *%p, i64 %v) {
}
; CHECK-LABEL: trunc_i16_i64:
; CHECK: i64.store16 (get_local 0), (get_local 1){{$}}
; CHECK: i64.store16 $0, $1{{$}}
define void @trunc_i16_i64(i16 *%p, i64 %v) {
%t = trunc i64 %v to i16
store i16 %t, i16* %p
@ -38,7 +38,7 @@ define void @trunc_i16_i64(i16 *%p, i64 %v) {
}
; CHECK-LABEL: trunc_i32_i64:
; CHECK: i64.store32 (get_local 0), (get_local 1){{$}}
; CHECK: i64.store32 $0, $1{{$}}
define void @trunc_i32_i64(i32 *%p, i64 %v) {
%t = trunc i64 %v to i32
store i32 %t, i32* %p

View File

@ -8,8 +8,7 @@ target triple = "wasm32-unknown-unknown"
; CHECK-LABEL: sti32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .local i32, i32{{$}}
; CHECK-NEXT: i32.store (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: i32.store $0, $1{{$}}
; CHECK-NEXT: return{{$}}
define void @sti32(i32 *%p, i32 %v) {
store i32 %v, i32* %p
@ -19,8 +18,7 @@ define void @sti32(i32 *%p, i32 %v) {
; CHECK-LABEL: sti64:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i64{{$}}
; CHECK-NEXT: .local i64, i32{{$}}
; CHECK-NEXT: i64.store (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: i64.store $0, $1{{$}}
; CHECK-NEXT: return{{$}}
define void @sti64(i64 *%p, i64 %v) {
store i64 %v, i64* %p
@ -30,8 +28,7 @@ define void @sti64(i64 *%p, i64 %v) {
; CHECK-LABEL: stf32:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param f32{{$}}
; CHECK-NEXT: .local f32, i32{{$}}
; CHECK-NEXT: f32.store (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: f32.store $0, $1{{$}}
; CHECK-NEXT: return{{$}}
define void @stf32(float *%p, float %v) {
store float %v, float* %p
@ -41,8 +38,7 @@ define void @stf32(float *%p, float %v) {
; CHECK-LABEL: stf64:
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param f64{{$}}
; CHECK-NEXT: .local f64, i32{{$}}
; CHECK-NEXT: f64.store (get_local 0), (get_local 1){{$}}
; CHECK-NEXT: f64.store $0, $1{{$}}
; CHECK-NEXT: return{{$}}
define void @stf64(double *%p, double %v) {
store double %v, double* %p

View File

@ -9,8 +9,7 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: return (get_local 1){{$}}
; CHECK-NEXT: return $1{{$}}
define i32 @unused_first(i32 %x, i32 %y) {
ret i32 %y
}
@ -19,8 +18,7 @@ define i32 @unused_first(i32 %x, i32 %y) {
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .param i32{{$}}
; CHECK-NEXT: .result i32{{$}}
; CHECK-NEXT: .local i32{{$}}
; CHECK-NEXT: return (get_local 0){{$}}
; CHECK-NEXT: return $0{{$}}
define i32 @unused_second(i32 %x, i32 %y) {
ret i32 %x
}