aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/logic.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/codegen/logic.go b/test/codegen/logic.go
index 748c639d6b..ac33f91dad 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",-"OR"
+ 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",-"AND"
+ z := ^x & ^y
+ return z
+}