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 @@ ...@@ -885,9 +885,9 @@
(MOVDEQ y _ (FlagLT)) -> y (MOVDEQ y _ (FlagLT)) -> y
(MOVDEQ y _ (FlagGT)) -> y (MOVDEQ y _ (FlagGT)) -> y
(MOVDNE _ y (FlagEQ)) -> y (MOVDNE y _ (FlagEQ)) -> y
(MOVDNE x _ (FlagLT)) -> x (MOVDNE _ x (FlagLT)) -> x
(MOVDNE x _ (FlagGT)) -> x (MOVDNE _ x (FlagGT)) -> x
(MOVDLT y _ (FlagEQ)) -> y (MOVDLT y _ (FlagEQ)) -> y
(MOVDLT _ x (FlagLT)) -> x (MOVDLT _ x (FlagLT)) -> x
......
...@@ -9847,11 +9847,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool { ...@@ -9847,11 +9847,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool {
v.AddArg(cmp) v.AddArg(cmp)
return true return true
} }
// match: (MOVDNE _ y (FlagEQ)) // match: (MOVDNE y _ (FlagEQ))
// cond: // cond:
// result: y // result: y
for { for {
y := v.Args[1] y := v.Args[0]
v_2 := v.Args[2] v_2 := v.Args[2]
if v_2.Op != OpS390XFlagEQ { if v_2.Op != OpS390XFlagEQ {
break break
...@@ -9861,11 +9861,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool { ...@@ -9861,11 +9861,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool {
v.AddArg(y) v.AddArg(y)
return true return true
} }
// match: (MOVDNE x _ (FlagLT)) // match: (MOVDNE _ x (FlagLT))
// cond: // cond:
// result: x // result: x
for { for {
x := v.Args[0] x := v.Args[1]
v_2 := v.Args[2] v_2 := v.Args[2]
if v_2.Op != OpS390XFlagLT { if v_2.Op != OpS390XFlagLT {
break break
...@@ -9875,11 +9875,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool { ...@@ -9875,11 +9875,11 @@ func rewriteValueS390X_OpS390XMOVDNE(v *Value, config *Config) bool {
v.AddArg(x) v.AddArg(x)
return true return true
} }
// match: (MOVDNE x _ (FlagGT)) // match: (MOVDNE _ x (FlagGT))
// cond: // cond:
// result: x // result: x
for { for {
x := v.Args[0] x := v.Args[1]
v_2 := v.Args[2] v_2 := v.Args[2]
if v_2.Op != OpS390XFlagGT { if v_2.Op != OpS390XFlagGT {
break 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