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.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg)
9 ; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
10 declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1 immarg)
12 define void @test1(i32* noalias %X, i32* noalias readonly %Y, i32 %n) {
14 %0 = bitcast i32* %X to i8*
15 %1 = bitcast i32* %Y to i8*
16 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 %1, i32 %n, i1 false)
20 define void @test2(i32* noalias %X, i32* noalias readonly %Y, i32 %n) {
22 %cmp6 = icmp sgt i32 %n, 0
23 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
25 for.body.preheader: ; preds = %entry
26 %X.bits = bitcast i32* %X to i8*
27 %Y.bits = bitcast i32* %Y to i8*
28 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %X.bits, i8* align 4 %Y.bits, i32 %n, i1 false)
29 br label %for.cond.cleanup
31 for.cond.cleanup: ; preds = %for.body.preheader, %entry
35 define void @test3(i32* nocapture %X, i8 zeroext %c, i32 %n) {
37 %0 = bitcast i32* %X to i8*
38 tail call void @llvm.memset.p0i8.i32(i8* align 4 %0, i8 %c, i32 %n, i1 false)
43 define void @test4(i8* nocapture %X, i8 zeroext %c, i32 %n) {
45 %cmp4 = icmp sgt i32 %n, 0
46 br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
48 for.body.preheader: ; preds = %entry
49 call void @llvm.memset.p0i8.i32(i8* align 1 %X, i8 %c, i32 %n, i1 false)
50 br label %for.cond.cleanup
52 for.cond.cleanup: ; preds = %for.body.preheader, %entry
59 tracksRegLiveness: true
62 liveins: $r0, $r1, $r2
64 ; CHECK-LABEL: name: test1
65 ; CHECK: liveins: $r0, $r1, $r2
66 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
67 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
68 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
69 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
70 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
71 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
72 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.2, implicit-def $cpsr
74 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY1]], %bb.0, %7, %bb.1
75 ; CHECK: [[PHI1:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.0, %9, %bb.1
76 ; CHECK: [[PHI2:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.0, %11, %bb.1
77 ; CHECK: [[PHI3:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.0, %13, %bb.1
78 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI3]], 0, $noreg
79 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI3]], 16, 14 /* CC::al */, $noreg, $noreg
80 ; CHECK: [[MVE_VLDRBU8_post:%[0-9]+]]:rgpr, [[MVE_VLDRBU8_post1:%[0-9]+]]:mqpr = MVE_VLDRBU8_post [[PHI]], 16, 1, [[MVE_VCTP8_]]
81 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[MVE_VLDRBU8_post1]], [[PHI1]], 16, 1, [[MVE_VCTP8_]]
82 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI2]], 1
83 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.1, implicit-def $cpsr
84 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
86 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
90 MVE_MEMCPYLOOPINST %0, %1, %2, implicit-def $cpsr
91 tBX_RET 14 /* CC::al */, $noreg
96 tracksRegLiveness: true
98 ; CHECK-LABEL: name: test2
100 ; CHECK: successors: %bb.1(0x50000000), %bb.2(0x30000000)
101 ; CHECK: liveins: $r0, $r1, $r2
102 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
103 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
104 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
105 ; CHECK: t2CMPri [[COPY]], 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
106 ; CHECK: t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
107 ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg
108 ; CHECK: bb.1.for.body.preheader:
109 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
110 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
111 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
112 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.4, implicit-def $cpsr
114 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY1]], %bb.1, %7, %bb.3
115 ; CHECK: [[PHI1:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.1, %9, %bb.3
116 ; CHECK: [[PHI2:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.1, %11, %bb.3
117 ; CHECK: [[PHI3:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.1, %13, %bb.3
118 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI3]], 0, $noreg
119 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI3]], 16, 14 /* CC::al */, $noreg, $noreg
120 ; CHECK: [[MVE_VLDRBU8_post:%[0-9]+]]:rgpr, [[MVE_VLDRBU8_post1:%[0-9]+]]:mqpr = MVE_VLDRBU8_post [[PHI]], 16, 1, [[MVE_VCTP8_]]
121 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[MVE_VLDRBU8_post1]], [[PHI1]], 16, 1, [[MVE_VCTP8_]]
122 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI2]], 1
123 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.3, implicit-def $cpsr
124 ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg
125 ; CHECK: bb.4.for.body.preheader:
126 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
127 ; CHECK: bb.2.for.cond.cleanup:
128 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
130 successors: %bb.1(0x50000000), %bb.2(0x30000000)
131 liveins: $r0, $r1, $r2
136 t2CMPri %2, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
137 t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
138 t2B %bb.1, 14 /* CC::al */, $noreg
140 bb.1.for.body.preheader:
141 successors: %bb.2(0x80000000)
143 MVE_MEMCPYLOOPINST %0, %1, %2, implicit-def $cpsr
145 bb.2.for.cond.cleanup:
146 tBX_RET 14 /* CC::al */, $noreg
151 tracksRegLiveness: true
154 liveins: $r0, $r1, $r2
156 ; CHECK-LABEL: name: test3
157 ; CHECK: liveins: $r0, $r1, $r2
158 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
159 ; CHECK: [[COPY1:%[0-9]+]]:mqpr = COPY $r1
160 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
161 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
162 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
163 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
164 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.2, implicit-def $cpsr
166 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.0, %7, %bb.1
167 ; CHECK: [[PHI1:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.0, %9, %bb.1
168 ; CHECK: [[PHI2:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.0, %11, %bb.1
169 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI2]], 0, $noreg
170 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI2]], 16, 14 /* CC::al */, $noreg, $noreg
171 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[COPY1]], [[PHI]], 16, 1, [[MVE_VCTP8_]]
172 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI1]], 1
173 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.1, implicit-def $cpsr
174 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
176 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
180 MVE_MEMSETLOOPINST %0, %1, %2, implicit-def $cpsr
181 tBX_RET 14 /* CC::al */, $noreg
187 tracksRegLiveness: true
189 ; CHECK-LABEL: name: test4
191 ; CHECK: successors: %bb.1(0x50000000), %bb.2(0x30000000)
192 ; CHECK: liveins: $r0, $r1, $r2
193 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r2
194 ; CHECK: [[COPY1:%[0-9]+]]:mqpr = COPY $r1
195 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r0
196 ; CHECK: t2CMPri [[COPY]], 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
197 ; CHECK: t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
198 ; CHECK: t2B %bb.1, 14 /* CC::al */, $noreg
199 ; CHECK: bb.1.for.body.preheader:
200 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 15, 14 /* CC::al */, $noreg, $noreg
201 ; CHECK: [[t2LSRri:%[0-9]+]]:rgpr = t2LSRri killed [[t2ADDri]], 4, 14 /* CC::al */, $noreg, $noreg
202 ; CHECK: [[t2WhileLoopSetup:%[0-9]+]]:gprlr = t2WhileLoopSetup killed [[t2LSRri]]
203 ; CHECK: t2WhileLoopStart [[t2WhileLoopSetup]], %bb.4, implicit-def $cpsr
205 ; CHECK: [[PHI:%[0-9]+]]:rgpr = PHI [[COPY2]], %bb.1, %7, %bb.3
206 ; CHECK: [[PHI1:%[0-9]+]]:gprlr = PHI [[t2WhileLoopSetup]], %bb.1, %9, %bb.3
207 ; CHECK: [[PHI2:%[0-9]+]]:rgpr = PHI [[COPY]], %bb.1, %11, %bb.3
208 ; CHECK: [[MVE_VCTP8_:%[0-9]+]]:vccr = MVE_VCTP8 [[PHI2]], 0, $noreg
209 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[PHI2]], 16, 14 /* CC::al */, $noreg, $noreg
210 ; CHECK: [[MVE_VSTRBU8_post:%[0-9]+]]:rgpr = MVE_VSTRBU8_post [[COPY1]], [[PHI]], 16, 1, [[MVE_VCTP8_]]
211 ; CHECK: [[t2LoopDec:%[0-9]+]]:gprlr = t2LoopDec [[PHI1]], 1
212 ; CHECK: t2LoopEnd [[t2LoopDec]], %bb.3, implicit-def $cpsr
213 ; CHECK: t2B %bb.4, 14 /* CC::al */, $noreg
214 ; CHECK: bb.4.for.body.preheader:
215 ; CHECK: t2B %bb.2, 14 /* CC::al */, $noreg
216 ; CHECK: bb.2.for.cond.cleanup:
217 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
219 successors: %bb.1(0x50000000), %bb.2(0x30000000)
220 liveins: $r0, $r1, $r2
225 t2CMPri %2, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr
226 t2Bcc %bb.2, 11 /* CC::lt */, $cpsr
227 t2B %bb.1, 14 /* CC::al */, $noreg
229 bb.1.for.body.preheader:
230 MVE_MEMSETLOOPINST %0, %1, %2, implicit-def $cpsr
232 bb.2.for.cond.cleanup:
233 tBX_RET 14 /* CC::al */, $noreg