1 ; RUN: opt -passes=loop-vectorize -hexagon-autohvx=1 -force-vector-width=64 -prefer-predicate-over-epilogue=predicate-dont-vectorize -S %s | FileCheck %s
3 target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
4 target triple = "hexagon"
8 ; Check that interleave groups and decisions based on them are correctly
9 ; invalidated with tail-folding on platforms where masked interleaved accesses
12 ; Make sure a vector body has been created, 64 element vectors are used and a block predicate has been computed.
13 ; Also make sure the loads are not widened.
17 ; CHECK: icmp ule <64 x i32> %vec.ind
18 ; CHECK-NOT: load <{{.*}} x i32>
21 define void @test1(ptr %arg, i32 %N) #0 {
26 loop: ; preds = %bb2, %bb
27 %iv = phi i32 [ %iv.next, %loop], [ 0, %entry ]
28 %idx.mul = mul nuw nsw i32 %iv, 7
29 %idx.start = add nuw nsw i32 %idx.mul, 1
30 %tmp6 = getelementptr inbounds i32, ptr %arg, i32 %idx.start
31 %tmp7 = load i32, ptr %tmp6, align 4
32 %tmp8 = add nuw nsw i32 %idx.start, 1
33 %tmp9 = getelementptr inbounds i32, ptr %arg, i32 %tmp8
34 %tmp10 = load i32, ptr %tmp9, align 4
35 %tmp11 = add nuw nsw i32 %idx.start, 2
36 %tmp12 = getelementptr inbounds i32, ptr %arg, i32 %tmp11
37 %tmp13 = load i32, ptr %tmp12, align 4
38 %tmp14 = add nuw nsw i32 %idx.start, 3
39 %tmp15 = getelementptr inbounds i32, ptr %arg, i32 %tmp14
40 %tmp16 = load i32, ptr %tmp15, align 4
41 %tmp18 = add nuw nsw i32 %idx.start, 4
42 %tmp19 = getelementptr inbounds i32, ptr %arg, i32 %tmp18
43 %tmp20 = load i32, ptr %tmp19, align 4
44 %tmp21 = add nuw nsw i32 %idx.start, 5
45 %tmp22 = getelementptr inbounds i32, ptr %arg, i32 %tmp21
46 %tmp23 = load i32, ptr %tmp22, align 4
47 %tmp25 = add nuw nsw i32 %idx.start, 6
48 %tmp26 = getelementptr inbounds i32, ptr %arg, i32 %tmp25
49 %tmp27 = load i32, ptr %tmp26, align 4
50 %add = add i32 %tmp7, %tmp27
51 store i32 %add, ptr %tmp, align 1
52 %iv.next= add nuw nsw i32 %iv, 1
53 %exit.cond = icmp eq i32 %iv.next, %N
54 br i1 %exit.cond, label %exit, label %loop
60 ; The loop below only requires tail folding due to interleave groups with gaps.
61 ; Make sure the loads are not widened.
65 ; CHECK-NOT: load <{{.*}} x i32>
66 define void @test2(ptr %arg) #1 {
71 loop: ; preds = %bb2, %bb
72 %iv = phi i32 [ %iv.next, %loop], [ 0, %entry ]
73 %idx.start = mul nuw nsw i32 %iv, 5
74 %tmp6 = getelementptr inbounds i32, ptr %arg, i32 %idx.start
75 %tmp7 = load i32, ptr %tmp6, align 4
76 %tmp8 = add nuw nsw i32 %idx.start, 1
77 %tmp9 = getelementptr inbounds i32, ptr %arg, i32 %tmp8
78 %tmp10 = load i32, ptr %tmp9, align 4
79 %tmp11 = add nuw nsw i32 %idx.start, 2
80 %tmp12 = getelementptr inbounds i32, ptr %arg, i32 %tmp11
81 %tmp13 = load i32, ptr %tmp12, align 4
82 %tmp14 = add nuw nsw i32 %idx.start, 3
83 %tmp15 = getelementptr inbounds i32, ptr %arg, i32 %tmp14
84 %tmp16 = load i32, ptr %tmp15, align 4
85 %add = add i32 %tmp7, %tmp16
86 store i32 %add, ptr %tmp, align 1
87 %iv.next= add nuw nsw i32 %iv, 1
88 %exit.cond = icmp eq i32 %iv.next, 128
89 br i1 %exit.cond, label %exit, label %loop
96 attributes #0 = { "target-features"="+hvx,+hvx-length128b" }
97 attributes #1 = { optsize "target-features"="+hvx,+hvx-length128b" }