and-not-or.ll 630 B

12345678910111213141516171819202122232425262728293031323334
  1. ; RUN: opt < %s -instcombine -S | grep "and i32 %x, %y" | count 4
  2. ; RUN: opt < %s -instcombine -S | not grep "or"
  3. define i32 @func1(i32 %x, i32 %y) nounwind {
  4. entry:
  5. %n = xor i32 %y, -1
  6. %o = or i32 %n, %x
  7. %a = and i32 %o, %y
  8. ret i32 %a
  9. }
  10. define i32 @func2(i32 %x, i32 %y) nounwind {
  11. entry:
  12. %n = xor i32 %y, -1
  13. %o = or i32 %x, %n
  14. %a = and i32 %o, %y
  15. ret i32 %a
  16. }
  17. define i32 @func3(i32 %x, i32 %y) nounwind {
  18. entry:
  19. %n = xor i32 %y, -1
  20. %o = or i32 %n, %x
  21. %a = and i32 %y, %o
  22. ret i32 %a
  23. }
  24. define i32 @func4(i32 %x, i32 %y) nounwind {
  25. entry:
  26. %n = xor i32 %y, -1
  27. %o = or i32 %x, %n
  28. %a = and i32 %y, %o
  29. ret i32 %a
  30. }