apint-select.ll 961 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ; This test makes sure that these instructions are properly eliminated.
  2. ; RUN: opt < %s -instcombine -S | FileCheck %s
  3. ; CHECK-NOT: select
  4. define i41 @test1(i1 %C) {
  5. %V = select i1 %C, i41 1, i41 0 ; V = C
  6. ret i41 %V
  7. }
  8. define i999 @test2(i1 %C) {
  9. %V = select i1 %C, i999 0, i999 1 ; V = C
  10. ret i999 %V
  11. }
  12. define i41 @test3(i41 %X) {
  13. ;; (x <s 0) ? -1 : 0 -> ashr x, 31
  14. %t = icmp slt i41 %X, 0
  15. %V = select i1 %t, i41 -1, i41 0
  16. ret i41 %V
  17. }
  18. define i1023 @test4(i1023 %X) {
  19. ;; (x <s 0) ? -1 : 0 -> ashr x, 31
  20. %t = icmp slt i1023 %X, 0
  21. %V = select i1 %t, i1023 -1, i1023 0
  22. ret i1023 %V
  23. }
  24. define i41 @test5(i41 %X) {
  25. ;; ((X & 27) ? 27 : 0)
  26. %Y = and i41 %X, 32
  27. %t = icmp ne i41 %Y, 0
  28. %V = select i1 %t, i41 32, i41 0
  29. ret i41 %V
  30. }
  31. define i1023 @test6(i1023 %X) {
  32. ;; ((X & 27) ? 27 : 0)
  33. %Y = and i1023 %X, 64
  34. %t = icmp ne i1023 %Y, 0
  35. %V = select i1 %t, i1023 64, i1023 0
  36. ret i1023 %V
  37. }