(Trunc16to8 x) -> x
// Lowering float <-> int
-(Cvt32to32F x) -> (LoweredRound32F (F64ConvertSI64 (SignExt32to64 x)))
-(Cvt32to64F x) -> (F64ConvertSI64 (SignExt32to64 x))
-(Cvt64to32F x) -> (LoweredRound32F (F64ConvertSI64 x))
-(Cvt64to64F x) -> (F64ConvertSI64 x)
-(Cvt32Uto32F x) -> (LoweredRound32F (F64ConvertUI64 (ZeroExt32to64 x)))
-(Cvt32Uto64F x) -> (F64ConvertUI64 (ZeroExt32to64 x))
-(Cvt64Uto32F x) -> (LoweredRound32F (F64ConvertUI64 x))
-(Cvt64Uto64F x) -> (F64ConvertUI64 x)
-
-(Cvt32Fto32 x) -> (I64TruncSF64 x)
-(Cvt32Fto64 x) -> (I64TruncSF64 x)
-(Cvt64Fto32 x) -> (I64TruncSF64 x)
-(Cvt64Fto64 x) -> (I64TruncSF64 x)
-(Cvt32Fto32U x) -> (I64TruncUF64 x)
-(Cvt32Fto64U x) -> (I64TruncUF64 x)
-(Cvt64Fto32U x) -> (I64TruncUF64 x)
-(Cvt64Fto64U x) -> (I64TruncUF64 x)
+(Cvt32to32F x) -> (LoweredRound32F (F64ConvertI64S (SignExt32to64 x)))
+(Cvt32to64F x) -> (F64ConvertI64S (SignExt32to64 x))
+(Cvt64to32F x) -> (LoweredRound32F (F64ConvertI64S x))
+(Cvt64to64F x) -> (F64ConvertI64S x)
+(Cvt32Uto32F x) -> (LoweredRound32F (F64ConvertI64U (ZeroExt32to64 x)))
+(Cvt32Uto64F x) -> (F64ConvertI64U (ZeroExt32to64 x))
+(Cvt64Uto32F x) -> (LoweredRound32F (F64ConvertI64U x))
+(Cvt64Uto64F x) -> (F64ConvertI64U x)
+
+(Cvt32Fto32 x) -> (I64TruncF64S x)
+(Cvt32Fto64 x) -> (I64TruncF64S x)
+(Cvt64Fto32 x) -> (I64TruncF64S x)
+(Cvt64Fto64 x) -> (I64TruncF64S x)
+(Cvt32Fto32U x) -> (I64TruncF64U x)
+(Cvt32Fto64U x) -> (I64TruncF64U x)
+(Cvt64Fto32U x) -> (I64TruncF64U x)
+(Cvt64Fto64U x) -> (I64TruncF64U x)
(Cvt32Fto64F x) -> x
(Cvt64Fto32F x) -> (LoweredRound32F x)
{name: "F64Mul", asm: "F64Mul", argLength: 2, reg: fp21, typ: "Float64"}, // arg0 * arg1
{name: "F64Div", asm: "F64Div", argLength: 2, reg: fp21, typ: "Float64"}, // arg0 / arg1
- {name: "I64TruncSF64", asm: "I64TruncSF64", argLength: 1, reg: regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}, typ: "Int64"}, // truncates the float arg0 to a signed integer
- {name: "I64TruncUF64", asm: "I64TruncUF64", argLength: 1, reg: regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}, typ: "Int64"}, // truncates the float arg0 to an unsigned integer
- {name: "F64ConvertSI64", asm: "F64ConvertSI64", argLength: 1, reg: regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}, typ: "Float64"}, // converts the signed integer arg0 to a float
- {name: "F64ConvertUI64", asm: "F64ConvertUI64", argLength: 1, reg: regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}, typ: "Float64"}, // converts the unsigned integer arg0 to a float
+ {name: "I64TruncF64S", asm: "I64TruncF64S", argLength: 1, reg: regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}, typ: "Int64"}, // truncates the float arg0 to a signed integer
+ {name: "I64TruncF64U", asm: "I64TruncF64U", argLength: 1, reg: regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}, typ: "Int64"}, // truncates the float arg0 to an unsigned integer
+ {name: "F64ConvertI64S", asm: "F64ConvertI64S", argLength: 1, reg: regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}, typ: "Float64"}, // converts the signed integer arg0 to a float
+ {name: "F64ConvertI64U", asm: "F64ConvertI64U", argLength: 1, reg: regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}, typ: "Float64"}, // converts the unsigned integer arg0 to a float
}
archs = append(archs, arch{
OpWasmF64Sub
OpWasmF64Mul
OpWasmF64Div
- OpWasmI64TruncSF64
- OpWasmI64TruncUF64
- OpWasmF64ConvertSI64
- OpWasmF64ConvertUI64
+ OpWasmI64TruncF64S
+ OpWasmI64TruncF64U
+ OpWasmF64ConvertI64S
+ OpWasmF64ConvertI64U
OpAdd8
OpAdd16
},
},
{
- name: "I64TruncSF64",
+ name: "I64TruncF64S",
argLen: 1,
- asm: wasm.AI64TruncSF64,
+ asm: wasm.AI64TruncF64S,
reg: regInfo{
inputs: []inputInfo{
{0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
{
- name: "I64TruncUF64",
+ name: "I64TruncF64U",
argLen: 1,
- asm: wasm.AI64TruncUF64,
+ asm: wasm.AI64TruncF64U,
reg: regInfo{
inputs: []inputInfo{
{0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
{
- name: "F64ConvertSI64",
+ name: "F64ConvertI64S",
argLen: 1,
- asm: wasm.AF64ConvertSI64,
+ asm: wasm.AF64ConvertI64S,
reg: regInfo{
inputs: []inputInfo{
{0, 65535}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
},
},
{
- name: "F64ConvertUI64",
+ name: "F64ConvertI64U",
argLen: 1,
- asm: wasm.AF64ConvertUI64,
+ asm: wasm.AF64ConvertI64U,
reg: regInfo{
inputs: []inputInfo{
{0, 65535}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
func rewriteValueWasm_OpCvt32Fto32_0(v *Value) bool {
// match: (Cvt32Fto32 x)
// cond:
- // result: (I64TruncSF64 x)
+ // result: (I64TruncF64S x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncSF64)
+ v.reset(OpWasmI64TruncF64S)
v.AddArg(x)
return true
}
func rewriteValueWasm_OpCvt32Fto32U_0(v *Value) bool {
// match: (Cvt32Fto32U x)
// cond:
- // result: (I64TruncUF64 x)
+ // result: (I64TruncF64U x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncUF64)
+ v.reset(OpWasmI64TruncF64U)
v.AddArg(x)
return true
}
func rewriteValueWasm_OpCvt32Fto64_0(v *Value) bool {
// match: (Cvt32Fto64 x)
// cond:
- // result: (I64TruncSF64 x)
+ // result: (I64TruncF64S x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncSF64)
+ v.reset(OpWasmI64TruncF64S)
v.AddArg(x)
return true
}
func rewriteValueWasm_OpCvt32Fto64U_0(v *Value) bool {
// match: (Cvt32Fto64U x)
// cond:
- // result: (I64TruncUF64 x)
+ // result: (I64TruncF64U x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncUF64)
+ v.reset(OpWasmI64TruncF64U)
v.AddArg(x)
return true
}
_ = typ
// match: (Cvt32Uto32F x)
// cond:
- // result: (LoweredRound32F (F64ConvertUI64 (ZeroExt32to64 x)))
+ // result: (LoweredRound32F (F64ConvertI64U (ZeroExt32to64 x)))
for {
x := v.Args[0]
v.reset(OpWasmLoweredRound32F)
- v0 := b.NewValue0(v.Pos, OpWasmF64ConvertUI64, typ.Float64)
+ v0 := b.NewValue0(v.Pos, OpWasmF64ConvertI64U, typ.Float64)
v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
v1.AddArg(x)
v0.AddArg(v1)
_ = typ
// match: (Cvt32Uto64F x)
// cond:
- // result: (F64ConvertUI64 (ZeroExt32to64 x))
+ // result: (F64ConvertI64U (ZeroExt32to64 x))
for {
x := v.Args[0]
- v.reset(OpWasmF64ConvertUI64)
+ v.reset(OpWasmF64ConvertI64U)
v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
v0.AddArg(x)
v.AddArg(v0)
_ = typ
// match: (Cvt32to32F x)
// cond:
- // result: (LoweredRound32F (F64ConvertSI64 (SignExt32to64 x)))
+ // result: (LoweredRound32F (F64ConvertI64S (SignExt32to64 x)))
for {
x := v.Args[0]
v.reset(OpWasmLoweredRound32F)
- v0 := b.NewValue0(v.Pos, OpWasmF64ConvertSI64, typ.Float64)
+ v0 := b.NewValue0(v.Pos, OpWasmF64ConvertI64S, typ.Float64)
v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
v1.AddArg(x)
v0.AddArg(v1)
_ = typ
// match: (Cvt32to64F x)
// cond:
- // result: (F64ConvertSI64 (SignExt32to64 x))
+ // result: (F64ConvertI64S (SignExt32to64 x))
for {
x := v.Args[0]
- v.reset(OpWasmF64ConvertSI64)
+ v.reset(OpWasmF64ConvertI64S)
v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
v0.AddArg(x)
v.AddArg(v0)
func rewriteValueWasm_OpCvt64Fto32_0(v *Value) bool {
// match: (Cvt64Fto32 x)
// cond:
- // result: (I64TruncSF64 x)
+ // result: (I64TruncF64S x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncSF64)
+ v.reset(OpWasmI64TruncF64S)
v.AddArg(x)
return true
}
func rewriteValueWasm_OpCvt64Fto32U_0(v *Value) bool {
// match: (Cvt64Fto32U x)
// cond:
- // result: (I64TruncUF64 x)
+ // result: (I64TruncF64U x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncUF64)
+ v.reset(OpWasmI64TruncF64U)
v.AddArg(x)
return true
}
func rewriteValueWasm_OpCvt64Fto64_0(v *Value) bool {
// match: (Cvt64Fto64 x)
// cond:
- // result: (I64TruncSF64 x)
+ // result: (I64TruncF64S x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncSF64)
+ v.reset(OpWasmI64TruncF64S)
v.AddArg(x)
return true
}
func rewriteValueWasm_OpCvt64Fto64U_0(v *Value) bool {
// match: (Cvt64Fto64U x)
// cond:
- // result: (I64TruncUF64 x)
+ // result: (I64TruncF64U x)
for {
x := v.Args[0]
- v.reset(OpWasmI64TruncUF64)
+ v.reset(OpWasmI64TruncF64U)
v.AddArg(x)
return true
}
_ = typ
// match: (Cvt64Uto32F x)
// cond:
- // result: (LoweredRound32F (F64ConvertUI64 x))
+ // result: (LoweredRound32F (F64ConvertI64U x))
for {
x := v.Args[0]
v.reset(OpWasmLoweredRound32F)
- v0 := b.NewValue0(v.Pos, OpWasmF64ConvertUI64, typ.Float64)
+ v0 := b.NewValue0(v.Pos, OpWasmF64ConvertI64U, typ.Float64)
v0.AddArg(x)
v.AddArg(v0)
return true
func rewriteValueWasm_OpCvt64Uto64F_0(v *Value) bool {
// match: (Cvt64Uto64F x)
// cond:
- // result: (F64ConvertUI64 x)
+ // result: (F64ConvertI64U x)
for {
x := v.Args[0]
- v.reset(OpWasmF64ConvertUI64)
+ v.reset(OpWasmF64ConvertI64U)
v.AddArg(x)
return true
}
_ = typ
// match: (Cvt64to32F x)
// cond:
- // result: (LoweredRound32F (F64ConvertSI64 x))
+ // result: (LoweredRound32F (F64ConvertI64S x))
for {
x := v.Args[0]
v.reset(OpWasmLoweredRound32F)
- v0 := b.NewValue0(v.Pos, OpWasmF64ConvertSI64, typ.Float64)
+ v0 := b.NewValue0(v.Pos, OpWasmF64ConvertI64S, typ.Float64)
v0.AddArg(x)
v.AddArg(v0)
return true
func rewriteValueWasm_OpCvt64to64F_0(v *Value) bool {
// match: (Cvt64to64F x)
// cond:
- // result: (F64ConvertSI64 x)
+ // result: (F64ConvertI64S x)
for {
x := v.Args[0]
- v.reset(OpWasmF64ConvertSI64)
+ v.reset(OpWasmF64ConvertI64S)
v.AddArg(x)
return true
}
case ssa.OpWasmI64Eqz:
getValue64(s, v.Args[0])
s.Prog(v.Op.Asm())
- s.Prog(wasm.AI64ExtendUI32)
+ s.Prog(wasm.AI64ExtendI32U)
case ssa.OpWasmI64Eq, ssa.OpWasmI64Ne, ssa.OpWasmI64LtS, ssa.OpWasmI64LtU, ssa.OpWasmI64GtS, ssa.OpWasmI64GtU, ssa.OpWasmI64LeS, ssa.OpWasmI64LeU, ssa.OpWasmI64GeS, ssa.OpWasmI64GeU, ssa.OpWasmF64Eq, ssa.OpWasmF64Ne, ssa.OpWasmF64Lt, ssa.OpWasmF64Gt, ssa.OpWasmF64Le, ssa.OpWasmF64Ge:
getValue64(s, v.Args[0])
getValue64(s, v.Args[1])
s.Prog(v.Op.Asm())
- s.Prog(wasm.AI64ExtendUI32)
+ s.Prog(wasm.AI64ExtendI32U)
case ssa.OpWasmI64Add, ssa.OpWasmI64Sub, ssa.OpWasmI64Mul, ssa.OpWasmI64DivU, ssa.OpWasmI64RemS, ssa.OpWasmI64RemU, ssa.OpWasmI64And, ssa.OpWasmI64Or, ssa.OpWasmI64Xor, ssa.OpWasmI64Shl, ssa.OpWasmI64ShrS, ssa.OpWasmI64ShrU, ssa.OpWasmF64Add, ssa.OpWasmF64Sub, ssa.OpWasmF64Mul, ssa.OpWasmF64Div:
getValue64(s, v.Args[0])
}
s.Prog(wasm.AI64DivS)
- case ssa.OpWasmI64TruncSF64:
+ case ssa.OpWasmI64TruncF64S:
getValue64(s, v.Args[0])
p := s.Prog(wasm.ACall)
p.To = obj.Addr{Type: obj.TYPE_MEM, Name: obj.NAME_EXTERN, Sym: gc.WasmTruncS}
- case ssa.OpWasmI64TruncUF64:
+ case ssa.OpWasmI64TruncF64U:
getValue64(s, v.Args[0])
p := s.Prog(wasm.ACall)
p.To = obj.Addr{Type: obj.TYPE_MEM, Name: obj.NAME_EXTERN, Sym: gc.WasmTruncU}
- case ssa.OpWasmF64Neg, ssa.OpWasmF64ConvertSI64, ssa.OpWasmF64ConvertUI64:
+ case ssa.OpWasmF64Neg, ssa.OpWasmF64ConvertI64S, ssa.OpWasmF64ConvertI64U:
getValue64(s, v.Args[0])
s.Prog(v.Op.Asm())
reg := v.Reg()
getReg(s, reg)
if reg == wasm.REG_SP {
- s.Prog(wasm.AI64ExtendUI32)
+ s.Prog(wasm.AI64ExtendI32U)
}
}
AF64Copysign
AI32WrapI64
- AI32TruncSF32
- AI32TruncUF32
- AI32TruncSF64
- AI32TruncUF64
- AI64ExtendSI32
- AI64ExtendUI32
- AI64TruncSF32
- AI64TruncUF32
- AI64TruncSF64
- AI64TruncUF64
- AF32ConvertSI32
- AF32ConvertUI32
- AF32ConvertSI64
- AF32ConvertUI64
+ AI32TruncF32S
+ AI32TruncF32U
+ AI32TruncF64S
+ AI32TruncF64U
+ AI64ExtendI32S
+ AI64ExtendI32U
+ AI64TruncF32S
+ AI64TruncF32U
+ AI64TruncF64S
+ AI64TruncF64U
+ AF32ConvertI32S
+ AF32ConvertI32U
+ AF32ConvertI64S
+ AF32ConvertI64U
AF32DemoteF64
- AF64ConvertSI32
- AF64ConvertUI32
- AF64ConvertSI64
- AF64ConvertUI64
+ AF64ConvertI32S
+ AF64ConvertI32U
+ AF64ConvertI64S
+ AF64ConvertI64U
AF64PromoteF32
AI32ReinterpretF32
AI64ReinterpretF64
"F64Max",
"F64Copysign",
"I32WrapI64",
- "I32TruncSF32",
- "I32TruncUF32",
- "I32TruncSF64",
- "I32TruncUF64",
- "I64ExtendSI32",
- "I64ExtendUI32",
- "I64TruncSF32",
- "I64TruncUF32",
- "I64TruncSF64",
- "I64TruncUF64",
- "F32ConvertSI32",
- "F32ConvertUI32",
- "F32ConvertSI64",
- "F32ConvertUI64",
+ "I32TruncF32S",
+ "I32TruncF32U",
+ "I32TruncF64S",
+ "I32TruncF64U",
+ "I64ExtendI32S",
+ "I64ExtendI32U",
+ "I64TruncF32S",
+ "I64TruncF32U",
+ "I64TruncF64S",
+ "I64TruncF64U",
+ "F32ConvertI32S",
+ "F32ConvertI32U",
+ "F32ConvertI64S",
+ "F32ConvertI64U",
"F32DemoteF64",
- "F64ConvertSI32",
- "F64ConvertUI32",
- "F64ConvertSI64",
- "F64ConvertUI64",
+ "F64ConvertI32S",
+ "F64ConvertI32U",
+ "F64ConvertI64S",
+ "F64ConvertI64U",
"F64PromoteF32",
"I32ReinterpretF32",
"I64ReinterpretF64",
// Not
// If
// Get SP
- // I64ExtendUI32
+ // I64ExtendI32U
// I64Const $framesize+8
// I64Add
// I64Load panic_argp(R0)
p = appendp(p, AIf)
p = appendp(p, AGet, regAddr(REG_SP))
- p = appendp(p, AI64ExtendUI32)
+ p = appendp(p, AI64ExtendI32U)
p = appendp(p, AI64Const, constAddr(framesize+8))
p = appendp(p, AI64Add)
p = appendp(p, AI64Load, panicargp)
case obj.NAME_AUTO, obj.NAME_PARAM:
p = appendp(p, AGet, regAddr(get.From.Reg))
if get.From.Reg == REG_SP {
- p = appendp(p, AI64ExtendUI32)
+ p = appendp(p, AI64ExtendI32U)
}
if get.From.Offset != 0 {
p = appendp(p, AI64Const, constAddr(get.From.Offset))
case obj.NAME_NONE, obj.NAME_PARAM, obj.NAME_AUTO:
p = appendp(p, AGet, regAddr(mov.From.Reg))
if mov.From.Reg == REG_SP {
- p = appendp(p, AI64ExtendUI32)
+ p = appendp(p, AI64ExtendI32U)
}
p = appendp(p, AI64Const, constAddr(mov.From.Offset))
p = appendp(p, AI64Add)
case obj.TYPE_REG:
p = appendp(p, AGet, mov.From)
if mov.From.Reg == REG_SP {
- p = appendp(p, AI64ExtendUI32)
+ p = appendp(p, AI64ExtendI32U)
}
case obj.TYPE_MEM:
reg := p.From.Reg
switch {
case reg >= REG_PC_F && reg <= REG_PAUSE:
- w.WriteByte(0x23) // get_global
+ w.WriteByte(0x23) // global.get
writeUleb128(w, uint64(reg-REG_PC_F))
case reg >= REG_R0 && reg <= REG_R15:
- w.WriteByte(0x20) // get_local (i64)
+ w.WriteByte(0x20) // local.get (i64)
writeUleb128(w, uint64(reg-REG_R0))
case reg >= REG_F0 && reg <= REG_F15:
- w.WriteByte(0x20) // get_local (f64)
+ w.WriteByte(0x20) // local.get (f64)
writeUleb128(w, uint64(numI+(reg-REG_F0)))
default:
panic("bad Get: invalid register")
reg := p.To.Reg
switch {
case reg >= REG_PC_F && reg <= REG_PAUSE:
- w.WriteByte(0x24) // set_global
+ w.WriteByte(0x24) // global.set
writeUleb128(w, uint64(reg-REG_PC_F))
case reg >= REG_R0 && reg <= REG_F15:
if p.Link.As == AGet && p.Link.From.Reg == reg {
- w.WriteByte(0x22) // tee_local
+ w.WriteByte(0x22) // local.tee
p = p.Link
} else {
- w.WriteByte(0x21) // set_local
+ w.WriteByte(0x21) // local.set
}
if reg <= REG_R15 {
writeUleb128(w, uint64(reg-REG_R0))
reg := p.To.Reg
switch {
case reg >= REG_R0 && reg <= REG_R15:
- w.WriteByte(0x22) // tee_local (i64)
+ w.WriteByte(0x22) // local.tee (i64)
writeUleb128(w, uint64(reg-REG_R0))
case reg >= REG_F0 && reg <= REG_F15:
- w.WriteByte(0x22) // tee_local (f64)
+ w.WriteByte(0x22) // local.tee (f64)
writeUleb128(w, uint64(numI+(reg-REG_F0)))
default:
panic("bad Tee: invalid register")
Get R4
I32WrapI64
Call memcmp<>(SB)
- I64ExtendSI32
+ I64ExtendI32S
Set R5
Get R5
I64Load b_len+8(FP)
I32WrapI64
Call memchr<>(SB)
- I64ExtendSI32
+ I64ExtendI32S
Set R0
Get SP
I64Load s_len+8(FP)
I32WrapI64
Call memchr<>(SB)
- I64ExtendSI32
+ I64ExtendI32S
Set R0
I64Const $-1
Get SP
Get SP
- I64ExtendUI32
+ I64ExtendI32U
I64Const $argframe+0(FP)
I64Add
I64Store $8
Get SP
Get SP
- I64ExtendUI32
+ I64ExtendI32U
I64Const $argframe+0(FP)
I64Add
I64Store $8
Set RET1; \
\
Get SP; \
- I64ExtendUI32; \
+ I64ExtendI32U; \
Get R0; \
I64Add; \
Set RET2; \
Get SP
Get R0 // argc
- I64ExtendUI32
+ I64ExtendI32U
I64Store $0
Get SP
Get R1 // argv
- I64ExtendUI32
+ I64ExtendI32U
I64Store $8
I32Const $runtime·rt0_go(SB)
End
Get R0
- I64TruncSF64
+ I64TruncF64S
Return
TEXT runtime·wasmTruncU(SB), NOSPLIT, $0-0
End
Get R0
- I64TruncUF64
+ I64TruncF64U
Return
TEXT runtime·exitThread(SB), NOSPLIT, $0-0