From b9f424e7d191b93acfe1412b9e9d1203a2412faa Mon Sep 17 00:00:00 2001 From: Stefan Date: Mon, 8 May 2023 21:57:46 -0400 Subject: [PATCH] Added DeMorgans test in codegen/logic.go --- test/codegen/logic.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 +}