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