blob: 993a37685e2bc8bc764f789b16604f99a33917fe [file] [log] [blame]
Reid Spencerea8b07e2007-03-23 20:48:34 +00001; 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
7implementation
8
9define i7 @test0(i7 %X) {
10 %Y = or i7 %X, 0
11 ret i7 %Y
12}
13
14define i17 @test1(i17 %X) {
15 %Y = or i17 %X, -1
16 ret i17 %Y
17}
18
19define 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
26define 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}