1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s --data-layout="e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
3 ; RUN: opt < %s --data-layout="e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128" -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
5 ; In general, we can't deal with ashr.
6 define i32 @t0(i32 %x, i32 %y) {
8 ; CHECK-NEXT: Classifying expressions for: @t0
9 ; CHECK-NEXT: %i0 = ashr i32 %x, %y
10 ; CHECK-NEXT: --> %i0 U: full-set S: full-set
11 ; CHECK-NEXT: Determining loop execution counts for: @t0
16 ; Not even if we know it's exact
17 define i32 @t1(i32 %x, i32 %y) {
19 ; CHECK-NEXT: Classifying expressions for: @t1
20 ; CHECK-NEXT: %i0 = ashr exact i32 %x, %y
21 ; CHECK-NEXT: --> %i0 U: full-set S: full-set
22 ; CHECK-NEXT: Determining loop execution counts for: @t1
24 %i0 = ashr exact i32 %x, %y
27 ; Not even if the shift amount is a constant.
28 define i32 @t2(i32 %x, i32 %y) {
30 ; CHECK-NEXT: Classifying expressions for: @t2
31 ; CHECK-NEXT: %i0 = ashr i32 %x, 4
32 ; CHECK-NEXT: --> %i0 U: [-134217728,134217728) S: [-134217728,134217728)
33 ; CHECK-NEXT: Determining loop execution counts for: @t2
38 ; However, if it's a constant AND the shift is exact, we can model it!
39 define i32 @t3(i32 %x, i32 %y) {
41 ; CHECK-NEXT: Classifying expressions for: @t3
42 ; CHECK-NEXT: %i0 = ashr exact i32 %x, 4
43 ; CHECK-NEXT: --> %i0 U: [-134217728,134217728) S: [-134217728,134217728)
44 ; CHECK-NEXT: Determining loop execution counts for: @t3
46 %i0 = ashr exact i32 %x, 4
49 ; As long as the shift amount is in-bounds
50 define i32 @t4(i32 %x, i32 %y) {
52 ; CHECK-NEXT: Classifying expressions for: @t4
53 ; CHECK-NEXT: %i0 = ashr exact i32 %x, 32
54 ; CHECK-NEXT: --> %i0 U: [0,1) S: [0,1)
55 ; CHECK-NEXT: Determining loop execution counts for: @t4
57 %i0 = ashr exact i32 %x, 32
61 ; One more test, just to see that we model constant correctly
62 define i32 @t5(i32 %x, i32 %y) {
64 ; CHECK-NEXT: Classifying expressions for: @t5
65 ; CHECK-NEXT: %i0 = ashr exact i32 %x, 5
66 ; CHECK-NEXT: --> %i0 U: [-67108864,67108864) S: [-67108864,67108864)
67 ; CHECK-NEXT: Determining loop execution counts for: @t5
69 %i0 = ashr exact i32 %x, 5