Add test case for testing InstCombine with arbitrary precision integer
[oota-llvm.git] / test / Transforms / InstCombine / apint-or1.ll
1 ; This test makes sure that or instructions are properly eliminated.
2 ; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0.
3 ;
4
5 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or
6
7 implementation
8
9 define i7 @test0(i7 %X) {
10     %Y = or i7 %X, 0
11     ret i7 %Y
12 }
13
14 define i17 @test1(i17 %X) {
15     %Y = or i17 %X, -1
16     ret i17 %Y
17
18
19 define i23 @test2(i23 %A) {
20     ;; A | ~A == -1
21     %NotA = xor i23 -1, %A
22     %B = or i23 %A, %NotA
23     ret i23 %B
24 }
25
26 define i39 @test3(i39 %V, i39 %M) {
27     ;; If we have: ((V + N) & C1) | (V & C2)
28     ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
29     ;; replace with V+N.
30     %C1 = xor i39 274877906943, -1 ;; C2 = 274877906943
31     %N = and i39 %M, 274877906944
32     %A = add i39 %V, %N
33     %B = and i39 %A, %C1
34     %D = and i39 %V, 274877906943
35     %R = or i39 %B, %D
36     ret i39 %R
37 }