continue
}
}
+ // Replaces
+ // if a { x = value } else { x = a } with x = a && value.
+ // Requires that value dominates x.
+ if v.Args[1-reverse] == b0.Controls[0] {
+ if tmp := v.Args[reverse]; sdom.IsAncestorEq(tmp.Block, b) {
+ v.reset(OpAndB)
+ v.SetArgs2(b0.Controls[0], tmp)
+ if f.pass.debug > 0 {
+ f.Warnl(b.Pos, "converted OpPhi to %v", v.Op)
+ }
+ continue
+ }
+ }
+
+ // Replaces
+ // if a { x = a } else { x = value } with x = a || value.
+ // Requires that value dominates x.
+ if v.Args[reverse] == b0.Controls[0] {
+ if tmp := v.Args[1-reverse]; sdom.IsAncestorEq(tmp.Block, b) {
+ v.reset(OpOrB)
+ v.SetArgs2(b0.Controls[0], tmp)
+ if f.pass.debug > 0 {
+ f.Warnl(b.Pos, "converted OpPhi to %v", v.Op)
+ }
+ continue
+ }
+ }
}
}
// strengthen phi optimization.
return x&1 == 0
}
+func phiAnd(a, b bool) bool {
+ var x bool
+ // amd64:-"TESTB"
+ if a {
+ x = b
+ } else {
+ x = a
+ }
+ // amd64:"ANDL"
+ return x
+}
+
+func phiOr(a, b bool) bool {
+ var x bool
+ // amd64:-"TESTB"
+ if a {
+ x = a
+ } else {
+ x = b
+ }
+ // amd64:"ORL"
+ return x
+}
+
func TestSetEq64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0EQ",-"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0EQ"
return c
}
+//go:noinline
+func f10and(a bool, b bool) bool {
+ var x bool
+ if a {
+ x = b
+ } else {
+ x = a
+ }
+ return x // ERROR "converted OpPhi to AndB$"
+}
+
+//go:noinline
+func f11or(a bool, b bool) bool {
+ var x bool
+ if a {
+ x = a
+ } else {
+ x = b
+ }
+ return x // ERROR "converted OpPhi to OrB$"
+}
+
func main() {
}