[InstCombine] Move 4 test cases from a test that didn't use FileCheck and merge them into a existing test file. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308103 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper
2017-07-15 17:09:22 +00:00
parent 9e7e63adc7
commit c301a9eeef
2 changed files with 48 additions and 34 deletions

View File

@@ -1,34 +0,0 @@
; RUN: opt < %s -instcombine -S | grep "and i32 %x, %y" | count 4
; RUN: opt < %s -instcombine -S | not grep "or"
define i32 @func1(i32 %x, i32 %y) nounwind {
entry:
%n = xor i32 %y, -1
%o = or i32 %n, %x
%a = and i32 %o, %y
ret i32 %a
}
define i32 @func2(i32 %x, i32 %y) nounwind {
entry:
%n = xor i32 %y, -1
%o = or i32 %x, %n
%a = and i32 %o, %y
ret i32 %a
}
define i32 @func3(i32 %x, i32 %y) nounwind {
entry:
%n = xor i32 %y, -1
%o = or i32 %n, %x
%a = and i32 %y, %o
ret i32 %a
}
define i32 @func4(i32 %x, i32 %y) nounwind {
entry:
%n = xor i32 %y, -1
%o = or i32 %x, %n
%a = and i32 %y, %o
ret i32 %a
}

View File

@@ -628,3 +628,51 @@ define i32 @test43(i32 %a, i32 %c, i32 %d) {
%and = and i32 %or, %xor
ret i32 %and
}
; (~y | x) & y -> x & y
define i32 @test44(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: @test44(
; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i32 [[A]]
;
%n = xor i32 %y, -1
%o = or i32 %n, %x
%a = and i32 %o, %y
ret i32 %a
}
; (x | ~y) & y -> x & y
define i32 @test45(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: @test45(
; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i32 [[A]]
;
%n = xor i32 %y, -1
%o = or i32 %x, %n
%a = and i32 %o, %y
ret i32 %a
}
; y & (~y | x) -> y | x
define i32 @test46(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: @test46(
; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i32 [[A]]
;
%n = xor i32 %y, -1
%o = or i32 %n, %x
%a = and i32 %y, %o
ret i32 %a
}
; y & (x | ~y) -> y | x
define i32 @test47(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: @test47(
; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i32 [[A]]
;
%n = xor i32 %y, -1
%o = or i32 %x, %n
%a = and i32 %y, %o
ret i32 %a
}