提交 ae1ddc37 编写于 作者: 3 3dgen

修正有符号数右移时符号位错的问题

上级 4277b7f2
......@@ -208,10 +208,9 @@ func (m *Module) EmitBinOp(x, y Value, op wat.OpCode) (insts []wat.Inst, ret_typ
if x.Type().Size() <= 4 && y.Type().Size() == 8 {
insts = append(insts, x.EmitPush()...)
insts = append(insts, wat.NewInstConvert_i64_extend_i32_u())
insts = append(insts, y.EmitPush()...)
insts = append(insts, wat.NewInstShl(toWatType(y.Type())))
insts = append(insts, wat.NewInstConvert_i32_wrap_i64())
insts = append(insts, wat.NewInstShl(toWatType(ret_type)))
} else if x.Type().Size() == 8 && y.Type().Size() <= 4 {
insts = append(insts, x.EmitPush()...)
insts = append(insts, y.EmitPush()...)
......@@ -238,10 +237,9 @@ func (m *Module) EmitBinOp(x, y Value, op wat.OpCode) (insts []wat.Inst, ret_typ
if x.Type().Size() <= 4 && y.Type().Size() == 8 {
insts = append(insts, x.EmitPush()...)
insts = append(insts, wat.NewInstConvert_i64_extend_i32_u())
insts = append(insts, y.EmitPush()...)
insts = append(insts, wat.NewInstShr(toWatType(y.Type())))
insts = append(insts, wat.NewInstConvert_i32_wrap_i64())
insts = append(insts, wat.NewInstShr(toWatType(ret_type)))
} else if x.Type().Size() == 8 && y.Type().Size() <= 4 {
insts = append(insts, x.EmitPush()...)
insts = append(insts, y.EmitPush()...)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册