add missing regression tests for De Morgan's Law transform in InstCombine
authorSanjay Patel <spatel@rotateright.com>
Mon, 7 Sep 2015 19:00:38 +0000 (19:00 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 7 Sep 2015 19:00:38 +0000 (19:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246973 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/apint-or1.ll
test/Transforms/InstCombine/apint-or2.ll

index d4f87ac894d98230016456a4028ab1db2681e750..676ec4c9e9a9d06a7cfbb0715c99f6d8d20f5228 100644 (file)
@@ -2,7 +2,7 @@
 ; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0.
 ;
 
-; RUN: opt < %s -instcombine -S | not grep or
+; RUN: opt < %s -instcombine -S | not grep " or "
 
 
 define i7 @test0(i7 %X) {
@@ -34,3 +34,12 @@ define i39 @test3(i39 %V, i39 %M) {
     %R = or i39 %B, %D
     ret i39 %R
 }
+
+define i43 @demorgan(i43 %A, i43 %B) {
+    ;; (~A | ~B) == (~(A & B)) - De Morgan's Law
+    %NotA = xor i43 %A, -1
+    %NotB = xor i43 %B, -1
+    %C1 = or i43 %NotA, %NotB
+    ret i43 %C1
+}
+
index d7de255f7fd2b2e433ded0115cb167716924fba2..b388aa5dd884cac9d8320815859c81bbe8d948ab 100644 (file)
@@ -1,7 +1,7 @@
 ; This test makes sure that or instructions are properly eliminated.
 ; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
 ;
-; RUN: opt < %s -instcombine -S | not grep or
+; RUN: opt < %s -instcombine -S | not grep " or "
 
 
 define i777 @test0(i777 %X) {
@@ -33,3 +33,12 @@ define i399 @test3(i399 %V, i399 %M) {
     %R = or i399 %B, %D
     ret i399 %R
 }
+
+define i129 @demorgan(i129 %A, i129 %B) {
+    ;; (~A | ~B) == (~(A & B)) - De Morgan's Law
+    %NotA = xor i129 %A, -1
+    %NotB = xor i129 %B, -1
+    %C1 = or i129 %NotA, %NotB
+    ret i129 %C1
+}
+