apint-add1.ll 910 B

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