1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve %s -run-pass=arm-low-overhead-loops -o - --verify-machineinstrs | FileCheck %s
5 define dso_local arm_aapcs_vfpcc zeroext i8 @non_masked_load(ptr nocapture readonly %a, ptr nocapture readonly %b, i32 %N) {
7 %cmp11 = icmp eq i32 %N, 0
10 %2 = shl nuw i32 %1, 4
13 %5 = add nuw nsw i32 %4, 1
14 br i1 %cmp11, label %for.cond.cleanup, label %vector.ph
16 vector.ph: ; preds = %entry
17 %start = call i32 @llvm.start.loop.iterations.i32(i32 %5)
22 vector.body: ; preds = %vector.body, %vector.ph
23 %lsr.iv20 = phi ptr [ %scevgep21, %vector.body ], [ %b, %vector.ph ]
24 %lsr.iv = phi ptr [ %scevgep, %vector.body ], [ %a, %vector.ph ]
25 %vec.phi = phi <16 x i8> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
26 %8 = phi i32 [ %start, %vector.ph ], [ %14, %vector.body ]
27 %9 = phi i32 [ %N, %vector.ph ], [ %11, %vector.body ]
28 %lsr.iv2022 = bitcast ptr %lsr.iv20 to ptr
29 %lsr.iv19 = bitcast ptr %lsr.iv to ptr
30 %10 = call <16 x i1> @llvm.arm.mve.vctp8(i32 %9)
32 %wide.masked.load = call <16 x i8> @llvm.masked.load.v16i8.p0(ptr %lsr.iv19, i32 1, <16 x i1> %10, <16 x i8> undef)
33 %wide.load16 = load <16 x i8>, ptr %lsr.iv2022
34 %12 = add <16 x i8> %wide.masked.load, %vec.phi
35 %13 = add <16 x i8> %12, %wide.load16
36 %scevgep = getelementptr i8, ptr %lsr.iv, i32 16
37 %scevgep21 = getelementptr i8, ptr %lsr.iv20, i32 16
38 %14 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %8, i32 1)
39 %15 = icmp ne i32 %14, 0
40 br i1 %15, label %vector.body, label %middle.block
42 middle.block: ; preds = %vector.body
43 %vec.phi.lcssa = phi <16 x i8> [ %vec.phi, %vector.body ]
44 %.lcssa = phi <16 x i8> [ %13, %vector.body ]
45 %16 = call <16 x i1> @llvm.arm.mve.vctp8(i32 %7)
46 %17 = select <16 x i1> %16, <16 x i8> %.lcssa, <16 x i8> %vec.phi.lcssa
47 %18 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %17)
48 br label %for.cond.cleanup
50 for.cond.cleanup: ; preds = %middle.block, %entry
51 %res.0.lcssa = phi i8 [ 0, %entry ], [ %18, %middle.block ]
55 declare <16 x i8> @llvm.masked.load.v16i8.p0(ptr, i32 immarg, <16 x i1>, <16 x i8>) #1
56 declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>) #2
57 declare i32 @llvm.start.loop.iterations.i32(i32) #3
58 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) #3
59 declare <16 x i1> @llvm.arm.mve.vctp8(i32) #4
65 exposesReturnsTwice: false
67 regBankSelected: false
70 tracksRegLiveness: true
74 - { reg: '$r0', virtual-reg: '' }
75 - { reg: '$r1', virtual-reg: '' }
76 - { reg: '$r2', virtual-reg: '' }
78 isFrameAddressTaken: false
79 isReturnAddressTaken: false
89 cvBytesOfCalleeSavedRegisters: 0
90 hasOpaqueSPAdjustment: false
92 hasMustTailInVarArgFunc: false
98 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
99 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
100 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
101 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
102 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
103 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
106 machineFunctionInfo: {}
108 ; CHECK-LABEL: name: non_masked_load
110 ; CHECK-NEXT: successors: %bb.1(0x80000000)
111 ; CHECK-NEXT: liveins: $lr, $r0, $r1, $r2, $r7
113 ; CHECK-NEXT: tCMPi8 renamable $r2, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
114 ; CHECK-NEXT: t2IT 0, 2, implicit-def $itstate
115 ; CHECK-NEXT: renamable $r0 = tMOVi8 $noreg, 0, 0 /* CC::eq */, $cpsr, implicit killed $r0, implicit $itstate
116 ; CHECK-NEXT: renamable $r0 = tUXTB killed renamable $r0, 0 /* CC::eq */, $cpsr, implicit killed $r0, implicit $itstate
117 ; CHECK-NEXT: tBX_RET 0 /* CC::eq */, killed $cpsr, implicit $r0, implicit killed $itstate
119 ; CHECK-NEXT: bb.1.vector.ph:
120 ; CHECK-NEXT: successors: %bb.2(0x80000000)
121 ; CHECK-NEXT: liveins: $lr, $r0, $r1, $r2
123 ; CHECK-NEXT: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $lr, implicit-def $sp, implicit $sp
124 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
125 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
126 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
127 ; CHECK-NEXT: dead $r7 = frame-setup tMOVr $sp, 14 /* CC::al */, $noreg
128 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_register $r7
129 ; CHECK-NEXT: renamable $r3 = t2ADDri renamable $r2, 15, 14 /* CC::al */, $noreg, $noreg
130 ; CHECK-NEXT: renamable $q0 = MVE_VMOVimmi32 0, 0, $noreg, $noreg, undef renamable $q0
131 ; CHECK-NEXT: renamable $r3 = t2BICri killed renamable $r3, 15, 14 /* CC::al */, $noreg, $noreg
132 ; CHECK-NEXT: renamable $r12 = t2SUBri killed renamable $r3, 16, 14 /* CC::al */, $noreg, $noreg
133 ; CHECK-NEXT: renamable $r3, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
134 ; CHECK-NEXT: renamable $lr = nuw nsw t2ADDrs killed renamable $r3, renamable $r12, 35, 14 /* CC::al */, $noreg, $noreg
135 ; CHECK-NEXT: renamable $r3 = t2LSRri killed renamable $r12, 4, 14 /* CC::al */, $noreg, $noreg
136 ; CHECK-NEXT: renamable $r3 = t2SUBrs renamable $r2, killed renamable $r3, 34, 14 /* CC::al */, $noreg, $noreg
138 ; CHECK-NEXT: bb.2.vector.body:
139 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
140 ; CHECK-NEXT: liveins: $lr, $q0, $r0, $r1, $r2, $r3
142 ; CHECK-NEXT: renamable $vpr = MVE_VCTP8 renamable $r2, 0, $noreg, $noreg
143 ; CHECK-NEXT: $q1 = MVE_VORR killed $q0, killed $q0, 0, $noreg, $noreg, undef $q1
144 ; CHECK-NEXT: MVE_VPST 2, implicit $vpr
145 ; CHECK-NEXT: renamable $r1, renamable $q0 = MVE_VLDRBU8_post killed renamable $r1, 16, 1, killed renamable $vpr, $noreg :: (load (s128) from %ir.lsr.iv2022, align 1)
146 ; CHECK-NEXT: renamable $r0, renamable $q2 = MVE_VLDRBU8_post killed renamable $r0, 16, 1, $noreg, $noreg :: (load (s128) from %ir.lsr.iv19, align 1)
147 ; CHECK-NEXT: renamable $r2, dead $cpsr = tSUBi8 killed renamable $r2, 16, 14 /* CC::al */, $noreg
148 ; CHECK-NEXT: renamable $q2 = MVE_VADDi8 killed renamable $q2, renamable $q1, 0, $noreg, $noreg, undef renamable $q2
149 ; CHECK-NEXT: renamable $q0 = MVE_VADDi8 killed renamable $q2, killed renamable $q0, 0, $noreg, $noreg, undef renamable $q0
150 ; CHECK-NEXT: $lr = t2LEUpdate killed renamable $lr, %bb.2
152 ; CHECK-NEXT: bb.3.middle.block:
153 ; CHECK-NEXT: liveins: $q0, $q1, $r3
155 ; CHECK-NEXT: renamable $vpr = MVE_VCTP8 killed renamable $r3, 0, $noreg, $noreg
156 ; CHECK-NEXT: renamable $q0 = MVE_VPSEL killed renamable $q0, killed renamable $q1, 0, killed renamable $vpr, $noreg
157 ; CHECK-NEXT: renamable $r0 = MVE_VADDVu8no_acc killed renamable $q0, 0, $noreg, $noreg
158 ; CHECK-NEXT: $sp = t2LDMIA_UPD $sp, 14 /* CC::al */, $noreg, def $r7, def $lr
159 ; CHECK-NEXT: renamable $r0 = tUXTB killed renamable $r0, 14 /* CC::al */, $noreg
160 ; CHECK-NEXT: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
162 successors: %bb.1(0x80000000)
163 liveins: $r0, $r1, $r2, $lr
165 tCMPi8 renamable $r2, 0, 14, $noreg, implicit-def $cpsr
166 t2IT 0, 2, implicit-def $itstate
167 renamable $r0 = tMOVi8 $noreg, 0, 0, $cpsr, implicit killed $r0, implicit $itstate
168 renamable $r0 = tUXTB killed renamable $r0, 0, $cpsr, implicit killed $r0, implicit $itstate
169 tBX_RET 0, killed $cpsr, implicit $r0, implicit killed $itstate
172 successors: %bb.2(0x80000000)
173 liveins: $r0, $r1, $r2, $lr
175 frame-setup tPUSH 14, $noreg, killed $lr, implicit-def $sp, implicit $sp
176 frame-setup CFI_INSTRUCTION def_cfa_offset 8
177 frame-setup CFI_INSTRUCTION offset $lr, -4
178 frame-setup CFI_INSTRUCTION offset $r7, -8
179 $r7 = frame-setup tMOVr $sp, 14, $noreg
180 frame-setup CFI_INSTRUCTION def_cfa_register $r7
181 renamable $r3 = t2ADDri renamable $r2, 15, 14, $noreg, $noreg
182 renamable $q0 = MVE_VMOVimmi32 0, 0, $noreg, $noreg, undef renamable $q0
183 renamable $r3 = t2BICri killed renamable $r3, 15, 14, $noreg, $noreg
184 renamable $r12 = t2SUBri killed renamable $r3, 16, 14, $noreg, $noreg
185 renamable $r3, dead $cpsr = tMOVi8 1, 14, $noreg
186 renamable $lr = nuw nsw t2ADDrs killed renamable $r3, renamable $r12, 35, 14, $noreg, $noreg
187 renamable $r3 = t2LSRri killed renamable $r12, 4, 14, $noreg, $noreg
188 renamable $r3 = t2SUBrs renamable $r2, killed renamable $r3, 34, 14, $noreg, $noreg
189 $lr = t2DoLoopStart renamable $lr
192 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
193 liveins: $lr, $q0, $r0, $r1, $r2, $r3
195 renamable $vpr = MVE_VCTP8 renamable $r2, 0, $noreg, $noreg
196 $q1 = MVE_VORR killed $q0, $q0, 0, $noreg, $noreg, undef $q1
197 MVE_VPST 2, implicit $vpr
198 renamable $r1, renamable $q0 = MVE_VLDRBU8_post killed renamable $r1, 16, 1, renamable $vpr, $noreg :: (load (s128) from %ir.lsr.iv2022, align 1)
199 renamable $r0, renamable $q2 = MVE_VLDRBU8_post killed renamable $r0, 16, 1, $noreg, $noreg :: (load (s128) from %ir.lsr.iv19, align 1)
200 renamable $r2, dead $cpsr = tSUBi8 killed renamable $r2, 16, 14, $noreg
201 renamable $q2 = MVE_VADDi8 killed renamable $q2, renamable $q1, 0, $noreg, $noreg, undef renamable $q2
202 renamable $lr = t2LoopDec killed renamable $lr, 1
203 renamable $q0 = MVE_VADDi8 killed renamable $q2, killed renamable $q0, 0, $noreg, $noreg, undef renamable $q0
204 t2LoopEnd renamable $lr, %bb.2, implicit-def dead $cpsr
208 liveins: $q0, $q1, $r3
210 renamable $vpr = MVE_VCTP8 killed renamable $r3, 0, $noreg, $noreg
211 renamable $q0 = MVE_VPSEL killed renamable $q0, killed renamable $q1, 0, killed renamable $vpr, $noreg
212 renamable $r0 = MVE_VADDVu8no_acc killed renamable $q0, 0, $noreg, $noreg
213 $sp = t2LDMIA_UPD $sp, 14, $noreg, def $r7, def $lr
214 renamable $r0 = tUXTB killed renamable $r0, 14, $noreg
215 tBX_RET 14, $noreg, implicit killed $r0