1 ; RUN: opt -licm -mtriple aarch64-linux-gnu -mattr=+sve -S < %s | FileCheck %s
3 define void @no_hoist_load1_nxv2i64(<vscale x 2 x i64>* %out, i8* %in8, i32 %n) {
4 ; CHECK-LABEL: @no_hoist_load1_nxv2i64(
10 %cmp0 = icmp ugt i32 %n, 0
11 %invst = call {}* @llvm.invariant.start.p0i8(i64 16, i8* %in8)
12 %in = bitcast i8* %in8 to <vscale x 2 x i64>*
13 br i1 %cmp0, label %for.body, label %for.end
16 %i = phi i32 [0, %entry], [%inc, %for.body]
17 %i2 = zext i32 %i to i64
18 %ptr = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %out, i64 %i2
19 %val = load <vscale x 2 x i64>, <vscale x 2 x i64>* %in, align 16
20 store <vscale x 2 x i64> %val, <vscale x 2 x i64>* %ptr, align 16
21 %inc = add nuw nsw i32 %i, 1
22 %cmp = icmp ult i32 %inc, %n
23 br i1 %cmp, label %for.body, label %for.end
29 define void @no_hoist_gather(<vscale x 2 x i32>* %out_ptr, <vscale x 2 x i32>* %in_ptr, <vscale x 2 x i64> %ptr_vec, i64 %n, <vscale x 2 x i1> %pred) {
30 ; CHECK-LABEL: @no_hoist_gather(
32 ; CHECK-NOT: llvm.aarch64.sve.ld1.gather.scalar.offset
34 ; CHECK: llvm.aarch64.sve.ld1.gather.scalar.offset
39 %i = phi i64 [0, %entry], [%inc, %for.body]
40 %gather = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i1> %pred, <vscale x 2 x i64> %ptr_vec, i64 0)
41 %in_ptr_gep = getelementptr <vscale x 2 x i32>, <vscale x 2 x i32>* %in_ptr, i64 %i
42 %in_ptr_load = load <vscale x 2 x i32>, <vscale x 2 x i32>* %in_ptr_gep, align 8
43 %sum = add <vscale x 2 x i32> %gather, %in_ptr_load
44 %out_ptr_gep = getelementptr <vscale x 2 x i32>, <vscale x 2 x i32>* %out_ptr, i64 %i
45 store <vscale x 2 x i32> %sum, <vscale x 2 x i32>* %out_ptr_gep, align 8
46 %inc = add nuw nsw i64 %i, 1
47 %cmp = icmp ult i64 %inc, %n
48 br i1 %cmp, label %for.body, label %for.end
54 define void @no_hoist_scatter(<vscale x 2 x i32>* %out_ptr, <vscale x 2 x i32>* %in_ptr, <vscale x 2 x i64> %ptr_vec, i64 %n, <vscale x 2 x i1> %pred) {
55 ; CHECK-LABEL: @no_hoist_scatter(
64 %i = phi i64 [0, %entry], [%inc, %for.body]
65 %in_ptr_load = load <vscale x 2 x i32>, <vscale x 2 x i32>* %in_ptr, align 8
66 call void @llvm.aarch64.sve.st1.scatter.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i32> %in_ptr_load, <vscale x 2 x i1> %pred, <vscale x 2 x i64> %ptr_vec, i64 %i)
67 %inc = add nuw nsw i64 %i, 1
68 %cmp = icmp ult i64 %inc, %n
69 br i1 %cmp, label %for.body, label %for.end
75 declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
77 declare void @llvm.aarch64.sve.st1.scatter.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i32>, <vscale x 2 x i1>, <vscale x 2 x i64>, i64)
79 declare <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i32.nxv2i64(<vscale x 2 x i1>, <vscale x 2 x i64>, i64)