1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; Check that vscale call is recognised by load/store reg/reg pattern and
5 ; partially folded, with the rest pulled out of the loop.
7 define void @ld1w_reg_loop([32000 x i32]* %addr) {
8 ; CHECK-LABEL: ld1w_reg_loop:
9 ; CHECK: // %bb.0: // %entry
10 ; CHECK-NEXT: mov x8, xzr
12 ; CHECK-NEXT: ptrue p0.s
13 ; CHECK-NEXT: .LBB0_1: // %vector.body
14 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
15 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0, x8, lsl #2]
16 ; CHECK-NEXT: adds x8, x8, x9
17 ; CHECK-NEXT: b.ne .LBB0_1
18 ; CHECK-NEXT: // %bb.2: // %for.cond.cleanup
21 %0 = call i64 @llvm.vscale.i64()
26 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
27 %2 = getelementptr inbounds [32000 x i32], [32000 x i32]* %addr, i64 0, i64 %index
28 %3 = bitcast i32* %2 to <vscale x 4 x i32>*
29 %load = load volatile <vscale x 4 x i32>, <vscale x 4 x i32>* %3, align 16
30 %index.next = add i64 %index, %1
31 %4 = icmp eq i64 %index.next, 0
32 br i1 %4, label %for.cond.cleanup, label %vector.body
38 define void @st1w_reg_loop([32000 x i32]* %addr, <vscale x 4 x i32> %val) {
39 ; CHECK-LABEL: st1w_reg_loop:
40 ; CHECK: // %bb.0: // %entry
41 ; CHECK-NEXT: mov x8, xzr
43 ; CHECK-NEXT: ptrue p0.s
44 ; CHECK-NEXT: .LBB1_1: // %vector.body
45 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
46 ; CHECK-NEXT: st1w { z0.s }, p0, [x0, x8, lsl #2]
47 ; CHECK-NEXT: adds x8, x8, x9
48 ; CHECK-NEXT: b.ne .LBB1_1
49 ; CHECK-NEXT: // %bb.2: // %for.cond.cleanup
52 %0 = call i64 @llvm.vscale.i64()
57 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
58 %2 = getelementptr inbounds [32000 x i32], [32000 x i32]* %addr, i64 0, i64 %index
59 %3 = bitcast i32* %2 to <vscale x 4 x i32>*
60 store volatile <vscale x 4 x i32> %val, <vscale x 4 x i32>* %3, align 16
61 %index.next = add i64 %index, %1
62 %4 = icmp eq i64 %index.next, 0
63 br i1 %4, label %for.cond.cleanup, label %vector.body
69 declare i64 @llvm.vscale.i64()