Home | History | Annotate | Download | only in InstCombine
      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: opt < %s -instcombine -S | not grep or
      6 
      7 
      8 define i7 @test0(i7 %X) {
      9     %Y = or i7 %X, 0
     10     ret i7 %Y
     11 }
     12 
     13 define i17 @test1(i17 %X) {
     14     %Y = or i17 %X, -1
     15     ret i17 %Y
     16 } 
     17 
     18 define i23 @test2(i23 %A) {
     19     ;; A | ~A == -1
     20     %NotA = xor i23 -1, %A
     21     %B = or i23 %A, %NotA
     22     ret i23 %B
     23 }
     24 
     25 define i39 @test3(i39 %V, i39 %M) {
     26     ;; If we have: ((V + N) & C1) | (V & C2)
     27     ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
     28     ;; replace with V+N.
     29     %C1 = xor i39 274877906943, -1 ;; C2 = 274877906943
     30     %N = and i39 %M, 274877906944
     31     %A = add i39 %V, %N
     32     %B = and i39 %A, %C1
     33     %D = and i39 %V, 274877906943
     34     %R = or i39 %B, %D
     35     ret i39 %R
     36 }
     37