mirror of
https://github.com/golang/go.git
synced 2025-05-25 17:31:22 +00:00
[dev.ssa] cmd/compile: implement "if SETEQ" branches
Change-Id: I814fd0c2f1a622cca7dfd1b771f81de309a1904c Reviewed-on: https://go-review.googlesource.com/12441 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
2574e4ac1c
commit
a402b58e51
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user