1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:10:05 -07:00

cmd/compile: simplify Neg lowering on s390x

No need to sign extend input to Neg8 and Neg16.

Change-Id: I7896c83c9cdf84a34098582351a4aabf61cd6fdd
Reviewed-on: https://go-review.googlesource.com/102675
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Michael Munday 2018-03-27 11:52:56 +01:00
parent 7b177b1a03
commit 331c187b17
2 changed files with 6 additions and 20 deletions

View File

@ -58,10 +58,8 @@
(Xor64 x y) -> (XOR x y)
(Xor(32|16|8) x y) -> (XORW x y)
(Neg64 x) -> (NEG x)
(Neg32 x) -> (NEGW x)
(Neg16 x) -> (NEGW (MOVHreg x))
(Neg8 x) -> (NEGW (MOVBreg x))
(Neg64 x) -> (NEG x)
(Neg(32|16|8) x) -> (NEGW x)
(Neg32F x) -> (FNEGS x)
(Neg64F x) -> (FNEG x)

View File

@ -4564,19 +4564,13 @@ func rewriteValueS390X_OpMul8_0(v *Value) bool {
}
}
func rewriteValueS390X_OpNeg16_0(v *Value) bool {
b := v.Block
_ = b
typ := &b.Func.Config.Types
_ = typ
// match: (Neg16 x)
// cond:
// result: (NEGW (MOVHreg x))
// result: (NEGW x)
for {
x := v.Args[0]
v.reset(OpS390XNEGW)
v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
v0.AddArg(x)
v.AddArg(v0)
v.AddArg(x)
return true
}
}
@ -4625,19 +4619,13 @@ func rewriteValueS390X_OpNeg64F_0(v *Value) bool {
}
}
func rewriteValueS390X_OpNeg8_0(v *Value) bool {
b := v.Block
_ = b
typ := &b.Func.Config.Types
_ = typ
// match: (Neg8 x)
// cond:
// result: (NEGW (MOVBreg x))
// result: (NEGW x)
for {
x := v.Args[0]
v.reset(OpS390XNEGW)
v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
v0.AddArg(x)
v.AddArg(v0)
v.AddArg(x)
return true
}
}