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