1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test/Transforms/InstCombine/and2.ll
Benjamin Kramer 6110efbf8c Teach InstructionSimplify to fold (A & B) & A -> A & B and (A | B) | A -> A | B.
Reassociate does this but it doesn't catch all cases (e.g. if the operands are i1).

llvm-svn: 113651
2010-09-10 22:39:55 +00:00

29 lines
609 B
LLVM

; RUN: opt < %s -instcombine -S | FileCheck %s
; PR1738
define i1 @test1(double %X, double %Y) {
%tmp9 = fcmp ord double %X, 0.000000e+00
%tmp13 = fcmp ord double %Y, 0.000000e+00
%bothcond = and i1 %tmp13, %tmp9
ret i1 %bothcond
; CHECK: fcmp ord double %Y, %X
}
define i1 @test2(i1 %X, i1 %Y) {
%a = and i1 %X, %Y
%b = and i1 %a, %X
ret i1 %b
; CHECK: @test2
; CHECK-NEXT: and i1 %X, %Y
; CHECK-NEXT: ret
}
define i32 @test3(i32 %X, i32 %Y) {
%a = and i32 %X, %Y
%b = and i32 %Y, %a
ret i32 %b
; CHECK: @test3
; CHECK-NEXT: and i32 %X, %Y
; CHECK-NEXT: ret
}