[JSON][PM] Port json import/export over to new pm
[polly-mirror.git] / test / ScopInfo / multiple-types-non-affine-2.ll
blob6fb4638bcf3f9e4de458afba99c52ff08ed7649d
1 ; RUN: opt %loadPolly -polly-allow-differing-element-types -polly-scops -polly-allow-nonaffine -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-allow-differing-element-types -polly-codegen -polly-allow-nonaffine -analyze
4 ;    // Check that accessing one array with different types works,
5 ;    // even though some accesses are non-affine.
6 ;    void multiple_types(char *Short, short *Char, char *Double) {
7 ;      for (long i = 0; i < 100; i++) {
8 ;        Short[i] = *(short *)&Short[i & 8];
9 ;        Char[i] = *(float *)&Char[i & 8];
10 ;        Double[i] = *(double *)&Double[i & 8];
11 ;      }
12 ;    }
14 ; CHECK:    Arrays {
15 ; CHECK:        i16 MemRef_Short[*]; // Element size 2
16 ; CHECK:        i8 MemRef_Char[*]; // Element size 1
17 ; CHECK:        i32 MemRef_Double[*]; // Element size 4
18 ; CHECK:    }
20 ; CHECK: Statements {
21 ; CHECK-NEXT: Stmt_bb2
22 ; CHECK-NEXT: Domain :=
23 ; CHECK-NEXT:     { Stmt_bb2[i0] : 0 <= i0 <= 99 };
24 ; CHECK-NEXT: Schedule :=
25 ; CHECK-NEXT:     { Stmt_bb2[i0] -> [i0] };
26 ; CHECK-NEXT: ReadAccess :=     [Reduction Type: NONE] [Scalar: 0]
27 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Short[16] : 16*floor((8 + i0)/16) > i0; Stmt_bb2[i0] -> MemRef_Short[0] : 16*floor((8 + i0)/16) <= i0 }
28 ; CHECK-NEXT: MustWriteAccess :=        [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Short[o0] : 2i0 <= o0 <= 1 + 2i0 };
30 ; CHECK-NEXT: ReadAccess :=     [Reduction Type: NONE] [Scalar: 0]
31 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Char[32] : 16*floor((8 + i0)/16) > i0; Stmt_bb2[i0] -> MemRef_Char[0] : 16*floor((8 + i0)/16) <= i0 }
32 ; CHECK-NEXT: MustWriteAccess :=        [Reduction Type: NONE] [Scalar: 0]
33 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Char[o0] : 4i0 <= o0 <= 3 + 4i0 };
34 ; CHECK-NEXT: ReadAccess :=     [Reduction Type: NONE] [Scalar: 0]
35 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Double[o0] : 0 <= o0 <= 9 and ((o0 >= 8 and 16*floor((8 + i0)/16) > i0) or (o0 <= 1 and 16*floor((8 + i0)/16) <= i0)) }
36 ; CHECK-NEXT: MustWriteAccess :=        [Reduction Type: NONE] [Scalar: 0]
37 ; CHECK-NEXT:     { Stmt_bb2[i0] -> MemRef_Double[i0] };
38 ; CHECK-NEXT: }
40 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
42 define void @multiple_types(i32* noalias %Short, i32* noalias %Char, i32* noalias %Double) {
43 bb:
44   br label %bb1
46 bb1:                                              ; preds = %bb20, %bb
47   %i.0 = phi i64 [ 0, %bb ], [ %tmp21, %bb20 ]
48   %exitcond = icmp ne i64 %i.0, 100
49   br i1 %exitcond, label %bb2, label %bb22
51 bb2:                                              ; preds = %bb1
52   %quad = and i64 %i.0, 8
53   %tmp3 = getelementptr inbounds i32, i32* %Short, i64 %quad
54   %tmp4 = bitcast i32* %tmp3 to i16*
55   %tmp5 = load i16, i16* %tmp4, align 2
56   %tmp6 = zext i16 %tmp5 to i32
57   %tmp7 = getelementptr inbounds i32, i32* %Short, i64 %i.0
58   store i32 %tmp6, i32* %tmp7, align 1
59   %tmp9 = getelementptr inbounds i32, i32* %Char, i64 %quad
60   %tmp10 = bitcast i32* %tmp9 to i8*
61   %tmp11 = load i8, i8* %tmp10, align 4
62   %tmp12 = zext i8 %tmp11 to i32
63   %tmp13 = getelementptr inbounds i32, i32* %Char, i64 %i.0
64   store i32 %tmp12, i32* %tmp13, align 1
65   %tmp15 = getelementptr inbounds i32, i32* %Double, i64 %quad
66   %tmp16 = bitcast i32* %tmp15 to double*
67   %tmp17 = load double, double* %tmp16, align 8
68   %tmp18 = fptosi double %tmp17 to i32
69   %tmp19 = getelementptr inbounds i32, i32* %Double, i64 %i.0
70   store i32 %tmp18, i32* %tmp19, align 1
71   br label %bb20
73 bb20:                                             ; preds = %bb2
74   %tmp21 = add nuw nsw i64 %i.0, 1
75   br label %bb1
77 bb22:                                             ; preds = %bb1
78   ret void