mirror of
https://github.com/golang/go
synced 2024-11-17 15:14:42 -07:00
cmd/compile: fix If lowering on loong64
Update #40724 Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn> Change-Id: I44477e32db765e0299d8361bd2b8d2c95564ed28 Reviewed-on: https://go-review.googlesource.com/c/go/+/521788 Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
e58c9baa9f
commit
b3b442449b
@ -416,7 +416,7 @@
|
||||
(GetCallerSP ...) => (LoweredGetCallerSP ...)
|
||||
(GetCallerPC ...) => (LoweredGetCallerPC ...)
|
||||
|
||||
(If cond yes no) => (NE cond yes no)
|
||||
(If cond yes no) => (NE (MOVBUreg <typ.UInt64> cond) yes no)
|
||||
|
||||
// Write barrier.
|
||||
(WB ...) => (LoweredWB ...)
|
||||
@ -450,6 +450,7 @@
|
||||
(EQ (SGTconst [0] x) yes no) => (GEZ x yes no)
|
||||
(NE (SGT x (MOVVconst [0])) yes no) => (GTZ x yes no)
|
||||
(EQ (SGT x (MOVVconst [0])) yes no) => (LEZ x yes no)
|
||||
(MOVBUreg x:((SGT|SGTU) _ _)) => x
|
||||
|
||||
// fold offset into address
|
||||
(ADDVconst [off1] (MOVVaddr [off2] {sym} ptr)) && is32Bit(off1+int64(off2)) => (MOVVaddr [int32(off1)+int32(off2)] {sym} ptr)
|
||||
|
@ -1773,6 +1773,26 @@ func rewriteValueLOONG64_OpLOONG64MOVBUload(v *Value) bool {
|
||||
}
|
||||
func rewriteValueLOONG64_OpLOONG64MOVBUreg(v *Value) bool {
|
||||
v_0 := v.Args[0]
|
||||
// match: (MOVBUreg x:(SGT _ _))
|
||||
// result: x
|
||||
for {
|
||||
x := v_0
|
||||
if x.Op != OpLOONG64SGT {
|
||||
break
|
||||
}
|
||||
v.copyOf(x)
|
||||
return true
|
||||
}
|
||||
// match: (MOVBUreg x:(SGTU _ _))
|
||||
// result: x
|
||||
for {
|
||||
x := v_0
|
||||
if x.Op != OpLOONG64SGTU {
|
||||
break
|
||||
}
|
||||
v.copyOf(x)
|
||||
return true
|
||||
}
|
||||
// match: (MOVBUreg x:(MOVBUload _ _))
|
||||
// result: (MOVVreg x)
|
||||
for {
|
||||
@ -7608,6 +7628,7 @@ func rewriteValueLOONG64_OpZero(v *Value) bool {
|
||||
return false
|
||||
}
|
||||
func rewriteBlockLOONG64(b *Block) bool {
|
||||
typ := &b.Func.Config.Types
|
||||
switch b.Kind {
|
||||
case BlockLOONG64EQ:
|
||||
// match: (EQ (FPFlagTrue cmp) yes no)
|
||||
@ -7807,10 +7828,12 @@ func rewriteBlockLOONG64(b *Block) bool {
|
||||
}
|
||||
case BlockIf:
|
||||
// match: (If cond yes no)
|
||||
// result: (NE cond yes no)
|
||||
// result: (NE (MOVBUreg <typ.UInt64> cond) yes no)
|
||||
for {
|
||||
cond := b.Controls[0]
|
||||
b.resetWithControl(BlockLOONG64NE, cond)
|
||||
v0 := b.NewValue0(cond.Pos, OpLOONG64MOVBUreg, typ.UInt64)
|
||||
v0.AddArg(cond)
|
||||
b.resetWithControl(BlockLOONG64NE, v0)
|
||||
return true
|
||||
}
|
||||
case BlockLOONG64LEZ:
|
||||
|
Loading…
Reference in New Issue
Block a user