1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve -verify-machineinstrs -tail-predication=enabled -o - %s | FileCheck %s
4 define arm_aapcs_vfpcc void @usub_sat(i16* noalias nocapture readonly %pSrcA, i16* noalias nocapture readonly %pSrcB, i16* noalias nocapture %pDst, i32 %blockSize) {
5 ; CHECK-LABEL: usub_sat:
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: .save {r7, lr}
8 ; CHECK-NEXT: push {r7, lr}
9 ; CHECK-NEXT: cmp r3, #0
11 ; CHECK-NEXT: popeq {r7, pc}
12 ; CHECK-NEXT: .LBB0_1: @ %vector.ph
13 ; CHECK-NEXT: dlstp.16 lr, r3
14 ; CHECK-NEXT: .LBB0_2: @ %vector.body
15 ; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
16 ; CHECK-NEXT: vldrh.u16 q0, [r1], #16
17 ; CHECK-NEXT: vldrh.u16 q1, [r0], #16
18 ; CHECK-NEXT: vqsub.u16 q0, q1, q0
19 ; CHECK-NEXT: vstrh.16 q0, [r2], #16
20 ; CHECK-NEXT: letp lr, .LBB0_2
21 ; CHECK-NEXT: @ %bb.3: @ %while.end
22 ; CHECK-NEXT: pop {r7, pc}
24 %cmp7 = icmp eq i32 %blockSize, 0
25 br i1 %cmp7, label %while.end, label %vector.ph
27 vector.ph: ; preds = %entry
28 %n.rnd.up = add i32 %blockSize, 7
29 %n.vec = and i32 %n.rnd.up, -8
32 vector.body: ; preds = %vector.body, %vector.ph
33 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
34 %next.gep = getelementptr i16, i16* %pSrcA, i32 %index
35 %next.gep20 = getelementptr i16, i16* %pDst, i32 %index
36 %next.gep21 = getelementptr i16, i16* %pSrcB, i32 %index
37 %active.lane.mask = call <8 x i1> @llvm.get.active.lane.mask.v8i1.i32(i32 %index, i32 %blockSize)
38 %0 = bitcast i16* %next.gep to <8 x i16>*
39 %wide.masked.load = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %0, i32 2, <8 x i1> %active.lane.mask, <8 x i16> undef)
40 %1 = bitcast i16* %next.gep21 to <8 x i16>*
41 %wide.masked.load24 = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %1, i32 2, <8 x i1> %active.lane.mask, <8 x i16> undef)
42 %2 = call <8 x i16> @llvm.usub.sat.v8i16(<8 x i16> %wide.masked.load, <8 x i16> %wide.masked.load24)
43 %3 = bitcast i16* %next.gep20 to <8 x i16>*
44 call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %2, <8 x i16>* %3, i32 2, <8 x i1> %active.lane.mask)
45 %index.next = add i32 %index, 8
46 %4 = icmp eq i32 %index.next, %n.vec
47 br i1 %4, label %while.end, label %vector.body
49 while.end: ; preds = %vector.body, %entry
53 define arm_aapcs_vfpcc void @ssub_sat(i16* noalias nocapture readonly %pSrcA, i16* noalias nocapture readonly %pSrcB, i16* noalias nocapture %pDst, i32 %blockSize) {
54 ; CHECK-LABEL: ssub_sat:
55 ; CHECK: @ %bb.0: @ %entry
56 ; CHECK-NEXT: .save {r7, lr}
57 ; CHECK-NEXT: push {r7, lr}
58 ; CHECK-NEXT: cmp r3, #0
60 ; CHECK-NEXT: popeq {r7, pc}
61 ; CHECK-NEXT: .LBB1_1: @ %vector.ph
62 ; CHECK-NEXT: dlstp.16 lr, r3
63 ; CHECK-NEXT: .LBB1_2: @ %vector.body
64 ; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
65 ; CHECK-NEXT: vldrh.u16 q0, [r1], #16
66 ; CHECK-NEXT: vldrh.u16 q1, [r0], #16
67 ; CHECK-NEXT: vqsub.s16 q0, q1, q0
68 ; CHECK-NEXT: vstrh.16 q0, [r2], #16
69 ; CHECK-NEXT: letp lr, .LBB1_2
70 ; CHECK-NEXT: @ %bb.3: @ %while.end
71 ; CHECK-NEXT: pop {r7, pc}
73 %cmp7 = icmp eq i32 %blockSize, 0
74 br i1 %cmp7, label %while.end, label %vector.ph
76 vector.ph: ; preds = %entry
77 %n.rnd.up = add i32 %blockSize, 7
78 %n.vec = and i32 %n.rnd.up, -8
81 vector.body: ; preds = %vector.body, %vector.ph
82 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
83 %next.gep = getelementptr i16, i16* %pSrcA, i32 %index
84 %next.gep20 = getelementptr i16, i16* %pDst, i32 %index
85 %next.gep21 = getelementptr i16, i16* %pSrcB, i32 %index
86 %active.lane.mask = call <8 x i1> @llvm.get.active.lane.mask.v8i1.i32(i32 %index, i32 %blockSize)
87 %0 = bitcast i16* %next.gep to <8 x i16>*
88 %wide.masked.load = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %0, i32 2, <8 x i1> %active.lane.mask, <8 x i16> undef)
89 %1 = bitcast i16* %next.gep21 to <8 x i16>*
90 %wide.masked.load24 = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %1, i32 2, <8 x i1> %active.lane.mask, <8 x i16> undef)
91 %2 = call <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16> %wide.masked.load, <8 x i16> %wide.masked.load24)
92 %3 = bitcast i16* %next.gep20 to <8 x i16>*
93 call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %2, <8 x i16>* %3, i32 2, <8 x i1> %active.lane.mask)
94 %index.next = add i32 %index, 8
95 %4 = icmp eq i32 %index.next, %n.vec
96 br i1 %4, label %while.end, label %vector.body
98 while.end: ; preds = %vector.body, %entry
102 declare <8 x i1> @llvm.get.active.lane.mask.v8i1.i32(i32, i32)
104 declare <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>*, i32 immarg, <8 x i1>, <8 x i16>)
106 declare <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16>, <8 x i16>)
108 declare <8 x i16> @llvm.usub.sat.v8i16(<8 x i16>, <8 x i16>)
110 declare void @llvm.masked.store.v8i16.p0v8i16(<8 x i16>, <8 x i16>*, i32 immarg, <8 x i1>)