mirror of https://github.com/golang/go.git
Added DeMorgans test in codegen/logic.go
This commit is contained in:
parent
59cdce2259
commit
b9f424e7d1
|
|
@ -25,3 +25,17 @@ func ornot(x, y int) int {
|
|||
z := x | ^y
|
||||
return z
|
||||
}
|
||||
|
||||
// Verify that (OR (NOT x) (NOT y)) rewrites to (NOT (AND x y))
|
||||
func orDemorgans(x, y int) int {
|
||||
// amd64:"AND"
|
||||
z := ^x | ^y
|
||||
return z
|
||||
}
|
||||
|
||||
// Verify that (AND (NOT x) (NOT y)) rewrites to (NOT (OR x y))
|
||||
func andDemorgans(x, y int) int {
|
||||
// amd64:"OR"
|
||||
z := ^x & ^y
|
||||
return z
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue