mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
cmd/compile: fix the implementation of NORconst on loong64
In the loong64 instruction set, there is no NORI instruction, so the immediate value in NORconst need to be stored in register and then use the three-register NOR instruction. Change-Id: I5ef697450619317218cb3ef47fc07e238bdc2139 Reviewed-on: https://go-review.googlesource.com/c/go/+/673836 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
74304cda29
commit
d37a1bdd48
2 changed files with 26 additions and 1 deletions
|
@ -276,7 +276,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
|
||||||
ssa.OpLOONG64ANDconst,
|
ssa.OpLOONG64ANDconst,
|
||||||
ssa.OpLOONG64ORconst,
|
ssa.OpLOONG64ORconst,
|
||||||
ssa.OpLOONG64XORconst,
|
ssa.OpLOONG64XORconst,
|
||||||
ssa.OpLOONG64NORconst,
|
|
||||||
ssa.OpLOONG64SLLconst,
|
ssa.OpLOONG64SLLconst,
|
||||||
ssa.OpLOONG64SLLVconst,
|
ssa.OpLOONG64SLLVconst,
|
||||||
ssa.OpLOONG64SRLconst,
|
ssa.OpLOONG64SRLconst,
|
||||||
|
@ -293,6 +292,23 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
|
||||||
p.Reg = v.Args[0].Reg()
|
p.Reg = v.Args[0].Reg()
|
||||||
p.To.Type = obj.TYPE_REG
|
p.To.Type = obj.TYPE_REG
|
||||||
p.To.Reg = v.Reg()
|
p.To.Reg = v.Reg()
|
||||||
|
|
||||||
|
case ssa.OpLOONG64NORconst:
|
||||||
|
// MOVV $const, Rtmp
|
||||||
|
// NOR Rtmp, Rarg0, Rout
|
||||||
|
p := s.Prog(loong64.AMOVV)
|
||||||
|
p.From.Type = obj.TYPE_CONST
|
||||||
|
p.From.Offset = v.AuxInt
|
||||||
|
p.To.Type = obj.TYPE_REG
|
||||||
|
p.To.Reg = loong64.REGTMP
|
||||||
|
|
||||||
|
p2 := s.Prog(v.Op.Asm())
|
||||||
|
p2.From.Type = obj.TYPE_REG
|
||||||
|
p2.From.Reg = loong64.REGTMP
|
||||||
|
p2.Reg = v.Args[0].Reg()
|
||||||
|
p2.To.Type = obj.TYPE_REG
|
||||||
|
p2.To.Reg = v.Reg()
|
||||||
|
|
||||||
case ssa.OpLOONG64MOVVconst:
|
case ssa.OpLOONG64MOVVconst:
|
||||||
r := v.Reg()
|
r := v.Reg()
|
||||||
p := s.Prog(v.Op.Asm())
|
p := s.Prog(v.Op.Asm())
|
||||||
|
|
|
@ -335,6 +335,15 @@ func op_orn(x, y uint32) uint32 {
|
||||||
return x | ^y
|
return x | ^y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func op_nor(x int64, a []int64) {
|
||||||
|
// loong64: "MOVV\t[$]0","NOR\tR"
|
||||||
|
a[0] = ^(0x1234 | x)
|
||||||
|
// loong64:"NOR",-"XOR"
|
||||||
|
a[1] = (-1) ^ x
|
||||||
|
// loong64: "MOVV\t[$]-55",-"OR",-"NOR"
|
||||||
|
a[2] = ^(0x12 | 0x34)
|
||||||
|
}
|
||||||
|
|
||||||
// check bitsets
|
// check bitsets
|
||||||
func bitSetPowerOf2Test(x int) bool {
|
func bitSetPowerOf2Test(x int) bool {
|
||||||
// amd64:"BTL\t[$]3"
|
// amd64:"BTL\t[$]3"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue