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 - | FileCheck %s 3 4--- | 5 define arm_aapcs_vfpcc void @test_vqrshruntq_n_s32(<4 x i32>* %a, <4 x i32>* %b, <4 x i32>* %c, i32 %elts, i32 %iters) { 6 entry: 7 %cmp = icmp slt i32 %elts, 1 8 br i1 %cmp, label %exit, label %loop.ph 9 10 loop.ph: ; preds = %entry 11 %start = call i32 @llvm.start.loop.iterations.i32(i32 %iters) 12 br label %loop.body 13 14 loop.body: ; preds = %loop.body, %loop.ph 15 %lsr.iv = phi i32 [ %lsr.iv.next, %loop.body ], [ %start, %loop.ph ] 16 %count = phi i32 [ %elts, %loop.ph ], [ %elts.rem, %loop.body ] 17 %addr.a = phi <4 x i32>* [ %a, %loop.ph ], [ %addr.a.next, %loop.body ] 18 %addr.b = phi <4 x i32>* [ %b, %loop.ph ], [ %addr.b.next, %loop.body ] 19 %addr.c = phi <4 x i32>* [ %c, %loop.ph ], [ %addr.c.next, %loop.body ] 20 %pred = call <4 x i1> @llvm.arm.mve.vctp32(i32 %count) 21 %elts.rem = sub i32 %count, 4 22 %masked.load.a = call <4 x i32> @llvm.masked.load.v4i32.p0v4i32(<4 x i32>* %addr.a, i32 4, <4 x i1> %pred, <4 x i32> undef) 23 %masked.load.b = call <4 x i32> @llvm.masked.load.v4i32.p0v4i32(<4 x i32>* %addr.b, i32 4, <4 x i1> %pred, <4 x i32> undef) 24 %bitcast.a = bitcast <4 x i32> %masked.load.a to <8 x i16> 25 %shrn = call <8 x i16> @llvm.arm.mve.vshrn.v8i16.v4i32(<8 x i16> %bitcast.a, <4 x i32> %masked.load.b, i32 3, i32 1, i32 0, i32 1, i32 0, i32 1) 26 %bitcast = bitcast <8 x i16> %shrn to <4 x i32> 27 call void @llvm.masked.store.v4i32.p0v4i32(<4 x i32> %bitcast, <4 x i32>* %addr.c, i32 4, <4 x i1> %pred) 28 %addr.a.next = getelementptr <4 x i32>, <4 x i32>* %addr.a, i32 1 29 %addr.b.next = getelementptr <4 x i32>, <4 x i32>* %addr.b, i32 1 30 %addr.c.next = getelementptr <4 x i32>, <4 x i32>* %addr.c, i32 1 31 %loop.dec = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %lsr.iv, i32 1) 32 %end = icmp ne i32 %loop.dec, 0 33 %lsr.iv.next = add i32 %lsr.iv, -1 34 br i1 %end, label %loop.body, label %exit 35 36 exit: ; preds = %loop.body, %entry 37 ret void 38 } 39 40 define arm_aapcs_vfpcc void @test_vqrshruntq_n_s16(<8 x i16>* %a, <8 x i16>* %b, <8 x i16>* %c, i32 %elts, i32 %iters) { 41 entry: 42 %cmp = icmp slt i32 %elts, 1 43 br i1 %cmp, label %exit, label %loop.ph 44 45 loop.ph: ; preds = %entry 46 %start = call i32 @llvm.start.loop.iterations.i32(i32 %iters) 47 br label %loop.body 48 49 loop.body: ; preds = %loop.body, %loop.ph 50 %lsr.iv = phi i32 [ %lsr.iv.next, %loop.body ], [ %start, %loop.ph ] 51 %count = phi i32 [ %elts, %loop.ph ], [ %elts.rem, %loop.body ] 52 %addr.a = phi <8 x i16>* [ %a, %loop.ph ], [ %addr.a.next, %loop.body ] 53 %addr.b = phi <8 x i16>* [ %b, %loop.ph ], [ %addr.b.next, %loop.body ] 54 %addr.c = phi <8 x i16>* [ %c, %loop.ph ], [ %addr.c.next, %loop.body ] 55 %pred = call <8 x i1> @llvm.arm.mve.vctp16(i32 %count) 56 %elts.rem = sub i32 %count, 8 57 %masked.load.a = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %addr.a, i32 2, <8 x i1> %pred, <8 x i16> undef) 58 %masked.load.b = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %addr.b, i32 2, <8 x i1> %pred, <8 x i16> undef) 59 %bitcast.a = bitcast <8 x i16> %masked.load.a to <16 x i8> 60 %shrn = call <16 x i8> @llvm.arm.mve.vshrn.v16i8.v8i16(<16 x i8> %bitcast.a, <8 x i16> %masked.load.b, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1) 61 %bitcast = bitcast <16 x i8> %shrn to <8 x i16> 62 call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %bitcast, <8 x i16>* %addr.c, i32 2, <8 x i1> %pred) 63 %addr.a.next = getelementptr <8 x i16>, <8 x i16>* %addr.b, i32 1 64 %addr.b.next = getelementptr <8 x i16>, <8 x i16>* %addr.b, i32 1 65 %addr.c.next = getelementptr <8 x i16>, <8 x i16>* %addr.c, i32 1 66 %loop.dec = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %lsr.iv, i32 1) 67 %end = icmp ne i32 %loop.dec, 0 68 %lsr.iv.next = add i32 %lsr.iv, -1 69 br i1 %end, label %loop.body, label %exit 70 71 exit: ; preds = %loop.body, %entry 72 ret void 73 } 74 75 declare i32 @llvm.start.loop.iterations.i32(i32) 76 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) 77 declare <4 x i1> @llvm.arm.mve.vctp32(i32) 78 declare <4 x i32> @llvm.masked.load.v4i32.p0v4i32(<4 x i32>*, i32 immarg, <4 x i1>, <4 x i32>) 79 declare void @llvm.masked.store.v4i32.p0v4i32(<4 x i32>, <4 x i32>*, i32 immarg, <4 x i1>) 80 declare <8 x i16> @llvm.arm.mve.vshrn.v8i16.v4i32(<8 x i16>, <4 x i32>, i32, i32, i32, i32, i32, i32) 81 declare <8 x i1> @llvm.arm.mve.vctp16(i32) 82 declare <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>*, i32 immarg, <8 x i1>, <8 x i16>) 83 declare void @llvm.masked.store.v8i16.p0v8i16(<8 x i16>, <8 x i16>*, i32 immarg, <8 x i1>) 84 declare <16 x i8> @llvm.arm.mve.vshrn.v16i8.v8i16(<16 x i8>, <8 x i16>, i32, i32, i32, i32, i32, i32) 85 86... 87--- 88name: test_vqrshruntq_n_s32 89alignment: 2 90tracksRegLiveness: true 91registers: [] 92liveins: 93 - { reg: '$r0', virtual-reg: '' } 94 - { reg: '$r1', virtual-reg: '' } 95 - { reg: '$r2', virtual-reg: '' } 96 - { reg: '$r3', virtual-reg: '' } 97frameInfo: 98 stackSize: 8 99 offsetAdjustment: 0 100 maxAlignment: 4 101 restorePoint: '' 102fixedStack: 103 - { id: 0, type: default, offset: 0, size: 4, alignment: 8, stack-id: default, 104 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 105 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 106stack: 107 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 108 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false, 109 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 110 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 111 stack-id: default, callee-saved-register: '$r4', callee-saved-restored: true, 112 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 113callSites: [] 114constants: [] 115machineFunctionInfo: {} 116body: | 117 ; CHECK-LABEL: name: test_vqrshruntq_n_s32 118 ; CHECK: bb.0.entry: 119 ; CHECK: successors: %bb.1(0x80000000) 120 ; CHECK: liveins: $lr, $r0, $r1, $r2, $r3, $r4 121 ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp 122 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 123 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4 124 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -8 125 ; CHECK: tCMPi8 renamable $r3, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr 126 ; CHECK: t2IT 11, 8, implicit-def $itstate 127 ; CHECK: tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r4, def $pc, implicit killed $itstate 128 ; CHECK: bb.1.loop.ph: 129 ; CHECK: successors: %bb.2(0x80000000) 130 ; CHECK: liveins: $r0, $r1, $r2, $r3 131 ; CHECK: renamable $r4 = tLDRspi $sp, 2, 14 /* CC::al */, $noreg :: (load 4 from %fixed-stack.0, align 8) 132 ; CHECK: dead $lr = MVE_DLSTP_32 killed renamable $r3 133 ; CHECK: $r12 = tMOVr killed $r4, 14 /* CC::al */, $noreg 134 ; CHECK: bb.2.loop.body: 135 ; CHECK: successors: %bb.2(0x7c000000), %bb.3(0x04000000) 136 ; CHECK: liveins: $r0, $r1, $r2, $r12 137 ; CHECK: $lr = tMOVr $r12, 14 /* CC::al */, $noreg 138 ; CHECK: renamable $r12 = t2SUBri killed $r12, 1, 14 /* CC::al */, $noreg, $noreg 139 ; CHECK: renamable $r1, renamable $q0 = MVE_VLDRWU32_post killed renamable $r1, 16, 0, $noreg :: (load 16 from %ir.addr.b, align 4) 140 ; CHECK: renamable $r0, renamable $q1 = MVE_VLDRWU32_post killed renamable $r0, 16, 0, $noreg :: (load 16 from %ir.addr.a, align 4) 141 ; CHECK: renamable $q1 = MVE_VQSHRUNs32th killed renamable $q1, killed renamable $q0, 3, 0, $noreg 142 ; CHECK: renamable $r2 = MVE_VSTRWU32_post killed renamable $q1, killed renamable $r2, 16, 0, killed $noreg :: (store 16 into %ir.addr.c, align 4) 143 ; CHECK: dead $lr = MVE_LETP killed renamable $lr, %bb.2 144 ; CHECK: bb.3.exit: 145 ; CHECK: tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $pc 146 bb.0.entry: 147 successors: %bb.1(0x80000000) 148 liveins: $r0, $r1, $r2, $r3, $r4, $lr 149 150 frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp 151 frame-setup CFI_INSTRUCTION def_cfa_offset 8 152 frame-setup CFI_INSTRUCTION offset $lr, -4 153 frame-setup CFI_INSTRUCTION offset $r4, -8 154 tCMPi8 renamable $r3, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr 155 t2IT 11, 8, implicit-def $itstate 156 tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r4, def $pc, implicit killed $itstate 157 158 bb.1.loop.ph: 159 successors: %bb.2(0x80000000) 160 liveins: $r0, $r1, $r2, $r3, $r4, $lr 161 162 renamable $r4 = tLDRspi $sp, 2, 14 /* CC::al */, $noreg :: (load 4 from %fixed-stack.0, align 8) 163 $lr = t2DoLoopStart renamable $r4 164 $r12 = tMOVr killed $r4, 14 /* CC::al */, $noreg 165 166 bb.2.loop.body: 167 successors: %bb.2(0x7c000000), %bb.3(0x04000000) 168 liveins: $r0, $r1, $r2, $r3, $r12 169 170 renamable $vpr = MVE_VCTP32 renamable $r3, 0, $noreg 171 $lr = tMOVr $r12, 14 /* CC::al */, $noreg 172 renamable $r12 = t2SUBri killed $r12, 1, 14 /* CC::al */, $noreg, $noreg 173 renamable $r3, dead $cpsr = tSUBi8 killed renamable $r3, 4, 14 /* CC::al */, $noreg 174 MVE_VPST 4, implicit $vpr 175 renamable $r1, renamable $q0 = MVE_VLDRWU32_post killed renamable $r1, 16, 1, renamable $vpr :: (load 16 from %ir.addr.b, align 4) 176 renamable $r0, renamable $q1 = MVE_VLDRWU32_post killed renamable $r0, 16, 1, renamable $vpr :: (load 16 from %ir.addr.a, align 4) 177 renamable $lr = t2LoopDec killed renamable $lr, 1 178 renamable $q1 = MVE_VQSHRUNs32th killed renamable $q1, killed renamable $q0, 3, 0, $noreg 179 MVE_VPST 8, implicit $vpr 180 renamable $r2 = MVE_VSTRWU32_post killed renamable $q1, killed renamable $r2, 16, 1, killed renamable $vpr :: (store 16 into %ir.addr.c, align 4) 181 t2LoopEnd killed renamable $lr, %bb.2, implicit-def dead $cpsr 182 tB %bb.3, 14 /* CC::al */, $noreg 183 184 bb.3.exit: 185 tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $pc 186 187... 188--- 189name: test_vqrshruntq_n_s16 190alignment: 2 191tracksRegLiveness: true 192registers: [] 193liveins: 194 - { reg: '$r0', virtual-reg: '' } 195 - { reg: '$r1', virtual-reg: '' } 196 - { reg: '$r2', virtual-reg: '' } 197 - { reg: '$r3', virtual-reg: '' } 198frameInfo: 199 stackSize: 8 200 offsetAdjustment: 0 201 maxAlignment: 4 202fixedStack: 203 - { id: 0, type: default, offset: 0, size: 4, alignment: 8, stack-id: default, 204 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, 205 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 206stack: 207 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 208 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false, 209 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 210 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 211 stack-id: default, callee-saved-register: '$r4', callee-saved-restored: true, 212 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 213callSites: [] 214constants: [] 215machineFunctionInfo: {} 216body: | 217 ; CHECK-LABEL: name: test_vqrshruntq_n_s16 218 ; CHECK: bb.0.entry: 219 ; CHECK: successors: %bb.1(0x80000000) 220 ; CHECK: liveins: $lr, $r0, $r1, $r2, $r3, $r4 221 ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp 222 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8 223 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4 224 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -8 225 ; CHECK: tCMPi8 renamable $r3, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr 226 ; CHECK: t2IT 11, 8, implicit-def $itstate 227 ; CHECK: tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r4, def $pc, implicit killed $itstate 228 ; CHECK: bb.1.loop.ph: 229 ; CHECK: successors: %bb.2(0x80000000) 230 ; CHECK: liveins: $r0, $r1, $r2, $r3 231 ; CHECK: renamable $r12 = t2LDRi12 $sp, 8, 14 /* CC::al */, $noreg :: (load 4 from %fixed-stack.0, align 8) 232 ; CHECK: dead $lr = MVE_DLSTP_16 killed renamable $r3 233 ; CHECK: $r4 = tMOVr killed $r12, 14 /* CC::al */, $noreg 234 ; CHECK: bb.2.loop.body: 235 ; CHECK: successors: %bb.2(0x7c000000), %bb.3(0x04000000) 236 ; CHECK: liveins: $r0, $r1, $r2, $r4 237 ; CHECK: $lr = tMOVr $r4, 14 /* CC::al */, $noreg 238 ; CHECK: renamable $r4, dead $cpsr = tSUBi8 killed $r4, 1, 14 /* CC::al */, $noreg 239 ; CHECK: renamable $r1, renamable $q0 = MVE_VLDRHU16_post killed renamable $r1, 16, 0, $noreg :: (load 16 from %ir.addr.b, align 2) 240 ; CHECK: renamable $q1 = MVE_VLDRHU16 killed renamable $r0, 0, 0, $noreg :: (load 16 from %ir.addr.a, align 2) 241 ; CHECK: $r0 = tMOVr $r1, 14 /* CC::al */, $noreg 242 ; CHECK: renamable $q1 = MVE_VQSHRUNs16th killed renamable $q1, killed renamable $q0, 1, 0, $noreg 243 ; CHECK: renamable $r2 = MVE_VSTRHU16_post killed renamable $q1, killed renamable $r2, 16, 0, killed $noreg :: (store 16 into %ir.addr.c, align 2) 244 ; CHECK: dead $lr = MVE_LETP killed renamable $lr, %bb.2 245 ; CHECK: bb.3.exit: 246 ; CHECK: tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $pc 247 bb.0.entry: 248 successors: %bb.1(0x80000000) 249 liveins: $r0, $r1, $r2, $r3, $r4, $lr 250 251 frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp 252 frame-setup CFI_INSTRUCTION def_cfa_offset 8 253 frame-setup CFI_INSTRUCTION offset $lr, -4 254 frame-setup CFI_INSTRUCTION offset $r4, -8 255 tCMPi8 renamable $r3, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr 256 t2IT 11, 8, implicit-def $itstate 257 tPOP_RET 11 /* CC::lt */, killed $cpsr, def $r4, def $pc, implicit killed $itstate 258 259 bb.1.loop.ph: 260 successors: %bb.2(0x80000000) 261 liveins: $r0, $r1, $r2, $r3, $r4, $lr 262 263 renamable $r12 = t2LDRi12 $sp, 8, 14 /* CC::al */, $noreg :: (load 4 from %fixed-stack.0, align 8) 264 $lr = t2DoLoopStart renamable $r12 265 $r4 = tMOVr killed $r12, 14 /* CC::al */, $noreg 266 267 bb.2.loop.body: 268 successors: %bb.2(0x7c000000), %bb.3(0x04000000) 269 liveins: $r0, $r1, $r2, $r3, $r4 270 271 renamable $vpr = MVE_VCTP16 renamable $r3, 0, $noreg 272 $lr = tMOVr $r4, 14 /* CC::al */, $noreg 273 renamable $r4, dead $cpsr = tSUBi8 killed $r4, 1, 14 /* CC::al */, $noreg 274 renamable $r3, dead $cpsr = tSUBi8 killed renamable $r3, 8, 14 /* CC::al */, $noreg 275 MVE_VPST 4, implicit $vpr 276 renamable $r1, renamable $q0 = MVE_VLDRHU16_post killed renamable $r1, 16, 1, renamable $vpr :: (load 16 from %ir.addr.b, align 2) 277 renamable $q1 = MVE_VLDRHU16 killed renamable $r0, 0, 1, renamable $vpr :: (load 16 from %ir.addr.a, align 2) 278 renamable $lr = t2LoopDec killed renamable $lr, 1 279 $r0 = tMOVr $r1, 14 /* CC::al */, $noreg 280 renamable $q1 = MVE_VQSHRUNs16th killed renamable $q1, killed renamable $q0, 1, 0, $noreg 281 MVE_VPST 8, implicit $vpr 282 renamable $r2 = MVE_VSTRHU16_post killed renamable $q1, killed renamable $r2, 16, 1, killed renamable $vpr :: (store 16 into %ir.addr.c, align 2) 283 t2LoopEnd killed renamable $lr, %bb.2, implicit-def dead $cpsr 284 tB %bb.3, 14 /* CC::al */, $noreg 285 286 bb.3.exit: 287 tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $pc 288 289... 290