1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve -run-pass=arm-low-overhead-loops %s -o - --verify-machineinstrs | FileCheck %s
5 define dso_local arm_aapcs_vfpcc void @multi_cond_iter_count(ptr noalias nocapture %0, ptr nocapture readonly %1, i32 %2, i32 %3) {
7 %6 = select i1 %5, i32 2, i32 4
9 %8 = select i1 %7, i32 1, i32 %6
11 %10 = icmp eq i32 %9, 0
14 %13 = shl nuw i32 %12, 2
17 %16 = add nuw nsw i32 %15, 1
18 br i1 %10, label %34, label %17
21 %start = call i32 @llvm.start.loop.iterations.i32(i32 %16)
24 18: ; preds = %18, %17
25 %19 = phi ptr [ %31, %18 ], [ %0, %17 ]
26 %20 = phi ptr [ %30, %18 ], [ %1, %17 ]
27 %21 = phi i32 [ %start, %17 ], [ %32, %18 ]
28 %22 = phi i32 [ %9, %17 ], [ %26, %18 ]
29 %23 = bitcast ptr %19 to ptr
30 %24 = bitcast ptr %20 to ptr
31 %25 = call <4 x i1> @llvm.arm.mve.vctp32(i32 %22)
33 %27 = call <4 x i32> @llvm.masked.load.v4i32.p0(ptr %24, i32 4, <4 x i1> %25, <4 x i32> undef)
34 %28 = call <4 x i32> @llvm.masked.load.v4i32.p0(ptr %23, i32 4, <4 x i1> %25, <4 x i32> undef)
35 %29 = mul nsw <4 x i32> %28, %27
36 call void @llvm.masked.store.v4i32.p0(<4 x i32> %29, ptr %23, i32 4, <4 x i1> %25)
37 %30 = getelementptr i32, ptr %20, i32 4
38 %31 = getelementptr i32, ptr %19, i32 4
39 %32 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %21, i32 1)
40 %33 = icmp ne i32 %32, 0
41 br i1 %33, label %18, label %34
46 declare <4 x i32> @llvm.masked.load.v4i32.p0(ptr, i32 immarg, <4 x i1>, <4 x i32>)
47 declare void @llvm.masked.store.v4i32.p0(<4 x i32>, ptr, i32 immarg, <4 x i1>)
48 declare i32 @llvm.start.loop.iterations.i32(i32)
49 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32)
50 declare <4 x i1> @llvm.arm.mve.vctp32(i32)
54 name: multi_cond_iter_count
56 tracksRegLiveness: true
59 - { reg: '$r0', virtual-reg: '' }
60 - { reg: '$r1', virtual-reg: '' }
61 - { reg: '$r2', virtual-reg: '' }
62 - { reg: '$r3', virtual-reg: '' }
69 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
70 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
71 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
72 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
73 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
74 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
77 machineFunctionInfo: {}
79 ; CHECK-LABEL: name: multi_cond_iter_count
80 ; CHECK: bb.0 (%ir-block.4):
81 ; CHECK-NEXT: successors: %bb.1(0x80000000)
82 ; CHECK-NEXT: liveins: $lr, $r0, $r1, $r2, $r3
84 ; CHECK-NEXT: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $lr, implicit-def $sp, implicit $sp
85 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
86 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
87 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
88 ; CHECK-NEXT: dead $r7 = frame-setup tMOVr $sp, 14 /* CC::al */, $noreg
89 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_register $r7
90 ; CHECK-NEXT: tCMPi8 renamable $r3, 2, 14 /* CC::al */, $noreg, implicit-def $cpsr
91 ; CHECK-NEXT: $r12 = tMOVr $r3, 14 /* CC::al */, $noreg
92 ; CHECK-NEXT: t2IT 1, 8, implicit-def $itstate
93 ; CHECK-NEXT: $r12 = t2MOVi 4, 1 /* CC::ne */, killed $cpsr, $noreg, implicit killed renamable $r12, implicit killed $itstate
94 ; CHECK-NEXT: tCMPi8 killed renamable $r3, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr
95 ; CHECK-NEXT: t2IT 0, 8, implicit-def $itstate
96 ; CHECK-NEXT: $r12 = t2MOVi 1, 0 /* CC::eq */, killed $cpsr, $noreg, implicit killed renamable $r12, implicit killed $itstate
97 ; CHECK-NEXT: renamable $r2 = t2LSLrr killed renamable $r2, killed renamable $r12, 14 /* CC::al */, $noreg, def $cpsr
98 ; CHECK-NEXT: t2IT 0, 8, implicit-def $itstate
99 ; CHECK-NEXT: tPOP_RET 0 /* CC::eq */, killed $cpsr, def $r7, def $pc, implicit killed $itstate
101 ; CHECK-NEXT: bb.1 (%ir-block.17):
102 ; CHECK-NEXT: successors: %bb.2(0x80000000)
103 ; CHECK-NEXT: liveins: $r0, $r1, $r2
105 ; CHECK-NEXT: $r3 = tMOVr $r0, 14 /* CC::al */, $noreg
106 ; CHECK-NEXT: $lr = MVE_DLSTP_32 killed renamable $r2
108 ; CHECK-NEXT: bb.2 (%ir-block.18):
109 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
110 ; CHECK-NEXT: liveins: $lr, $r0, $r1, $r3
112 ; CHECK-NEXT: renamable $r1, renamable $q0 = MVE_VLDRWU32_post killed renamable $r1, 16, 0, $noreg, $noreg
113 ; CHECK-NEXT: renamable $r3, renamable $q1 = MVE_VLDRWU32_post killed renamable $r3, 16, 0, $noreg, $noreg
114 ; CHECK-NEXT: renamable $q0 = nsw MVE_VMULi32 killed renamable $q1, killed renamable $q0, 0, $noreg, $noreg, undef renamable $q0
115 ; CHECK-NEXT: MVE_VSTRWU32 killed renamable $q0, killed renamable $r0, 0, 0, killed $noreg, $noreg
116 ; CHECK-NEXT: $r0 = tMOVr $r3, 14 /* CC::al */, $noreg
117 ; CHECK-NEXT: $lr = MVE_LETP killed renamable $lr, %bb.2
119 ; CHECK-NEXT: bb.3 (%ir-block.34):
120 ; CHECK-NEXT: tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
122 successors: %bb.1(0x80000000)
123 liveins: $r0, $r1, $r2, $r3, $lr
125 frame-setup tPUSH 14, $noreg, killed $lr, implicit-def $sp, implicit $sp
126 frame-setup CFI_INSTRUCTION def_cfa_offset 8
127 frame-setup CFI_INSTRUCTION offset $lr, -4
128 frame-setup CFI_INSTRUCTION offset $r7, -8
129 $r7 = frame-setup tMOVr $sp, 14, $noreg
130 frame-setup CFI_INSTRUCTION def_cfa_register $r7
131 tCMPi8 renamable $r3, 2, 14, $noreg, implicit-def $cpsr
132 $r12 = tMOVr $r3, 14, $noreg
133 t2IT 1, 8, implicit-def $itstate
134 $r12 = t2MOVi 4, 1, killed $cpsr, $noreg, implicit killed renamable $r12, implicit killed $itstate
135 tCMPi8 killed renamable $r3, 4, 14, $noreg, implicit-def $cpsr
136 t2IT 0, 8, implicit-def $itstate
137 $r12 = t2MOVi 1, 0, killed $cpsr, $noreg, implicit killed renamable $r12, implicit killed $itstate
138 renamable $r2 = t2LSLrr killed renamable $r2, killed renamable $r12, 14, $noreg, def $cpsr
139 t2IT 0, 8, implicit-def $itstate
140 tPOP_RET 0, killed $cpsr, def $r7, def $pc, implicit killed $itstate
143 successors: %bb.2(0x80000000)
144 liveins: $r0, $r1, $r2, $r3, $lr
146 renamable $r3, dead $cpsr = tADDi3 renamable $r2, 3, 14, $noreg
147 renamable $r3 = t2BICri killed renamable $r3, 3, 14, $noreg, $noreg
148 renamable $r12 = t2SUBri killed renamable $r3, 4, 14, $noreg, $noreg
149 renamable $r3, dead $cpsr = tMOVi8 1, 14, $noreg
150 renamable $lr = nuw nsw t2ADDrs killed renamable $r3, killed renamable $r12, 19, 14, $noreg, $noreg
151 $r3 = tMOVr $r0, 14, $noreg
152 $lr = t2DoLoopStart renamable $lr
155 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
156 liveins: $lr, $r0, $r1, $r2, $r3
158 renamable $vpr = MVE_VCTP32 renamable $r2, 0, $noreg, $noreg
159 MVE_VPST 4, implicit $vpr
160 renamable $r1, renamable $q0 = MVE_VLDRWU32_post killed renamable $r1, 16, 1, renamable $vpr, $noreg
161 renamable $r3, renamable $q1 = MVE_VLDRWU32_post killed renamable $r3, 16, 1, renamable $vpr, $noreg
162 renamable $r2, dead $cpsr = tSUBi8 killed renamable $r2, 4, 14, $noreg
163 renamable $q0 = nsw MVE_VMULi32 killed renamable $q1, killed renamable $q0, 0, $noreg, $noreg, undef renamable $q0
164 MVE_VPST 8, implicit $vpr
165 MVE_VSTRWU32 killed renamable $q0, killed renamable $r0, 0, 1, killed renamable $vpr, $noreg
166 renamable $lr = t2LoopDec killed renamable $lr, 1
167 $r0 = tMOVr $r3, 14, $noreg
168 t2LoopEnd renamable $lr, %bb.2, implicit-def dead $cpsr
172 tPOP_RET 14, $noreg, def $r7, def $pc