forked from OSchip/llvm-project
[InstCombine] Add test cases demonstrating missing handling for the commuted version of a transform. NFC.
llvm-svn: 299836
This commit is contained in:
parent
7639460367
commit
7260e2f159
|
@ -144,6 +144,20 @@ define i32 @test9(i32 %b, i32 %c) {
|
|||
ret i32 %xor2
|
||||
}
|
||||
|
||||
; (A & B) ^ (B ^ A) -> (A | B)
|
||||
define i32 @test9b(i32 %b, i32 %c) {
|
||||
; CHECK-LABEL: @test9b(
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 [[B:%.*]], [[C:%.*]]
|
||||
; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[C]], [[B]]
|
||||
; CHECK-NEXT: [[XOR2:%.*]] = xor i32 [[AND]], [[XOR]]
|
||||
; CHECK-NEXT: ret i32 [[XOR2]]
|
||||
;
|
||||
%and = and i32 %b, %c
|
||||
%xor = xor i32 %c, %b
|
||||
%xor2 = xor i32 %and, %xor
|
||||
ret i32 %xor2
|
||||
}
|
||||
|
||||
; (A ^ B) ^ (A & B) -> (A | B)
|
||||
define i32 @test10(i32 %b, i32 %c) {
|
||||
; CHECK-LABEL: @test10(
|
||||
|
@ -156,6 +170,20 @@ define i32 @test10(i32 %b, i32 %c) {
|
|||
ret i32 %xor2
|
||||
}
|
||||
|
||||
; (A ^ B) ^ (A & B) -> (A | B)
|
||||
define i32 @test10b(i32 %b, i32 %c) {
|
||||
; CHECK-LABEL: @test10b(
|
||||
; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[B:%.*]], [[C:%.*]]
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 [[C]], [[B]]
|
||||
; CHECK-NEXT: [[XOR2:%.*]] = xor i32 [[XOR]], [[AND]]
|
||||
; CHECK-NEXT: ret i32 [[XOR2]]
|
||||
;
|
||||
%xor = xor i32 %b, %c
|
||||
%and = and i32 %c, %b
|
||||
%xor2 = xor i32 %xor, %and
|
||||
ret i32 %xor2
|
||||
}
|
||||
|
||||
define i32 @test11(i32 %A, i32 %B) {
|
||||
; CHECK-LABEL: @test11(
|
||||
; CHECK-NEXT: ret i32 0
|
||||
|
|
Loading…
Reference in New Issue