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.fp -verify-machineinstrs -tail-predication=enabled -o - %s | FileCheck %s
3 %struct.SpeexPreprocessState_ = type { i32, i32, half*, half* }
5 define void @foo(%struct.SpeexPreprocessState_* nocapture readonly %st, i16* %x) {
7 ; CHECK: @ %bb.0: @ %entry
8 ; CHECK-NEXT: .save {r4, lr}
9 ; CHECK-NEXT: push {r4, lr}
10 ; CHECK-NEXT: ldrd r12, r2, [r0]
11 ; CHECK-NEXT: ldrd r4, r3, [r0, #8]
12 ; CHECK-NEXT: rsb r12, r12, r2, lsl #1
13 ; CHECK-NEXT: dlstp.16 lr, r12
14 ; CHECK-NEXT: .LBB0_1: @ %do.body
15 ; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
16 ; CHECK-NEXT: vldrh.u16 q0, [r3], #16
17 ; CHECK-NEXT: vstrh.16 q0, [r4], #16
18 ; CHECK-NEXT: letp lr, .LBB0_1
19 ; CHECK-NEXT: @ %bb.2: @ %do.end
20 ; CHECK-NEXT: ldr r2, [r0]
21 ; CHECK-NEXT: ldr r0, [r0, #8]
22 ; CHECK-NEXT: vmov.i16 q0, #0x1800
23 ; CHECK-NEXT: add.w r0, r0, r12, lsl #1
24 ; CHECK-NEXT: dlstp.16 lr, r2
25 ; CHECK-NEXT: .LBB0_3: @ %do.body6
26 ; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
27 ; CHECK-NEXT: vldrh.u16 q1, [r1], #16
28 ; CHECK-NEXT: vcvt.f16.s16 q1, q1
29 ; CHECK-NEXT: vmul.f16 q1, q1, q0
30 ; CHECK-NEXT: vstrh.16 q1, [r0], #16
31 ; CHECK-NEXT: letp lr, .LBB0_3
32 ; CHECK-NEXT: @ %bb.4: @ %do.end13
33 ; CHECK-NEXT: pop {r4, pc}
35 %ps_size = getelementptr inbounds %struct.SpeexPreprocessState_, %struct.SpeexPreprocessState_* %st, i32 0, i32 1
36 %0 = load i32, i32* %ps_size, align 4
37 %mul = shl nsw i32 %0, 1
38 %frame_size = getelementptr inbounds %struct.SpeexPreprocessState_, %struct.SpeexPreprocessState_* %st, i32 0, i32 0
39 %1 = load i32, i32* %frame_size, align 4
40 %sub = sub nsw i32 %mul, %1
41 %inbuf = getelementptr inbounds %struct.SpeexPreprocessState_, %struct.SpeexPreprocessState_* %st, i32 0, i32 3
42 %2 = load half*, half** %inbuf, align 4
43 %frame = getelementptr inbounds %struct.SpeexPreprocessState_, %struct.SpeexPreprocessState_* %st, i32 0, i32 2
44 %3 = load half*, half** %frame, align 4
47 do.body: ; preds = %do.body, %entry
48 %pinbuff16.0 = phi half* [ %2, %entry ], [ %add.ptr, %do.body ]
49 %blkCnt.0 = phi i32 [ %sub, %entry ], [ %sub2, %do.body ]
50 %pframef16.0 = phi half* [ %3, %entry ], [ %add.ptr1, %do.body ]
51 %4 = tail call <8 x i1> @llvm.arm.mve.vctp16(i32 %blkCnt.0)
52 %5 = bitcast half* %pinbuff16.0 to <8 x half>*
53 %6 = tail call fast <8 x half> @llvm.masked.load.v8f16.p0v8f16(<8 x half>* %5, i32 2, <8 x i1> %4, <8 x half> zeroinitializer)
54 %7 = bitcast half* %pframef16.0 to <8 x half>*
55 tail call void @llvm.masked.store.v8f16.p0v8f16(<8 x half> %6, <8 x half>* %7, i32 2, <8 x i1> %4)
56 %add.ptr = getelementptr inbounds half, half* %pinbuff16.0, i32 8
57 %add.ptr1 = getelementptr inbounds half, half* %pframef16.0, i32 8
58 %sub2 = add nsw i32 %blkCnt.0, -8
59 %cmp = icmp sgt i32 %blkCnt.0, 8
60 br i1 %cmp, label %do.body, label %do.end
62 do.end: ; preds = %do.body
63 %8 = load half*, half** %frame, align 4
64 %add.ptr4 = getelementptr inbounds half, half* %8, i32 %sub
65 %9 = load i32, i32* %frame_size, align 4
68 do.body6: ; preds = %do.body6, %do.end
69 %px.0 = phi i16* [ %x, %do.end ], [ %add.ptr8, %do.body6 ]
70 %blkCnt.1 = phi i32 [ %9, %do.end ], [ %sub10, %do.body6 ]
71 %pframef16.1 = phi half* [ %add.ptr4, %do.end ], [ %add.ptr9, %do.body6 ]
72 %10 = tail call <8 x i1> @llvm.arm.mve.vctp16(i32 %blkCnt.1)
73 %11 = bitcast i16* %px.0 to <8 x i16>*
74 %12 = tail call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %11, i32 2, <8 x i1> %10, <8 x i16> zeroinitializer)
75 %13 = tail call fast <8 x half> @llvm.arm.mve.vcvt.fp.int.predicated.v8f16.v8i16.v8i1(<8 x i16> %12, i32 0, <8 x i1> %10, <8 x half> undef)
76 %14 = tail call fast <8 x half> @llvm.arm.mve.mul.predicated.v8f16.v8i1(<8 x half> %13, <8 x half> <half 0xH1800, half 0xH1800, half 0xH1800, half 0xH1800, half 0xH1800, half 0xH1800, half 0xH1800, half 0xH1800>, <8 x i1> %10, <8 x half> undef)
77 %15 = bitcast half* %pframef16.1 to <8 x half>*
78 tail call void @llvm.masked.store.v8f16.p0v8f16(<8 x half> %14, <8 x half>* %15, i32 2, <8 x i1> %10)
79 %add.ptr8 = getelementptr inbounds i16, i16* %px.0, i32 8
80 %add.ptr9 = getelementptr inbounds half, half* %pframef16.1, i32 8
81 %sub10 = add nsw i32 %blkCnt.1, -8
82 %cmp12 = icmp sgt i32 %blkCnt.1, 8
83 br i1 %cmp12, label %do.body6, label %do.end13
85 do.end13: ; preds = %do.body6
89 declare <8 x i1> @llvm.arm.mve.vctp16(i32)
91 declare <8 x half> @llvm.masked.load.v8f16.p0v8f16(<8 x half>*, i32 immarg, <8 x i1>, <8 x half>)
93 declare void @llvm.masked.store.v8f16.p0v8f16(<8 x half>, <8 x half>*, i32 immarg, <8 x i1>)
95 declare <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>*, i32 immarg, <8 x i1>, <8 x i16>)
97 declare <8 x half> @llvm.arm.mve.vcvt.fp.int.predicated.v8f16.v8i16.v8i1(<8 x i16>, i32, <8 x i1>, <8 x half>)
99 declare <8 x half> @llvm.arm.mve.mul.predicated.v8f16.v8i1(<8 x half>, <8 x half>, <8 x i1>, <8 x half>)