[llvm] r246973 - add missing regression tests for De Morgan's Law transform in InstCombine
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 12:00:39 PDT 2015
Author: spatel
Date: Mon Sep 7 14:00:38 2015
New Revision: 246973
URL: http://llvm.org/viewvc/llvm-project?rev=246973&view=rev
Log:
add missing regression tests for De Morgan's Law transform in InstCombine
Modified:
llvm/trunk/test/Transforms/InstCombine/apint-or1.ll
llvm/trunk/test/Transforms/InstCombine/apint-or2.ll
Modified: llvm/trunk/test/Transforms/InstCombine/apint-or1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/apint-or1.ll?rev=246973&r1=246972&r2=246973&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/apint-or1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/apint-or1.ll Mon Sep 7 14:00:38 2015
@@ -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
+}
+
Modified: llvm/trunk/test/Transforms/InstCombine/apint-or2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/apint-or2.ll?rev=246973&r1=246972&r2=246973&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/apint-or2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/apint-or2.ll Mon Sep 7 14:00:38 2015
@@ -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
+}
+
More information about the llvm-commits
mailing list