1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv64 -mattr=+m,+v,+f -target-abi=lp64f \
3 ; RUN: -disable-machine-licm | FileCheck %s
5 ; Make sure we don't unnecessrily sink i1 vector splats.
7 declare <8 x i1> @llvm.vp.and.v4i1(<8 x i1>, <8 x i1>, <8 x i1>, i32)
9 define void @sink_splat_vp_and_i1(ptr nocapture %a, i1 zeroext %x, <8 x i1> %m, i32 zeroext %vl) {
10 ; CHECK-LABEL: sink_splat_vp_and_i1:
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
13 ; CHECK-NEXT: vmv.v.x v8, a1
14 ; CHECK-NEXT: vmsne.vi v8, v8, 0
15 ; CHECK-NEXT: addi a1, a0, 1024
16 ; CHECK-NEXT: .LBB0_1: # %vector.body
17 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
18 ; CHECK-NEXT: vlm.v v9, (a0)
19 ; CHECK-NEXT: vsetvli zero, a2, e8, mf2, ta, ma
20 ; CHECK-NEXT: vmand.mm v9, v9, v8
21 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
22 ; CHECK-NEXT: vsm.v v9, (a0)
23 ; CHECK-NEXT: addi a0, a0, 1
24 ; CHECK-NEXT: bne a0, a1, .LBB0_1
25 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup
28 %broadcast.splatinsert = insertelement <8 x i1> poison, i1 %x, i32 0
29 %broadcast.splat = shufflevector <8 x i1> %broadcast.splatinsert, <8 x i1> poison, <8 x i32> zeroinitializer
32 vector.body: ; preds = %vector.body, %entry
33 %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
34 %0 = getelementptr inbounds i8, ptr %a, i64 %index
35 %wide.load = load <8 x i1>, ptr %0, align 4
36 %1 = call <8 x i1> @llvm.vp.and.v4i1(<8 x i1> %wide.load, <8 x i1> %broadcast.splat, <8 x i1> %m, i32 %vl)
37 store <8 x i1> %1, ptr %0, align 1
38 %index.next = add nuw i64 %index, 1
39 %2 = icmp eq i64 %index.next, 1024
40 br i1 %2, label %for.cond.cleanup, label %vector.body
42 for.cond.cleanup: ; preds = %vector.body