all: rename WebAssembly instructions according to spec changes

The names of some instructions have been updated in the WebAssembly
specification to be more consistent, see
994591e51c.
This change to the spec is possible because it is still in a draft
state.

Go's support for WebAssembly is still experimental and thus excempt from
the compatibility promise. Being consistent with the spec should
warrant this breaking change to the assembly instruction names.

Change-Id: Iafb8b18ee7f55dd0e23c6c7824aa1fad43117ef1
Reviewed-on: https://go-review.googlesource.com/c/153797
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Richard Musiol 2018-12-12 13:04:44 +01:00 committed by Richard Musiol
parent 159b2de442
commit c0d82bb0ec
14 changed files with 129 additions and 129 deletions

View file

@ -72,23 +72,23 @@
(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)
(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) -> (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)
(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)

View file

@ -187,10 +187,10 @@ func init() {
{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{

View file

@ -2075,10 +2075,10 @@ const (
OpWasmF64Sub
OpWasmF64Mul
OpWasmF64Div
OpWasmI64TruncSF64
OpWasmI64TruncUF64
OpWasmF64ConvertSI64
OpWasmF64ConvertUI64
OpWasmI64TruncF64S
OpWasmI64TruncF64U
OpWasmF64ConvertI64S
OpWasmF64ConvertI64U
OpAdd8
OpAdd16
@ -28000,9 +28000,9 @@ var opcodeTable = [...]opInfo{
},
},
{
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
@ -28013,9 +28013,9 @@ var opcodeTable = [...]opInfo{
},
},
{
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
@ -28026,9 +28026,9 @@ var opcodeTable = [...]opInfo{
},
},
{
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
@ -28039,9 +28039,9 @@ var opcodeTable = [...]opInfo{
},
},
{
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

View file

@ -913,10 +913,10 @@ func rewriteValueWasm_OpConvert_0(v *Value) bool {
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
}
@ -924,10 +924,10 @@ func rewriteValueWasm_OpCvt32Fto32_0(v *Value) bool {
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
}
@ -935,10 +935,10 @@ func rewriteValueWasm_OpCvt32Fto32U_0(v *Value) bool {
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
}
@ -958,10 +958,10 @@ func rewriteValueWasm_OpCvt32Fto64F_0(v *Value) bool {
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
}
@ -973,11 +973,11 @@ func rewriteValueWasm_OpCvt32Uto32F_0(v *Value) bool {
_ = 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)
@ -992,10 +992,10 @@ func rewriteValueWasm_OpCvt32Uto64F_0(v *Value) bool {
_ = 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)
@ -1009,11 +1009,11 @@ func rewriteValueWasm_OpCvt32to32F_0(v *Value) bool {
_ = 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)
@ -1028,10 +1028,10 @@ func rewriteValueWasm_OpCvt32to64F_0(v *Value) bool {
_ = 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)
@ -1041,10 +1041,10 @@ func rewriteValueWasm_OpCvt32to64F_0(v *Value) bool {
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
}
@ -1063,10 +1063,10 @@ func rewriteValueWasm_OpCvt64Fto32F_0(v *Value) bool {
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
}
@ -1074,10 +1074,10 @@ func rewriteValueWasm_OpCvt64Fto32U_0(v *Value) bool {
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
}
@ -1085,10 +1085,10 @@ func rewriteValueWasm_OpCvt64Fto64_0(v *Value) bool {
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
}
@ -1100,11 +1100,11 @@ func rewriteValueWasm_OpCvt64Uto32F_0(v *Value) bool {
_ = 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
@ -1113,10 +1113,10 @@ func rewriteValueWasm_OpCvt64Uto32F_0(v *Value) bool {
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
}
@ -1128,11 +1128,11 @@ func rewriteValueWasm_OpCvt64to32F_0(v *Value) bool {
_ = 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
@ -1141,10 +1141,10 @@ func rewriteValueWasm_OpCvt64to32F_0(v *Value) bool {
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
}

View file

@ -283,13 +283,13 @@ func ssaGenValueOnStack(s *gc.SSAGenState, v *ssa.Value) {
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])
@ -307,17 +307,17 @@ func ssaGenValueOnStack(s *gc.SSAGenState, v *ssa.Value) {
}
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())
@ -362,7 +362,7 @@ func getValue64(s *gc.SSAGenState, v *ssa.Value) {
reg := v.Reg()
getReg(s, reg)
if reg == wasm.REG_SP {
s.Prog(wasm.AI64ExtendUI32)
s.Prog(wasm.AI64ExtendI32U)
}
}

View file

@ -186,25 +186,25 @@ const (
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

View file

@ -153,25 +153,25 @@ var Anames = []string{
"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",

View file

@ -181,7 +181,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
// Not
// If
// Get SP
// I64ExtendUI32
// I64ExtendI32U
// I64Const $framesize+8
// I64Add
// I64Load panic_argp(R0)
@ -212,7 +212,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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)
@ -584,7 +584,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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))
@ -641,7 +641,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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)
@ -654,7 +654,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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:
@ -788,13 +788,13 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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")
@ -808,14 +808,14 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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))
@ -834,10 +834,10 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
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")

View file

@ -44,7 +44,7 @@ TEXT cmpbody<>(SB), NOSPLIT, $0-0
Get R4
I32WrapI64
Call memcmp<>(SB)
I64ExtendSI32
I64ExtendI32S
Set R5
Get R5

View file

@ -12,7 +12,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
I64Load b_len+8(FP)
I32WrapI64
Call memchr<>(SB)
I64ExtendSI32
I64ExtendI32S
Set R0
Get SP
@ -35,7 +35,7 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
I64Load s_len+8(FP)
I32WrapI64
Call memchr<>(SB)
I64ExtendSI32
I64ExtendI32S
Set R0
I64Const $-1

View file

@ -16,7 +16,7 @@ TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$32
Get SP
Get SP
I64ExtendUI32
I64ExtendI32U
I64Const $argframe+0(FP)
I64Add
I64Store $8
@ -38,7 +38,7 @@ TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$32
Get SP
Get SP
I64ExtendUI32
I64ExtendI32U
I64Const $argframe+0(FP)
I64Add
I64Store $8

View file

@ -366,7 +366,7 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
Set RET1; \
\
Get SP; \
I64ExtendUI32; \
I64ExtendI32U; \
Get R0; \
I64Add; \
Set RET2; \

View file

@ -23,12 +23,12 @@ TEXT wasm_export_run(SB),NOSPLIT,$0
Get SP
Get R0 // argc
I64ExtendUI32
I64ExtendI32U
I64Store $0
Get SP
Get R1 // argv
I64ExtendUI32
I64ExtendI32U
I64Store $8
I32Const $runtime·rt0_go(SB)

View file

@ -117,7 +117,7 @@ TEXT runtime·wasmTruncS(SB), NOSPLIT, $0-0
End
Get R0
I64TruncSF64
I64TruncF64S
Return
TEXT runtime·wasmTruncU(SB), NOSPLIT, $0-0
@ -146,7 +146,7 @@ TEXT runtime·wasmTruncU(SB), NOSPLIT, $0-0
End
Get R0
I64TruncUF64
I64TruncF64U
Return
TEXT runtime·exitThread(SB), NOSPLIT, $0-0