merge-icmp.ll 734 B

1234567891011121314151617181920212223242526272829
  1. ; RUN: opt -S -instcombine < %s | FileCheck %s
  2. define i1 @test1(i16* %x) {
  3. %load = load i16, i16* %x, align 4
  4. %trunc = trunc i16 %load to i8
  5. %cmp1 = icmp eq i8 %trunc, 127
  6. %and = and i16 %load, -256
  7. %cmp2 = icmp eq i16 %and, 17664
  8. %or = and i1 %cmp1, %cmp2
  9. ret i1 %or
  10. ; CHECK-LABEL: @test1(
  11. ; CHECK-NEXT: load i16
  12. ; CHECK-NEXT: icmp eq i16 %load, 17791
  13. ; CHECK-NEXT: ret i1
  14. }
  15. define i1 @test2(i16* %x) {
  16. %load = load i16, i16* %x, align 4
  17. %and = and i16 %load, -256
  18. %cmp1 = icmp eq i16 %and, 32512
  19. %trunc = trunc i16 %load to i8
  20. %cmp2 = icmp eq i8 %trunc, 69
  21. %or = and i1 %cmp1, %cmp2
  22. ret i1 %or
  23. ; CHECK-LABEL: @test2(
  24. ; CHECK-NEXT: load i16
  25. ; CHECK-NEXT: icmp eq i16 %load, 32581
  26. ; CHECK-NEXT: ret i1
  27. }