mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
578b3ccd8f
Differential Revision: http://reviews.llvm.org/D6430 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222879 91177308-0d34-0410-b5e6-96231b3b80d8
25 lines
652 B
LLVM
25 lines
652 B
LLVM
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
; (x&z) ^ (y&z) -> (x^y)&z
|
|
define i32 @test1(i32 %x, i32 %y, i32 %z) {
|
|
; CHECK-LABEL: @test1(
|
|
; CHECK-NEXT: %tmp61 = xor i32 %x, %y
|
|
; CHECK-NEXT: %tmp7 = and i32 %tmp61, %z
|
|
; CHECK-NEXT: ret i32 %tmp7
|
|
%tmp3 = and i32 %z, %x
|
|
%tmp6 = and i32 %z, %y
|
|
%tmp7 = xor i32 %tmp3, %tmp6
|
|
ret i32 %tmp7
|
|
}
|
|
|
|
; (x & y) ^ (x|y) -> x^y
|
|
define i32 @test2(i32 %x, i32 %y, i32 %z) {
|
|
; CHECK-LABEL: @test2(
|
|
; CHECK-NEXT: %tmp7 = xor i32 %y, %x
|
|
; CHECK-NEXT: ret i32 %tmp7
|
|
%tmp3 = and i32 %y, %x
|
|
%tmp6 = or i32 %y, %x
|
|
%tmp7 = xor i32 %tmp3, %tmp6
|
|
ret i32 %tmp7
|
|
}
|