mirror of
https://github.com/golang/go
synced 2024-11-18 07:14:44 -07:00
cmd/compile: add patterns to improve PPC64 FP comparisons
Uncommented 4 comparison rules of this form: (NE (CMPWconst [0] (FLessThan cc)) yes no) -> (FLT cc yes no) Fixes #17507. Change-Id: I74f34f13526aeee619711c8281a66652d90a962a Reviewed-on: https://go-review.googlesource.com/31612 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
f9bbfe4a09
commit
33b71dfa1c
@ -361,10 +361,10 @@
|
|||||||
(NE (CMPWconst [0] (LessEqual cc)) yes no) -> (LE cc yes no)
|
(NE (CMPWconst [0] (LessEqual cc)) yes no) -> (LE cc yes no)
|
||||||
(NE (CMPWconst [0] (GreaterThan cc)) yes no) -> (GT cc yes no)
|
(NE (CMPWconst [0] (GreaterThan cc)) yes no) -> (GT cc yes no)
|
||||||
(NE (CMPWconst [0] (GreaterEqual cc)) yes no) -> (GE cc yes no)
|
(NE (CMPWconst [0] (GreaterEqual cc)) yes no) -> (GE cc yes no)
|
||||||
// (NE (CMPWconst [0] (FLessThan cc)) yes no) -> (FLT cc yes no)
|
(NE (CMPWconst [0] (FLessThan cc)) yes no) -> (FLT cc yes no)
|
||||||
// (NE (CMPWconst [0] (FLessEqual cc)) yes no) -> (FLE cc yes no)
|
(NE (CMPWconst [0] (FLessEqual cc)) yes no) -> (FLE cc yes no)
|
||||||
// (NE (CMPWconst [0] (FGreaterThan cc)) yes no) -> (FGT cc yes no)
|
(NE (CMPWconst [0] (FGreaterThan cc)) yes no) -> (FGT cc yes no)
|
||||||
// (NE (CMPWconst [0] (FGreaterEqual cc)) yes no) -> (FGE cc yes no)
|
(NE (CMPWconst [0] (FGreaterEqual cc)) yes no) -> (FGE cc yes no)
|
||||||
|
|
||||||
// Elide compares of bit tests // TODO need to make both CC and result of ANDCC available.
|
// Elide compares of bit tests // TODO need to make both CC and result of ANDCC available.
|
||||||
(EQ (CMPconst [0] (ANDconst [c] x)) yes no) -> (EQ (ANDCCconst [c] x) yes no)
|
(EQ (CMPconst [0] (ANDconst [c] x)) yes no) -> (EQ (ANDCCconst [c] x) yes no)
|
||||||
|
@ -10584,6 +10584,102 @@ func rewriteBlockPPC64(b *Block, config *Config) bool {
|
|||||||
_ = no
|
_ = no
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// match: (NE (CMPWconst [0] (FLessThan cc)) yes no)
|
||||||
|
// cond:
|
||||||
|
// result: (FLT cc yes no)
|
||||||
|
for {
|
||||||
|
v := b.Control
|
||||||
|
if v.Op != OpPPC64CMPWconst {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.AuxInt != 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
v_0 := v.Args[0]
|
||||||
|
if v_0.Op != OpPPC64FLessThan {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
cc := v_0.Args[0]
|
||||||
|
yes := b.Succs[0]
|
||||||
|
no := b.Succs[1]
|
||||||
|
b.Kind = BlockPPC64FLT
|
||||||
|
b.SetControl(cc)
|
||||||
|
_ = yes
|
||||||
|
_ = no
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// match: (NE (CMPWconst [0] (FLessEqual cc)) yes no)
|
||||||
|
// cond:
|
||||||
|
// result: (FLE cc yes no)
|
||||||
|
for {
|
||||||
|
v := b.Control
|
||||||
|
if v.Op != OpPPC64CMPWconst {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.AuxInt != 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
v_0 := v.Args[0]
|
||||||
|
if v_0.Op != OpPPC64FLessEqual {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
cc := v_0.Args[0]
|
||||||
|
yes := b.Succs[0]
|
||||||
|
no := b.Succs[1]
|
||||||
|
b.Kind = BlockPPC64FLE
|
||||||
|
b.SetControl(cc)
|
||||||
|
_ = yes
|
||||||
|
_ = no
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// match: (NE (CMPWconst [0] (FGreaterThan cc)) yes no)
|
||||||
|
// cond:
|
||||||
|
// result: (FGT cc yes no)
|
||||||
|
for {
|
||||||
|
v := b.Control
|
||||||
|
if v.Op != OpPPC64CMPWconst {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.AuxInt != 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
v_0 := v.Args[0]
|
||||||
|
if v_0.Op != OpPPC64FGreaterThan {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
cc := v_0.Args[0]
|
||||||
|
yes := b.Succs[0]
|
||||||
|
no := b.Succs[1]
|
||||||
|
b.Kind = BlockPPC64FGT
|
||||||
|
b.SetControl(cc)
|
||||||
|
_ = yes
|
||||||
|
_ = no
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// match: (NE (CMPWconst [0] (FGreaterEqual cc)) yes no)
|
||||||
|
// cond:
|
||||||
|
// result: (FGE cc yes no)
|
||||||
|
for {
|
||||||
|
v := b.Control
|
||||||
|
if v.Op != OpPPC64CMPWconst {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if v.AuxInt != 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
v_0 := v.Args[0]
|
||||||
|
if v_0.Op != OpPPC64FGreaterEqual {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
cc := v_0.Args[0]
|
||||||
|
yes := b.Succs[0]
|
||||||
|
no := b.Succs[1]
|
||||||
|
b.Kind = BlockPPC64FGE
|
||||||
|
b.SetControl(cc)
|
||||||
|
_ = yes
|
||||||
|
_ = no
|
||||||
|
return true
|
||||||
|
}
|
||||||
// match: (NE (CMPconst [0] (ANDconst [c] x)) yes no)
|
// match: (NE (CMPconst [0] (ANDconst [c] x)) yes no)
|
||||||
// cond:
|
// cond:
|
||||||
// result: (NE (ANDCCconst [c] x) yes no)
|
// result: (NE (ANDCCconst [c] x) yes no)
|
||||||
|
Loading…
Reference in New Issue
Block a user