1 ; RUN: opt -S -instsimplify < %s | FileCheck %s
3 define i1 @test(i32 %a) {
7 %and = and i32 %a, %rhs
8 %res = icmp eq i32 %and, 1
12 define i1 @test2(i32 %a) {
16 %and = and i32 %a, %rhs
17 %res = icmp eq i32 %and, 1
21 define i1 @test3(i32 %a) {
25 %and = and i32 %a, %rhs
26 %res = icmp eq i32 %and, 1
30 @B = external global i32
31 declare void @llvm.assume(i1)
33 ; Known bits without a constant
34 define i1 @test4(i32 %a) {
37 %b = load i32, i32* @B
38 %b.and = and i32 %b, 1
39 %b.cnd = icmp eq i32 %b.and, 1
40 call void @llvm.assume(i1 %b.cnd)
43 %and = and i32 %a, %rhs
44 %res = icmp eq i32 %and, 1
48 ; Negative test - even number
49 define i1 @test5(i32 %a) {
53 %and = and i32 %a, %rhs
54 %res = icmp eq i32 %and, 1
58 define i1 @test6(i32 %a) {
62 %and = and i32 %lhs, %a
63 %res = icmp eq i32 %and, 1