1; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve.fp -loop-vectorize -tail-predication=enabled -S < %s | \
2; RUN:  FileCheck %s -check-prefixes=COMMON,CHECK
3
4; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve.fp -loop-vectorize -tail-predication=enabled-no-reductions -S < %s | \
5; RUN:  FileCheck %s -check-prefixes=COMMON,NORED
6
7; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve.fp -loop-vectorize -tail-predication=force-enabled-no-reductions -S < %s | \
8; RUN:  FileCheck %s -check-prefixes=COMMON,NORED
9
10; Check that this reduction is allowed, except when reductions are disable on
11; the command line.
12;
13define dso_local i32 @i32_add_reduction(i32* noalias nocapture readonly %B, i32 %N) local_unnamed_addr #0 {
14; COMMON-LABEL: i32_add_reduction(
15; COMMON:       entry:
16; CHECK:        @llvm.get.active.lane.mask
17; NORED-NOT:    @llvm.get.active.lane.mask
18; COMMON:       }
19entry:
20  %cmp6 = icmp sgt i32 %N, 0
21  br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
22
23for.body.preheader:
24  br label %for.body
25
26for.cond.cleanup.loopexit:
27  %add.lcssa = phi i32 [ %add, %for.body ]
28  br label %for.cond.cleanup
29
30for.cond.cleanup:
31  %S.0.lcssa = phi i32 [ 1, %entry ], [ %add.lcssa, %for.cond.cleanup.loopexit ]
32  ret i32 %S.0.lcssa
33
34for.body:
35  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
36  %S.07 = phi i32 [ %add, %for.body ], [ 1, %for.body.preheader ]
37  %arrayidx = getelementptr inbounds i32, i32* %B, i32 %i.08
38  %0 = load i32, i32* %arrayidx, align 4
39  %add = add nsw i32 %0, %S.07
40  %inc = add nuw nsw i32 %i.08, 1
41  %exitcond = icmp eq i32 %inc, %N
42  br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body
43}
44