diff --git a/test/codegen/logic.go b/test/codegen/logic.go index 748c639d6b..a00bbb0600 100644 --- a/test/codegen/logic.go +++ b/test/codegen/logic.go @@ -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 +}