Commit 71a4c4bb authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

[dev.ssa] cmd/compile: finish InvertFlags rewrites

Change-Id: I61b2d2be18f905a17e8ee765a4494b763a425c55
Reviewed-on: https://go-review.googlesource.com/12794Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent 3e3d162f
...@@ -180,6 +180,14 @@ ...@@ -180,6 +180,14 @@
// reverse ordering of compare instruction // reverse ordering of compare instruction
(SETL (InvertFlags x)) -> (SETG x) (SETL (InvertFlags x)) -> (SETG x)
(SETG (InvertFlags x)) -> (SETL x) (SETG (InvertFlags x)) -> (SETL x)
(SETB (InvertFlags x)) -> (SETA x)
(SETA (InvertFlags x)) -> (SETB x)
(SETLE (InvertFlags x)) -> (SETGE x)
(SETGE (InvertFlags x)) -> (SETLE x)
(SETBE (InvertFlags x)) -> (SETAE x)
(SETAE (InvertFlags x)) -> (SETBE x)
(SETEQ (InvertFlags x)) -> (SETEQ x)
(SETNE (InvertFlags x)) -> (SETNE x)
// sign extended loads // sign extended loads
(MOVBQSX (MOVBload ptr mem)) -> (MOVBQSXload ptr mem) (MOVBQSX (MOVBload ptr mem)) -> (MOVBQSXload ptr mem)
......
...@@ -1983,6 +1983,101 @@ func rewriteValueAMD64(v *Value, config *Config) bool { ...@@ -1983,6 +1983,101 @@ func rewriteValueAMD64(v *Value, config *Config) bool {
goto end4157ddea9c4f71bfabfd6fa50e1208ed goto end4157ddea9c4f71bfabfd6fa50e1208ed
end4157ddea9c4f71bfabfd6fa50e1208ed: end4157ddea9c4f71bfabfd6fa50e1208ed:
; ;
case OpAMD64SETA:
// match: (SETA (InvertFlags x))
// cond:
// result: (SETB x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto enda4ac36e94fc279d762b5a6c7c6cc665d
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETB
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto enda4ac36e94fc279d762b5a6c7c6cc665d
enda4ac36e94fc279d762b5a6c7c6cc665d:
;
case OpAMD64SETAE:
// match: (SETAE (InvertFlags x))
// cond:
// result: (SETBE x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto end0468f5be6caf682fdea6b91d6648991e
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETBE
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto end0468f5be6caf682fdea6b91d6648991e
end0468f5be6caf682fdea6b91d6648991e:
;
case OpAMD64SETB:
// match: (SETB (InvertFlags x))
// cond:
// result: (SETA x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto endc9eba7aa1e54a228570d2f5cc96f3565
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETA
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto endc9eba7aa1e54a228570d2f5cc96f3565
endc9eba7aa1e54a228570d2f5cc96f3565:
;
case OpAMD64SETBE:
// match: (SETBE (InvertFlags x))
// cond:
// result: (SETAE x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto end9d9031643469798b14b8cad1f5a7a1ba
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETAE
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto end9d9031643469798b14b8cad1f5a7a1ba
end9d9031643469798b14b8cad1f5a7a1ba:
;
case OpAMD64SETEQ:
// match: (SETEQ (InvertFlags x))
// cond:
// result: (SETEQ x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto end5d2039c9368d8c0cfba23b5a85b459e1
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETEQ
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto end5d2039c9368d8c0cfba23b5a85b459e1
end5d2039c9368d8c0cfba23b5a85b459e1:
;
case OpAMD64SETG: case OpAMD64SETG:
// match: (SETG (InvertFlags x)) // match: (SETG (InvertFlags x))
// cond: // cond:
...@@ -2002,6 +2097,25 @@ func rewriteValueAMD64(v *Value, config *Config) bool { ...@@ -2002,6 +2097,25 @@ func rewriteValueAMD64(v *Value, config *Config) bool {
goto endf7586738694c9cd0b74ae28bbadb649f goto endf7586738694c9cd0b74ae28bbadb649f
endf7586738694c9cd0b74ae28bbadb649f: endf7586738694c9cd0b74ae28bbadb649f:
; ;
case OpAMD64SETGE:
// match: (SETGE (InvertFlags x))
// cond:
// result: (SETLE x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto end82c11eff6f842159f564f2dad3d2eedc
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETLE
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto end82c11eff6f842159f564f2dad3d2eedc
end82c11eff6f842159f564f2dad3d2eedc:
;
case OpAMD64SETL: case OpAMD64SETL:
// match: (SETL (InvertFlags x)) // match: (SETL (InvertFlags x))
// cond: // cond:
...@@ -2021,6 +2135,44 @@ func rewriteValueAMD64(v *Value, config *Config) bool { ...@@ -2021,6 +2135,44 @@ func rewriteValueAMD64(v *Value, config *Config) bool {
goto ende33160cd86b9d4d3b77e02fb4658d5d3 goto ende33160cd86b9d4d3b77e02fb4658d5d3
ende33160cd86b9d4d3b77e02fb4658d5d3: ende33160cd86b9d4d3b77e02fb4658d5d3:
; ;
case OpAMD64SETLE:
// match: (SETLE (InvertFlags x))
// cond:
// result: (SETGE x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto end9307d96753efbeb888d1c98a6aba7a29
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETGE
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto end9307d96753efbeb888d1c98a6aba7a29
end9307d96753efbeb888d1c98a6aba7a29:
;
case OpAMD64SETNE:
// match: (SETNE (InvertFlags x))
// cond:
// result: (SETNE x)
{
if v.Args[0].Op != OpAMD64InvertFlags {
goto endbc71811b789475308014550f638026eb
}
x := v.Args[0].Args[0]
v.Op = OpAMD64SETNE
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
return true
}
goto endbc71811b789475308014550f638026eb
endbc71811b789475308014550f638026eb:
;
case OpAMD64SHLQ: case OpAMD64SHLQ:
// match: (SHLQ x (MOVQconst [c])) // match: (SHLQ x (MOVQconst [c]))
// cond: // 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