Home | History | Annotate | Download | only in InstCombine
      1 ; This test makes sure that add instructions are properly eliminated.
      2 ; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
      3 
      4 ; RUN: opt < %s -instcombine -S | \
      5 ; RUN:    grep -v OK | not grep add
      6 
      7 
      8 define i1 @test1(i1 %x) {
      9         %tmp.2 = xor i1 %x, 1
     10         ;; Add of sign bit -> xor of sign bit.
     11         %tmp.4 = add i1 %tmp.2, 1
     12         ret i1 %tmp.4
     13 }
     14 
     15 define i47 @test2(i47 %x) {
     16         %tmp.2 = xor i47 %x, 70368744177664
     17         ;; Add of sign bit -> xor of sign bit.
     18         %tmp.4 = add i47 %tmp.2, 70368744177664
     19         ret i47 %tmp.4
     20 }
     21 
     22 define i15 @test3(i15 %x) {
     23         %tmp.2 = xor i15 %x, 16384
     24         ;; Add of sign bit -> xor of sign bit.
     25         %tmp.4 = add i15 %tmp.2, 16384
     26         ret i15 %tmp.4
     27 }
     28 
     29 define i49 @test6(i49 %x) {
     30         ;; (x & 254)+1 -> (x & 254)|1
     31         %tmp.2 = and i49 %x, 562949953421310
     32         %tmp.4 = add i49 %tmp.2, 1
     33         ret i49 %tmp.4
     34 }
     35