1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -align-loops=32 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=neoverse-n1 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-16
3 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=neoverse-n2 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-16
4 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=neoverse-v1 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-16
5 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-x1 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-16
6 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-x2 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-16
7 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a35 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-8
8 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a53 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-8
9 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a55 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-8
10 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a57 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-8
11 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a510 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-8
12 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a75 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-8
13 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a710 < %s -o -| FileCheck %s --check-prefixes=CHECK,CHECK-16
15 define i32 @a(i32 %x, ptr nocapture readonly %y, ptr nocapture readonly %z) {
16 ; CHECK-DEFAULT: .p2align 5
17 ; CHECK-8: .p2align 4, , 8
18 ; CHECK-16: .p2align 5, , 16
19 ; CHECK-NEXT: .LBB0_5: // %vector.body
20 ; CHECK-DEFAULT: .p2align 5
21 ; CHECK-8: .p2align 4, , 8
22 ; CHECK-16: .p2align 5, , 16
23 ; CHECK-NEXT: .LBB0_8: // %for.body
25 %cmp10 = icmp sgt i32 %x, 0
26 br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
28 for.body.preheader: ; preds = %entry
29 %wide.trip.count = zext i32 %x to i64
30 %min.iters.check = icmp ult i32 %x, 8
31 br i1 %min.iters.check, label %for.body.preheader17, label %vector.ph
33 vector.ph: ; preds = %for.body.preheader
34 %n.vec = and i64 %wide.trip.count, 4294967288
37 vector.body: ; preds = %vector.body, %vector.ph
38 %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
39 %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
40 %vec.phi13 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
41 %0 = getelementptr inbounds i32, ptr %y, i64 %index
42 %1 = bitcast ptr %0 to ptr
43 %wide.load = load <4 x i32>, ptr %1, align 4
44 %2 = getelementptr inbounds i32, ptr %0, i64 4
45 %3 = bitcast ptr %2 to ptr
46 %wide.load14 = load <4 x i32>, ptr %3, align 4
47 %4 = getelementptr inbounds i32, ptr %z, i64 %index
48 %5 = bitcast ptr %4 to ptr
49 %wide.load15 = load <4 x i32>, ptr %5, align 4
50 %6 = getelementptr inbounds i32, ptr %4, i64 4
51 %7 = bitcast ptr %6 to ptr
52 %wide.load16 = load <4 x i32>, ptr %7, align 4
53 %8 = add <4 x i32> %wide.load, %vec.phi
54 %9 = add <4 x i32> %wide.load14, %vec.phi13
55 %10 = add <4 x i32> %8, %wide.load15
56 %11 = add <4 x i32> %9, %wide.load16
57 %index.next = add nuw i64 %index, 8
58 %12 = icmp eq i64 %index.next, %n.vec
59 br i1 %12, label %middle.block, label %vector.body
61 middle.block: ; preds = %vector.body
62 %bin.rdx = add <4 x i32> %11, %10
63 %13 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
64 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
65 br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader17
67 for.body.preheader17: ; preds = %for.body.preheader, %middle.block
68 %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
69 %b.011.ph = phi i32 [ 0, %for.body.preheader ], [ %13, %middle.block ]
72 for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
73 %b.0.lcssa = phi i32 [ 0, %entry ], [ %13, %middle.block ], [ %add3, %for.body ]
76 for.body: ; preds = %for.body.preheader17, %for.body
77 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader17 ]
78 %b.011 = phi i32 [ %add3, %for.body ], [ %b.011.ph, %for.body.preheader17 ]
79 %arrayidx = getelementptr inbounds i32, ptr %y, i64 %indvars.iv
80 %14 = load i32, ptr %arrayidx, align 4
81 %arrayidx2 = getelementptr inbounds i32, ptr %z, i64 %indvars.iv
82 %15 = load i32, ptr %arrayidx2, align 4
83 %add = add i32 %14, %b.011
84 %add3 = add i32 %add, %15
85 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
86 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
87 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
90 declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)