@@ -52,6 +52,11 @@ void runChecks(
52
52
" ...\n "
53
53
" ---\n "
54
54
" name: sizes\n "
55
+ " jumpTable:\n "
56
+ " kind: block-address\n "
57
+ " entries:\n "
58
+ " - id: 0\n "
59
+ " blocks: [ '%bb.0' ]\n "
55
60
" body: |\n "
56
61
" bb.0:\n "
57
62
+ InputMIRSnippet.str ();
@@ -142,6 +147,34 @@ TEST(InstSizes, PATCHPOINT) {
142
147
});
143
148
}
144
149
150
+ TEST (InstSizes, STATEPOINT) {
151
+ std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
152
+ std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
153
+
154
+ runChecks (TM.get (), II.get (), " " ,
155
+ " STATEPOINT 0, 0, 0, @sizes, 2, 0, 2, 0, 2, 0, 2, 1, 1, 8,"
156
+ " $sp, 24, 2, 0, 2, 1, 0, 0\n " ,
157
+ [](AArch64InstrInfo &II, MachineFunction &MF) {
158
+ auto I = MF.begin ()->begin ();
159
+ EXPECT_EQ (4u , II.getInstSizeInBytes (*I));
160
+ });
161
+ }
162
+
163
+ TEST (InstSizes, SPACE) {
164
+ std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
165
+ std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
166
+
167
+ runChecks (TM.get (), II.get (), " " ,
168
+ " $xzr = SPACE 1024, undef $xzr\n "
169
+ " dead $xzr = SPACE 4096, $xzr\n " ,
170
+ [](AArch64InstrInfo &II, MachineFunction &MF) {
171
+ auto I = MF.begin ()->begin ();
172
+ EXPECT_EQ (1024u , II.getInstSizeInBytes (*I));
173
+ ++I;
174
+ EXPECT_EQ (4096u , II.getInstSizeInBytes (*I));
175
+ });
176
+ }
177
+
145
178
TEST (InstSizes, TLSDESC_CALLSEQ) {
146
179
std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
147
180
std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
@@ -156,16 +189,87 @@ TEST(InstSizes, TLSDESC_CALLSEQ) {
156
189
});
157
190
}
158
191
159
- TEST (InstSizes, MOPSMemorySetTaggingPseudo) {
192
+ TEST (InstSizes, StoreSwiftAsyncContext) {
193
+ std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
194
+ std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
195
+
196
+ runChecks (
197
+ TM.get (), II.get (), " " ,
198
+ " StoreSwiftAsyncContext $x0, $x1, 12, implicit-def $x16, "
199
+ " implicit-def $x17\n " ,
200
+ [](AArch64InstrInfo &II, MachineFunction &MF) {
201
+ auto I = MF.begin ()->begin ();
202
+ EXPECT_EQ (20u , II.getInstSizeInBytes (*I));
203
+ });
204
+ }
205
+
206
+ TEST (InstSizes, SpeculationBarrierISBDSBEndBB) {
207
+ std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
208
+ std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
209
+
210
+ runChecks (
211
+ TM.get (), II.get (), " " ,
212
+ " SpeculationBarrierISBDSBEndBB\n "
213
+ " BR $x8\n " ,
214
+ [](AArch64InstrInfo &II, MachineFunction &MF) {
215
+ auto I = MF.begin ()->begin ();
216
+ EXPECT_EQ (8u , II.getInstSizeInBytes (*I));
217
+ });
218
+ }
219
+
220
+ TEST (InstSizes, SpeculationBarrierSBEndBB) {
221
+ std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
222
+ std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
223
+
224
+ runChecks (
225
+ TM.get (), II.get (), " " ,
226
+ " SpeculationBarrierSBEndBB\n "
227
+ " BR $x8\n " ,
228
+ [](AArch64InstrInfo &II, MachineFunction &MF) {
229
+ auto I = MF.begin ()->begin ();
230
+ EXPECT_EQ (4u , II.getInstSizeInBytes (*I));
231
+ });
232
+ }
233
+
234
+ TEST (InstSizes, JumpTable) {
160
235
std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
161
236
std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
162
237
163
238
runChecks (TM.get (), II.get (), " " ,
164
- " renamable $x0, dead renamable $x1 = MOPSMemorySetTaggingPseudo "
165
- " killed renamable $x0, killed renamable $x1, killed renamable $x2, "
166
- " implicit-def dead $nzcv \n " ,
239
+ " $x10, $x11 = JumpTableDest32 $x9, $x8, %jump-table.0 \n "
240
+ " $x10, $x11 = JumpTableDest16 $x9, $x8, %jump-table.0 \n "
241
+ " $x10, $x11 = JumpTableDest8 $x9, $x8, %jump-table.0 \n " ,
167
242
[](AArch64InstrInfo &II, MachineFunction &MF) {
168
243
auto I = MF.begin ()->begin ();
169
244
EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
245
+ ++I;
246
+ EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
247
+ ++I;
248
+ EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
249
+ });
250
+ }
251
+
252
+ TEST (InstSizes, MOPSMemoryPseudos) {
253
+ std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine ();
254
+ std::unique_ptr<AArch64InstrInfo> II = createInstrInfo (TM.get ());
255
+
256
+ runChecks (TM.get (), II.get (), " " ,
257
+ " $x0, $x1, $x2 = MOPSMemoryMovePseudo $x0, $x1, $x2, "
258
+ " implicit-def $nzcv\n "
259
+ " $x0, $x1 = MOPSMemorySetPseudo $x0, $x1, $x2, "
260
+ " implicit-def $nzcv\n "
261
+ " $x0, $x1, $x8 = MOPSMemoryCopyPseudo $x0, $x1, $x8, "
262
+ " implicit-def $nzcv\n "
263
+ " $x0, $x1 = MOPSMemorySetTaggingPseudo $x0, $x1, $x2, "
264
+ " implicit-def $nzcv\n " ,
265
+ [](AArch64InstrInfo &II, MachineFunction &MF) {
266
+ auto I = MF.begin ()->begin ();
267
+ EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
268
+ ++I;
269
+ EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
270
+ ++I;
271
+ EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
272
+ ++I;
273
+ EXPECT_EQ (12u , II.getInstSizeInBytes (*I));
170
274
});
171
275
}
0 commit comments