[x86] Make the 'x86-64' cpu, what I see as and many use as the generic
[oota-llvm.git] / test / Analysis / Delinearization / a.ll
1 ; RUN: opt < %s -analyze -delinearize | FileCheck %s
2 ;
3 ; void foo(long n, long m, long o, int A[n][m][o]) {
4 ;   for (long i = 0; i < n; i++)
5 ;     for (long j = 0; j < m; j++)
6 ;       for (long k = 0; k < o; k++)
7 ;         A[2*i+3][3*j-4][5*k+7] = 1;
8 ; }
9
10 ; AddRec: {{{(28 + (4 * (-4 + (3 * %m)) * %o) + %A),+,(8 * %m * %o)}<%for.i>,+,(12 * %o)}<%for.j>,+,20}<%for.k>
11 ; CHECK: Base offset: %A
12 ; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of sizeof(i32) bytes.
13 ; CHECK: ArrayRef[{3,+,2}<%for.i>][{-4,+,3}<%for.j>][{7,+,5}<%for.k>]
14
15 ; AddRec: {{(8 + ((4 + (12 * %m)) * %o) + %A),+,(8 * %m * %o)}<%for.i>,+,(12 * %o)}<%for.j>
16 ; CHECK: Base offset: %A
17 ; CHECK: ArrayDecl[UnknownSize][%o] with elements of sizeof(i32) bytes.
18 ; CHECK: ArrayRef[{(1 + (3 * %m)),+,(2 * %m)}<%for.i>][{2,+,(3 * %o)}<%for.j>]
19
20 ; AddRec: {(8 + ((-8 + (24 * %m)) * %o) + %A),+,(8 * %m * %o)}<%for.i>
21 ; CHECK: Base offset: %A
22 ; CHECK: ArrayDecl[UnknownSize] with elements of 2 bytes.
23 ; CHECK: ArrayRef[{((1 + ((-1 + (3 * %m)) * %o)) * sizeof(i32)),+,(%m * %o * sizeof(i32))}<%for.i>]
24
25 ; Function Attrs: nounwind uwtable
26 define void @foo(i64 %n, i64 %m, i64 %o, i32* nocapture %A) #0 {
27 entry:
28   %cmp32 = icmp sgt i64 %n, 0
29   br i1 %cmp32, label %for.cond1.preheader.lr.ph, label %for.end17
30
31 for.cond1.preheader.lr.ph:                        ; preds = %entry
32   %cmp230 = icmp sgt i64 %m, 0
33   %cmp528 = icmp sgt i64 %o, 0
34   br i1 %cmp230, label %for.i, label %for.end17
35
36 for.inc15.us:                                     ; preds = %for.inc12.us.us, %for.i
37   %inc16.us = add nsw i64 %i.033.us, 1
38   %exitcond55 = icmp eq i64 %inc16.us, %n
39   br i1 %exitcond55, label %for.end17, label %for.i
40
41 for.i:                     ; preds = %for.cond1.preheader.lr.ph, %for.inc15.us
42   %i.033.us = phi i64 [ %inc16.us, %for.inc15.us ], [ 0, %for.cond1.preheader.lr.ph ]
43   %mul8.us = shl i64 %i.033.us, 1
44   %add9.us = add nsw i64 %mul8.us, 3
45   %0 = mul i64 %add9.us, %m
46   %sub.us = add i64 %0, -4
47   br i1 %cmp528, label %for.j, label %for.inc15.us
48
49 for.inc12.us.us:                                  ; preds = %for.k
50   %inc13.us.us = add nsw i64 %j.031.us.us, 1
51   %exitcond54 = icmp eq i64 %inc13.us.us, %m
52   br i1 %exitcond54, label %for.inc15.us, label %for.j
53
54 for.j:                            ; preds = %for.i, %for.inc12.us.us
55   %j.031.us.us = phi i64 [ %inc13.us.us, %for.inc12.us.us ], [ 0, %for.i ]
56   %mul7.us.us = mul nsw i64 %j.031.us.us, 3
57   %tmp.us.us = add i64 %sub.us, %mul7.us.us
58   %tmp27.us.us = mul i64 %tmp.us.us, %o
59   br label %for.k
60
61 for.k:                                  ; preds = %for.k, %for.j
62   %k.029.us.us = phi i64 [ 0, %for.j ], [ %inc.us.us, %for.k ]
63   %mul.us.us = mul nsw i64 %k.029.us.us, 5
64   %arrayidx.sum.us.us = add i64 %mul.us.us, 7
65   %arrayidx10.sum.us.us = add i64 %arrayidx.sum.us.us, %tmp27.us.us
66   %arrayidx11.us.us = getelementptr inbounds i32* %A, i64 %arrayidx10.sum.us.us
67   store i32 1, i32* %arrayidx11.us.us, align 4
68   %inc.us.us = add nsw i64 %k.029.us.us, 1
69   %exitcond = icmp eq i64 %inc.us.us, %o
70   br i1 %exitcond, label %for.inc12.us.us, label %for.k
71
72 for.end17:                                        ; preds = %for.inc15.us, %for.cond1.preheader.lr.ph, %entry
73   ret void
74 }