[AArch64] Turn on by default interleaved access vectorization
[oota-llvm.git] / test / Transforms / LoopVectorize / AArch64 / interleaved_cost.ll
1 ; RUN: opt -S -debug-only=loop-vectorize -loop-vectorize -instcombine < %s 2>&1 | FileCheck %s
2 ; REQUIRES: asserts
3
4 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64--linux-gnueabi"
6
7 @AB = common global [1024 x i8] zeroinitializer, align 4
8 @CD = common global [1024 x i8] zeroinitializer, align 4
9
10 define void @test_byte_interleaved_cost(i8 %C, i8 %D) {
11 entry:
12   br label %for.body
13
14 ; 8xi8 and 16xi8 are valid i8 vector types, so the cost of the interleaved
15 ; access group is 2.
16
17 ; CHECK: LV: Found an estimated cost of 2 for VF 8 For instruction:   %tmp = load i8, i8* %arrayidx0, align 4
18 ; CHECK: LV: Found an estimated cost of 2 for VF 16 For instruction:   %tmp = load i8, i8* %arrayidx0, align 4
19
20 for.body:                                         ; preds = %for.body, %entry
21   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
22   %arrayidx0 = getelementptr inbounds [1024 x i8], [1024 x i8]* @AB, i64 0, i64 %indvars.iv
23   %tmp = load i8, i8* %arrayidx0, align 4
24   %tmp1 = or i64 %indvars.iv, 1
25   %arrayidx1 = getelementptr inbounds [1024 x i8], [1024 x i8]* @AB, i64 0, i64 %tmp1
26   %tmp2 = load i8, i8* %arrayidx1, align 4
27   %add = add nsw i8 %tmp, %C
28   %mul = mul nsw i8 %tmp2, %D
29   %arrayidx2 = getelementptr inbounds [1024 x i8], [1024 x i8]* @CD, i64 0, i64 %indvars.iv
30   store i8 %add, i8* %arrayidx2, align 4
31   %arrayidx3 = getelementptr inbounds [1024 x i8], [1024 x i8]* @CD, i64 0, i64 %tmp1
32   store i8 %mul, i8* %arrayidx3, align 4
33   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
34   %cmp = icmp slt i64 %indvars.iv.next, 1024
35   br i1 %cmp, label %for.body, label %for.end
36
37 for.end:                                          ; preds = %for.body
38   ret void
39 }