Commit a402b58e authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

[dev.ssa] cmd/compile: implement "if SETEQ" branches

Change-Id: I814fd0c2f1a622cca7dfd1b771f81de309a1904c
Reviewed-on: https://go-review.googlesource.com/12441Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 2574e4ac
......@@ -95,6 +95,7 @@
// block rewrites
(If (SETL cmp) yes no) -> (LT cmp yes no)
(If (SETEQ cmp) yes no) -> (EQ cmp yes no)
(If (SETNE cmp) yes no) -> (NE cmp yes no)
(If (SETB cmp) yes no) -> (ULT cmp yes no)
(If cond yes no) && cond.Op == OpAMD64MOVBload -> (NE (TESTB <TypeFlags> cond cond) yes no)
......
......@@ -2142,6 +2142,26 @@ func rewriteBlockAMD64(b *Block) bool {
}
goto ende4d36879bb8e1bd8facaa8c91ba99dcc
ende4d36879bb8e1bd8facaa8c91ba99dcc:
;
// match: (If (SETEQ cmp) yes no)
// cond:
// result: (EQ cmp yes no)
{
v := b.Control
if v.Op != OpAMD64SETEQ {
goto endf113deb06abc88613840e6282942921a
}
cmp := v.Args[0]
yes := b.Succs[0]
no := b.Succs[1]
b.Kind = BlockAMD64EQ
b.Control = cmp
b.Succs[0] = yes
b.Succs[1] = no
return true
}
goto endf113deb06abc88613840e6282942921a
endf113deb06abc88613840e6282942921a:
;
// match: (If (SETNE cmp) yes no)
// cond:
......
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