Commit 4cce27a3 authored by Michael Munday's avatar Michael Munday

cmd/compile: fix constant propagation through s390x MOVDNE instructions

The constant propagation rules selected the wrong operand to
propagate. So MOVDNE (move if not equal) propagated operands as if
it were a MOVDEQ (move if equal).

Fixes #18735.

Change-Id: I87ac469172f9df7d5aabaf7106e2936ce54ae202
Reviewed-on: https://go-review.googlesource.com/35498
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 1be957d7
......@@ -885,9 +885,9 @@
(MOVDEQ y _ (FlagLT)) -> y
(MOVDEQ y _ (FlagGT)) -> y
(MOVDNE _ y (FlagEQ)) -> y
(MOVDNE x _ (FlagLT)) -> x
(MOVDNE x _ (FlagGT)) -> x
(MOVDNE y _ (FlagEQ)) -> y
(MOVDNE _ x (FlagLT)) -> x
(MOVDNE _ x (FlagGT)) -> x
(MOVDLT y _ (FlagEQ)) -> y
(MOVDLT _ x (FlagLT)) -> x
......
......@@ -9847,11 +9847,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool {
v.AddArg(cmp)
return true
}
// match: (MOVDNE _ y (FlagEQ))
// match: (MOVDNE y _ (FlagEQ))
// cond:
// result: y
for {
y := v.Args[1]
y := v.Args[0]
v_2 := v.Args[2]
if v_2.Op != OpS390XFlagEQ {
break
......@@ -9861,11 +9861,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool {
v.AddArg(y)
return true
}
// match: (MOVDNE x _ (FlagLT))
// match: (MOVDNE _ x (FlagLT))
// cond:
// result: x
for {
x := v.Args[0]
x := v.Args[1]
v_2 := v.Args[2]
if v_2.Op != OpS390XFlagLT {
break
......@@ -9875,11 +9875,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool {
v.AddArg(x)
return true
}
// match: (MOVDNE x _ (FlagGT))
// match: (MOVDNE _ x (FlagGT))
// cond:
// result: x
for {
x := v.Args[0]
x := v.Args[1]
v_2 := v.Args[2]
if v_2.Op != OpS390XFlagGT {
break
......
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