and-xor.ll 628 B

123456789101112131415161718192021222324252627
  1. ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
  2. ; CHECK-LABEL: @test1
  3. ; CHECK: --> (zext
  4. ; CHECK: --> (zext
  5. ; CHECK-NOT: --> (zext
  6. define i32 @test1(i32 %x) {
  7. %n = and i32 %x, 255
  8. %y = xor i32 %n, 255
  9. ret i32 %y
  10. }
  11. ; ScalarEvolution shouldn't try to analyze %z into something like
  12. ; --> (zext i4 (-1 + (-1 * (trunc i64 (8 * %x) to i4))) to i64)
  13. ; or
  14. ; --> (8 * (zext i1 (trunc i64 ((8 * %x) /u 8) to i1) to i64))
  15. ; CHECK-LABEL: @test2
  16. ; CHECK: --> (8 * (zext i1 (trunc i64 %x to i1) to i64))
  17. define i64 @test2(i64 %x) {
  18. %a = shl i64 %x, 3
  19. %t = and i64 %a, 8
  20. %z = xor i64 %t, 8
  21. ret i64 %z
  22. }