1 ; This test makes sure that and instructions are properly eliminated.
2 ; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
4 ; RUN: opt < %s -instcombine -S | not grep {and }
8 define i999 @test0(i999 %A) {
9 %B = and i999 %A, 0 ; zero result
13 define i477 @test1(i477 %A, i477 %B) {
14 ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
15 %NotA = xor i477 %A, -1
16 %NotB = xor i477 %B, -1
17 %C1 = and i477 %NotA, %NotB
21 define i129 @tst(i129 %A, i129 %B) {
22 ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
23 %NotA = xor i129 %A, -1
24 %NotB = xor i129 %B, -1
25 %C1 = and i129 %NotA, %NotB
29 define i65 @test(i65 %A, i65 %B) {
30 ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
31 %NotA = xor i65 %A, -1
32 %NotB = xor i65 -1, %B
33 %C1 = and i65 %NotA, %NotB
37 define i66 @tes(i66 %A, i66 %B) {
38 ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
39 %NotA = xor i66 %A, -1
40 %NotB = xor i66 %B, -1
41 %C1 = and i66 %NotA, %NotB
45 define i1005 @test2(i1005 %x) {
46 %tmp.2 = and i1005 %x, -1 ; noop
50 define i123 @test3(i123 %x) {
51 %tmp.0 = and i123 %x, 127
52 %tmp.2 = and i123 %tmp.0, 128
56 define i1 @test4(i737 %x) {
57 %A = and i737 %x, -2147483648
58 %B = icmp ne i737 %A, 0
62 define i117 @test5(i117 %A, i117* %P) {
65 store i117 %C, i117* %P
70 define i117 @test6(i117 %A, i117 %B) {
71 ;; ~(~X & Y) --> (X | ~Y)
73 %t1 = and i117 %t0, %B
78 define i1024 @test7(i1024 %A) {
79 %X = ashr i1024 %A, 1016 ;; sign extend
80 %C1 = and i1024 %X, 255