1 ; RUN: opt %loadPolly -polly-print-scops -polly-allow-differing-element-types -disable-output < %s | FileCheck %s
3 ; void multiple_types(i8 *A) {
4 ; for (long i = 0; i < 100; i++) {
5 ; A[i] = *(i1 *)&A[1 * i] +
13 ; *(i120 *)&A[16 * i] +
14 ; *(i192 *)&A[24 * i] +
15 ; *(i248 *)&A[32 * i];
19 ; Verify that different data type sizes are correctly modeled. Specifically,
20 ; we want to verify that type i1 is modeled with allocation size i8,
21 ; type i24 is modeled with allocation size i32 and that i40, i48 and i56 are
22 ; modeled with allocation size i64. Larger types, e.g., i120, i192 and i248 are
23 ; not rounded up to the next power-of-two allocation size, but rather to the
24 ; next multiple of 64.
26 ; The allocation size discussed above defines the number of canonical array
27 ; elements accessed. For example, even though i24 only consists of 3 bytes,
28 ; its allocation size is 4 bytes. Consequently, we model the access to an
29 ; i24 element as an access to four canonical elements resulting in access
30 ; relation constraints '4i0 <= o0 <= 3 + 4i0' instead of '3i0 <= o0 <= 2 + 3i0'.
35 ; CHECK: { Stmt_bb2[i0] : 0 <= i0 <= 99 };
37 ; CHECK: { Stmt_bb2[i0] -> [i0] };
38 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
39 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 2i0 <= o0 <= 1 + 2i0 };
40 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
41 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 4i0 <= o0 <= 3 + 4i0 };
42 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
43 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 4i0 <= o0 <= 3 + 4i0 };
44 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
45 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 8i0 <= o0 <= 7 + 8i0 };
46 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
47 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 8i0 <= o0 <= 7 + 8i0 };
48 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
49 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 8i0 <= o0 <= 7 + 8i0 };
50 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
51 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 8i0 <= o0 <= 7 + 8i0 };
52 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
53 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 16i0 <= o0 <= 15 + 16i0 };
54 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
55 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 24i0 <= o0 <= 23 + 24i0 };
56 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
57 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[o0] : 32i0 <= o0 <= 31 + 32i0 };
58 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
59 ; CHECK: { Stmt_bb2[i0] -> MemRef_A[i0] };
62 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
64 define void @multiple_types(ptr %A) {
68 bb1: ; preds = %bb20, %bb
69 %i.0 = phi i64 [ 0, %bb ], [ %tmp21, %bb20 ]
70 %exitcond = icmp ne i64 %i.0, 100
71 br i1 %exitcond, label %bb2, label %bb22
74 %load.i1.offset = mul i64 %i.0, 1
75 %load.i1.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i1.offset
76 %load.i1.val = load i1, ptr %load.i1.ptr
77 %load.i1.val.trunc = zext i1 %load.i1.val to i8
79 %load.i16.offset = mul i64 %i.0, 2
80 %load.i16.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i16.offset
81 %load.i16.val = load i16, ptr %load.i16.ptr
82 %load.i16.val.trunc = trunc i16 %load.i16.val to i8
84 %load.i24.offset = mul i64 %i.0, 4
85 %load.i24.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i24.offset
86 %load.i24.val = load i24, ptr %load.i24.ptr
87 %load.i24.val.trunc = trunc i24 %load.i24.val to i8
89 %load.i32.offset = mul i64 %i.0, 4
90 %load.i32.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i32.offset
91 %load.i32.val = load i32, ptr %load.i32.ptr
92 %load.i32.val.trunc = trunc i32 %load.i32.val to i8
94 %load.i40.offset = mul i64 %i.0, 8
95 %load.i40.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i40.offset
96 %load.i40.val = load i40, ptr %load.i40.ptr
97 %load.i40.val.trunc = trunc i40 %load.i40.val to i8
99 %load.i48.offset = mul i64 %i.0, 8
100 %load.i48.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i48.offset
101 %load.i48.val = load i48, ptr %load.i48.ptr
102 %load.i48.val.trunc = trunc i48 %load.i48.val to i8
104 %load.i56.offset = mul i64 %i.0, 8
105 %load.i56.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i56.offset
106 %load.i56.val = load i56, ptr %load.i56.ptr
107 %load.i56.val.trunc = trunc i56 %load.i56.val to i8
109 %load.i64.offset = mul i64 %i.0, 8
110 %load.i64.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i64.offset
111 %load.i64.val = load i64, ptr %load.i64.ptr
112 %load.i64.val.trunc = trunc i64 %load.i64.val to i8
114 %load.i120.offset = mul i64 %i.0, 16
115 %load.i120.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i120.offset
116 %load.i120.val = load i120, ptr %load.i120.ptr
117 %load.i120.val.trunc = trunc i120 %load.i120.val to i8
119 %load.i192.offset = mul i64 %i.0, 24
120 %load.i192.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i192.offset
121 %load.i192.val = load i192, ptr %load.i192.ptr
122 %load.i192.val.trunc = trunc i192 %load.i192.val to i8
124 %load.i248.offset = mul i64 %i.0, 32
125 %load.i248.ptr = getelementptr inbounds i8, ptr %A, i64 %load.i248.offset
126 %load.i248.val = load i248, ptr %load.i248.ptr
127 %load.i248.val.trunc = trunc i248 %load.i248.val to i8
129 %sum = add i8 %load.i1.val.trunc, %load.i16.val.trunc
130 %sum0 = add i8 %sum, %load.i24.val.trunc
131 %sum1 = add i8 %sum0, %load.i32.val.trunc
132 %sum2 = add i8 %sum1, %load.i40.val.trunc
133 %sum3 = add i8 %sum2, %load.i48.val.trunc
134 %sum4 = add i8 %sum3, %load.i56.val.trunc
135 %sum5 = add i8 %sum4, %load.i64.val.trunc
136 %sum6 = add i8 %sum5, %load.i120.val.trunc
137 %sum7 = add i8 %sum6, %load.i192.val.trunc
138 %sum8 = add i8 %sum7, %load.i248.val.trunc
139 %tmp7 = getelementptr inbounds i8, ptr %A, i64 %i.0
140 store i8 %sum8, ptr %tmp7
144 %tmp21 = add nuw nsw i64 %i.0, 1