1 ; RUN: opt -S -loop-vectorize -instcombine -force-vector-width=4 -force-vector-interleave=1 -enable-interleaved-mem-accesses=true < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 ; Check that the interleaved-mem-access analysis currently does not create an
6 ; interleave group for the access to array 'in' due to the possibly wrapping
7 ; unsigned 'out_ix' index.
9 ; In this test the interleave-group of the loads is not full (has gaps), so
10 ; the wrapping checks are necessary. Here this cannot be done statically so
11 ; runtime checks are needed, but with Assume=false getPtrStride cannot add
12 ; runtime checks and as a result we can't create the interleave-group.
14 ; FIXME: This is currently a missed optimization until we can use Assume=true
15 ; with proper threshold checks. Once we do that the candidate interleave-group
16 ; will not be invalidated by the wrapping checks.
19 ; void test(float * __restrict__ out, float * __restrict__ in, size_t size)
21 ; for (size_t out_offset = 0; out_offset < size; ++out_offset)
23 ; float t0 = in[2*out_offset];
24 ; out[out_offset] = t0;
29 ; CHECK-NOT: %wide.vec = load <8 x i32>, <8 x i32>* {{.*}}, align 4
30 ; CHECK-NOT: shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
32 define void @_Z4testPfS_m(float* noalias nocapture %out, float* noalias nocapture readonly %in, i64 %size) local_unnamed_addr {
34 %cmp7 = icmp eq i64 %size, 0
35 br i1 %cmp7, label %for.cond.cleanup, label %for.body.preheader
40 for.cond.cleanup.loopexit:
41 br label %for.cond.cleanup
47 %out_offset.08 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
48 %mul = shl i64 %out_offset.08, 1
49 %arrayidx = getelementptr inbounds float, float* %in, i64 %mul
50 %0 = bitcast float* %arrayidx to i32*
51 %1 = load i32, i32* %0, align 4
52 %arrayidx1 = getelementptr inbounds float, float* %out, i64 %out_offset.08
53 %2 = bitcast float* %arrayidx1 to i32*
54 store i32 %1, i32* %2, align 4
55 %inc = add nuw i64 %out_offset.08, 1
56 %exitcond = icmp eq i64 %inc, %size
57 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body