1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv8.1m.main-none-eabi -mattr=+mve -simplify-mir --verify-machineinstrs -run-pass=finalize-isel %s -o - | FileCheck %s
4 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
5 target triple = "arm-arm-none-eabi"
7 ; Function Attrs: argmemonly nofree nosync nounwind willreturn
8 declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg)
9 ; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
10 declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg)
12 define void @test1(ptr noalias %X, ptr noalias readonly %Y, i32 %n) {
14 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %X, ptr align 4 %Y, i32 %n, i1 false)
18 define void @test2(ptr noalias %X, ptr noalias readonly %Y, i32 %n) {
20 %cmp6 = icmp sgt i32 %n, 0
21 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
23 for.body.preheader: ; preds = %entry
24 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %X, ptr align 4 %Y, i32 %n, i1 false)
25 br label %for.cond.cleanup
27 for.cond.cleanup: ; preds = %for.body.preheader, %entry
31 define void @test3(ptr nocapture %X, i8 zeroext %c, i32 %n) {
33 tail call void @llvm.memset.p0.i32(ptr align 4 %X, i8 %c, i32 %n, i1 false)
38 define void @test4(ptr nocapture %X, i8 zeroext %c, i32 %n) {
40 %cmp4 = icmp sgt i32 %n, 0
41 br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
43 for.body.preheader: ; preds = %entry
44 call void @llvm.memset.p0.i32(ptr align 1 %X, i8 %c, i32 %n, i1 false)
45 br label %for.cond.cleanup
47 for.cond.cleanup: ; preds = %for.body.preheader, %entry
54 tracksRegLiveness: true
57 liveins: $r0, $r1, $r2
59 ; CHECK-LABEL: name: test1
60 ; CHECK: liveins: $r0, $r1, $r2
61 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
62 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
63 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
64 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
65 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
66 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
67 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.2, implicit-def $cpsr
68 ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg
70 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY1]], %bb.0, %7, %bb.1
71 ; CHECK: [[PHI1:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.0, %9, %bb.1
72 ; CHECK: [[PHI2:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.0, %11, %bb.1
73 ; CHECK: [[PHI3:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.0, %13, %bb.1
74 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI3]], 0, $noreg, $noreg
75 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI3]], 16, 14 /* CC::al */, $noreg, $noreg
76 ; CHECK: [[MVE_VLDRBU8_post:%[0-9]+]]:rgpr, [[MVE_VLDRBU8_post1:%[0-9]+]]:mqpr = MVE_VLDRBU8_post [[PHI]], 16, 1, [[MVE_VCTP8_]], $noreg
77 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[MVE_VLDRBU8_post1]], [[PHI1]], 16, 1, [[MVE_VCTP8_]], $noreg
78 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI2]], 1
79 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.1, implicit-def $cpsr
80 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
82 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
86 MVE_MEMCPYLOOPINST %0, %1, %2, implicit-def $cpsr
87 tBX_RET 14 /* CC::al */, $noreg
92 tracksRegLiveness: true
94 ; CHECK-LABEL: name: test2
96 ; CHECK: successors: %bb.1(0x50000000), %bb.2(0x30000000)
97 ; CHECK: liveins: $r0, $r1, $r2
98 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
99 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
100 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
101 ; CHECK: t2CMPri [[COPY]], 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
102 ; CHECK: t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
103 ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg
104 ; CHECK: bb.1.for.body.preheader:
105 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
106 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
107 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
108 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.4, implicit-def $cpsr
109 ; CHECK: t2B %bb.3, 14 /* CC::al */, $noreg
111 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY1]], %bb.1, %7, %bb.3
112 ; CHECK: [[PHI1:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.1, %9, %bb.3
113 ; CHECK: [[PHI2:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.1, %11, %bb.3
114 ; CHECK: [[PHI3:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.1, %13, %bb.3
115 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI3]], 0, $noreg, $noreg
116 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI3]], 16, 14 /* CC::al */, $noreg, $noreg
117 ; CHECK: [[MVE_VLDRBU8_post:%[0-9]+]]:rgpr, [[MVE_VLDRBU8_post1:%[0-9]+]]:mqpr = MVE_VLDRBU8_post [[PHI]], 16, 1, [[MVE_VCTP8_]], $noreg
118 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[MVE_VLDRBU8_post1]], [[PHI1]], 16, 1, [[MVE_VCTP8_]], $noreg
119 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI2]], 1
120 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.3, implicit-def $cpsr
121 ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg
122 ; CHECK: bb.4.for.body.preheader:
123 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
124 ; CHECK: bb.2.for.cond.cleanup:
125 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
127 successors: %bb.1(0x50000000), %bb.2(0x30000000)
128 liveins: $r0, $r1, $r2
133 t2CMPri %2, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
134 t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
135 t2B %bb.1, 14 /* CC::al */, $noreg
137 bb.1.for.body.preheader:
138 successors: %bb.2(0x80000000)
140 MVE_MEMCPYLOOPINST %0, %1, %2, implicit-def $cpsr
142 bb.2.for.cond.cleanup:
143 tBX_RET 14 /* CC::al */, $noreg
148 tracksRegLiveness: true
151 liveins: $r0, $r1, $r2
153 ; CHECK-LABEL: name: test3
154 ; CHECK: liveins: $r0, $r1, $r2
155 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
156 ; CHECK: [[COPY1:%[0-9]+]]:mqpr = COPY $r1
157 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
158 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
159 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
160 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
161 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.2, implicit-def $cpsr
162 ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg
164 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.0, %7, %bb.1
165 ; CHECK: [[PHI1:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.0, %9, %bb.1
166 ; CHECK: [[PHI2:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.0, %11, %bb.1
167 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI2]], 0, $noreg, $noreg
168 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI2]], 16, 14 /* CC::al */, $noreg, $noreg
169 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[COPY1]], [[PHI]], 16, 1, [[MVE_VCTP8_]], $noreg
170 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI1]], 1
171 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.1, implicit-def $cpsr
172 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
174 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
178 MVE_MEMSETLOOPINST %0, %1, %2, implicit-def $cpsr
179 tBX_RET 14 /* CC::al */, $noreg
185 tracksRegLiveness: true
187 ; CHECK-LABEL: name: test4
189 ; CHECK: successors: %bb.1(0x50000000), %bb.2(0x30000000)
190 ; CHECK: liveins: $r0, $r1, $r2
191 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
192 ; CHECK: [[COPY1:%[0-9]+]]:mqpr = COPY $r1
193 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
194 ; CHECK: t2CMPri [[COPY]], 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
195 ; CHECK: t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
196 ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg
197 ; CHECK: bb.1.for.body.preheader:
198 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
199 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
200 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
201 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.4, implicit-def $cpsr
202 ; CHECK: t2B %bb.3, 14 /* CC::al */, $noreg
204 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.1, %7, %bb.3
205 ; CHECK: [[PHI1:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.1, %9, %bb.3
206 ; CHECK: [[PHI2:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.1, %11, %bb.3
207 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI2]], 0, $noreg, $noreg
208 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI2]], 16, 14 /* CC::al */, $noreg, $noreg
209 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[COPY1]], [[PHI]], 16, 1, [[MVE_VCTP8_]], $noreg
210 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI1]], 1
211 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.3, implicit-def $cpsr
212 ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg
213 ; CHECK: bb.4.for.body.preheader:
214 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
215 ; CHECK: bb.2.for.cond.cleanup:
216 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
218 successors: %bb.1(0x50000000), %bb.2(0x30000000)
219 liveins: $r0, $r1, $r2
224 t2CMPri %2, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
225 t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
226 t2B %bb.1, 14 /* CC::al */, $noreg
228 bb.1.for.body.preheader:
229 MVE_MEMSETLOOPINST %0, %1, %2, implicit-def $cpsr
231 bb.2.for.cond.cleanup:
232 tBX_RET 14 /* CC::al */, $noreg