1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2
3; Check that we correctly convert integers to isl values.
4
5target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
6
7; Large positive integer
8define void @f(i1024* nocapture %a) nounwind {
9entry:
10  br label %bb
11
12bb:
13  %indvar = phi i1024 [ 0, %entry ], [ %indvar.next, %bb ]
14  store i1024 %indvar, i1024* %a, align 8
15  %indvar.next = add nsw i1024 %indvar, 1
16  %exitcond = icmp eq i1024 %indvar, 123456000000000000000000000
17; CHECK-LABEL: Function: f
18; CHECK-NEXT: Region: %bb---%return
19; CHECK: i0 <= 123456000000000000000000000
20  br i1 %exitcond, label %return, label %bb
21
22return:
23  ret void
24}
25
26; Normal positive integer
27define void @f2(i32* nocapture %a) nounwind {
28entry:
29  br label %bb
30
31bb:
32  %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]
33  %scevgep = getelementptr i32, i32* %a, i32 %indvar
34  store i32 %indvar, i32* %scevgep, align 8
35  %indvar.next = add nsw i32 %indvar, 1
36  %exitcond = icmp eq i32 %indvar, 123456
37; CHECK-LABEL: Function: f2
38; CHECK-NEXT: Region: %bb---%return
39; CHECK: i0 <= 123456
40  br i1 %exitcond, label %return, label %bb
41
42return:
43  ret void
44}
45
46; Normal negative integer
47define void @f3(i32* nocapture %a, i32 %n) nounwind {
48entry:
49  br label %bb
50
51bb:
52  %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]
53  %scevgep = getelementptr i32, i32* %a, i32 %indvar
54  store i32 %indvar, i32* %scevgep, align 8
55  %indvar.next = add nsw i32 %indvar, 1
56  %sub = sub i32 %n, 123456
57  %exitcond = icmp eq i32 %indvar, %sub
58; CHECK-LABEL: Function: f3
59; CHECK-NEXT: Region: %bb---%return
60; CHECK: -123456
61  br i1 %exitcond, label %return, label %bb
62
63return:
64  ret void
65}
66
67; Large negative integer
68define void @f4(i1024* nocapture %a, i1024 %n) nounwind {
69entry:
70  br label %bb
71
72bb:
73  %indvar = phi i1024 [ 0, %entry ], [ %indvar.next, %bb ]
74  %scevgep = getelementptr i1024, i1024* %a, i1024 %indvar
75  store i1024 %indvar, i1024* %scevgep, align 8
76  %indvar.next = add nsw i1024 %indvar, 1
77  %sub = sub i1024 %n, 123456000000000000000000000000000000
78; CHECK-LABEL: Function: f4
79; CHECK-NEXT: Region: %bb---%return
80; CHECK: -123456000000000000000000000000000000
81  %exitcond = icmp eq i1024 %indvar, %sub
82  br i1 %exitcond, label %return, label %bb
83
84return:
85  ret void
86}
87
88define void @f5(i1023* nocapture %a, i1023 %n) nounwind {
89entry:
90  br label %bb
91
92bb:
93  %indvar = phi i1023 [ 0, %entry ], [ %indvar.next, %bb ]
94  %scevgep = getelementptr i1023, i1023* %a, i1023 %indvar
95  store i1023 %indvar, i1023* %scevgep, align 8
96  %indvar.next = add nsw i1023 %indvar, 1
97  %sub = sub i1023 %n, 123456000000000000000000000000000000
98; CHECK-LABEL: Function: f5
99; CHECK-NEXT: Region: %bb---%return
100; CHECK: -123456000000000000000000000000000000
101  %exitcond = icmp eq i1023 %indvar, %sub
102  br i1 %exitcond, label %return, label %bb
103
104return:
105  ret void
106}
107
108; Tiny negative integer
109define void @f6(i3* nocapture %a, i3 %n) nounwind {
110entry:
111  br label %bb
112
113bb:
114  %indvar = phi i3 [ 0, %entry ], [ %indvar.next, %bb ]
115  %scevgep = getelementptr i3, i3* %a, i3 %indvar
116  store i3 %indvar, i3* %scevgep, align 8
117  %indvar.next = add nsw i3 %indvar, 1
118  %sub = sub i3 %n, 3
119; CHECK-LABEL: Function: f6
120; CHECK-NEXT: Region: %bb---%return
121; CHECK:         Context:
122; CHECK-NEXT:    [n] -> {  : -4 <= n <= 3 }
123; CHECK-NEXT:    Assumed Context:
124; CHECK-NEXT:    [n] -> {  :  }
125; CHECK-NEXT:    Invalid Context:
126; CHECK-NEXT:    [n] -> {  : false }
127
128; CHECK:     Statements {
129; CHECK-NEXT:    Stmt_bb
130; CHECK-NEXT:        Domain :=
131; CHECK-NEXT:            [n] -> { Stmt_bb[i0] : i0 >= 0 and 8*floor((2 - n)/8) >= -5 - n + i0 and 8*floor((2 - n)/8) <= -2 - n };
132; CHECK-NEXT:        Schedule :=
133; CHECK-NEXT:            [n] -> { Stmt_bb[i0] -> [i0] };
134; CHECK-NEXT:        MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
135; CHECK-NEXT:            [n] -> { Stmt_bb[i0] -> MemRef_a[i0] };
136; CHECK-NEXT:}
137
138  %exitcond = icmp eq i3 %indvar, %sub
139  br i1 %exitcond, label %return, label %bb
140
141return:
142  ret void
143}
144