Commit 331c187b authored by Michael Munday's avatar Michael Munday

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 7b177b1a
......@@ -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)
......
......@@ -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
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment