Bill Wendling | a08bb49 | 2013-08-22 00:51:19 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s |
| 2 | |
Nick Lewycky | 31eaca5 | 2014-01-27 10:04:03 +0000 | [diff] [blame] | 3 | ; CHECK-LABEL: @test1 |
Bill Wendling | a08bb49 | 2013-08-22 00:51:19 +0000 | [diff] [blame] | 4 | ; CHECK: --> (zext |
| 5 | ; CHECK: --> (zext |
| 6 | ; CHECK-NOT: --> (zext |
Dan Gohman | 6350296e | 2009-05-18 16:29:04 +0000 | [diff] [blame] | 7 | |
Nick Lewycky | 31eaca5 | 2014-01-27 10:04:03 +0000 | [diff] [blame] | 8 | define i32 @test1(i32 %x) { |
Dan Gohman | 6350296e | 2009-05-18 16:29:04 +0000 | [diff] [blame] | 9 | %n = and i32 %x, 255 |
| 10 | %y = xor i32 %n, 255 |
| 11 | ret i32 %y |
| 12 | } |
Nick Lewycky | 31eaca5 | 2014-01-27 10:04:03 +0000 | [diff] [blame] | 13 | |
| 14 | ; ScalarEvolution shouldn't try to analyze %z into something like |
| 15 | ; --> (zext i4 (-1 + (-1 * (trunc i64 (8 * %x) to i4))) to i64) |
| 16 | ; or |
| 17 | ; --> (8 * (zext i1 (trunc i64 ((8 * %x) /u 8) to i1) to i64)) |
| 18 | |
| 19 | ; CHECK-LABEL: @test2 |
| 20 | ; CHECK: --> (8 * (zext i1 (trunc i64 %x to i1) to i64)) |
| 21 | |
| 22 | define i64 @test2(i64 %x) { |
| 23 | %a = shl i64 %x, 3 |
| 24 | %t = and i64 %a, 8 |
| 25 | %z = xor i64 %t, 8 |
| 26 | ret i64 %z |
| 27 | } |