switch-masked-bits.ll 575 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ; RUN: opt -S -simplifycfg < %s | FileCheck %s
  2. define i32 @test1(i32 %x) nounwind {
  3. %i = shl i32 %x, 1
  4. switch i32 %i, label %a [
  5. i32 21, label %b
  6. i32 24, label %c
  7. ]
  8. a:
  9. ret i32 0
  10. b:
  11. ret i32 3
  12. c:
  13. ret i32 5
  14. ; CHECK-LABEL: @test1(
  15. ; CHECK: %cond = icmp eq i32 %i, 24
  16. ; CHECK: %. = select i1 %cond, i32 5, i32 0
  17. ; CHECK: ret i32 %.
  18. }
  19. define i32 @test2(i32 %x) nounwind {
  20. %i = shl i32 %x, 1
  21. switch i32 %i, label %a [
  22. i32 21, label %b
  23. i32 23, label %c
  24. ]
  25. a:
  26. ret i32 0
  27. b:
  28. ret i32 3
  29. c:
  30. ret i32 5
  31. ; CHECK-LABEL: @test2(
  32. ; CHECK: ret i32 0
  33. }