Added DeMorgans test in codegen/logic.go

This commit is contained in:
Stefan 2023-05-08 21:57:46 -04:00
parent 59cdce2259
commit b9f424e7d1
1 changed files with 14 additions and 0 deletions

View File

@ -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
}