mirror of
https://github.com/golang/go
synced 2024-11-17 19:54:45 -07:00
cmd/compile: improve PPC64 rules for AtomicLoad{8,32}
This adds a rule to avoid the zero extension after an AtomicLoad8 or AtomicLoad32 since the atomic load has already filled it with zeros. This eliminates an instruction in a high use block in findObject and the AtomicLoad8 appears many times within runtime. Change-Id: I7e684bf73d3812110bd371e05b1aa44fa235fc9b Reviewed-on: https://go-review.googlesource.com/c/go/+/354029 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
This commit is contained in:
parent
72c52bfbe2
commit
ce72766a02
@ -1019,6 +1019,8 @@
|
|||||||
(MOVWZreg x:(MOVWZloadidx _ _ _)) => x
|
(MOVWZreg x:(MOVWZloadidx _ _ _)) => x
|
||||||
(MOVWreg x:(MOVWload _ _)) => x
|
(MOVWreg x:(MOVWload _ _)) => x
|
||||||
(MOVWreg x:(MOVWloadidx _ _ _)) => x
|
(MOVWreg x:(MOVWloadidx _ _ _)) => x
|
||||||
|
(MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _))) => x
|
||||||
|
(MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _))) => x
|
||||||
|
|
||||||
// don't extend if argument is already extended
|
// don't extend if argument is already extended
|
||||||
(MOVBreg x:(Arg <t>)) && is8BitInt(t) && isSigned(t) => x
|
(MOVBreg x:(Arg <t>)) && is8BitInt(t) && isSigned(t) => x
|
||||||
|
@ -7093,6 +7093,20 @@ func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool {
|
|||||||
v.copyOf(x)
|
v.copyOf(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// match: (MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _)))
|
||||||
|
// result: x
|
||||||
|
for {
|
||||||
|
x := v_0
|
||||||
|
if x.Op != OpSelect0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
x_0 := x.Args[0]
|
||||||
|
if x_0.Op != OpPPC64LoweredAtomicLoad8 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
v.copyOf(x)
|
||||||
|
return true
|
||||||
|
}
|
||||||
// match: (MOVBZreg x:(Arg <t>))
|
// match: (MOVBZreg x:(Arg <t>))
|
||||||
// cond: is8BitInt(t) && !isSigned(t)
|
// cond: is8BitInt(t) && !isSigned(t)
|
||||||
// result: x
|
// result: x
|
||||||
@ -10549,6 +10563,20 @@ func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool {
|
|||||||
v.copyOf(x)
|
v.copyOf(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// match: (MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _)))
|
||||||
|
// result: x
|
||||||
|
for {
|
||||||
|
x := v_0
|
||||||
|
if x.Op != OpSelect0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
x_0 := x.Args[0]
|
||||||
|
if x_0.Op != OpPPC64LoweredAtomicLoad32 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
v.copyOf(x)
|
||||||
|
return true
|
||||||
|
}
|
||||||
// match: (MOVWZreg x:(Arg <t>))
|
// match: (MOVWZreg x:(Arg <t>))
|
||||||
// cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !isSigned(t)
|
// cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !isSigned(t)
|
||||||
// result: x
|
// result: x
|
||||||
|
Loading…
Reference in New Issue
Block a user