Debian Codegraph @

rpython/jit/backend/arm/test/test_generated.py

raw symbols SCIP
1 import py
2 py.test.skip("XXX FIX ME OR KILL ME")
3
4 from rpython.jit.metainterp.history import (AbstractFailDescr,
5 AbstractDescr,
6 BasicFailDescr,
7 BoxInt, Box, BoxPtr,
8 ConstInt, ConstPtr,
9 Const, BoxFloat, ConstFloat)
10 from rpython.jit.metainterp.history import JitCellToken
11 from rpython.jit.metainterp.resoperation import ResOperation, rop
12 from rpython.rtyper.test.test_llinterp import interpret
13 from rpython.jit.backend.detect_cpu import getcpuclass
14
15 CPU = getcpuclass()
16 class TestStuff(object):
17
18 def test0(self):
19 faildescr1 = BasicFailDescr(1)
20 faildescr2 = BasicFailDescr(2)
21 v1 = BoxInt()
22 v2 = BoxInt()
23 v3 = BoxInt()
24 v4 = BoxInt()
25 v5 = BoxInt()
26 v6 = BoxInt()
27 v7 = BoxInt()
28 v8 = BoxInt()
29 v9 = BoxInt()
30 v10 = BoxInt()
31 v11 = BoxInt()
32 v12 = BoxInt()
33 cpu = CPU(None, None)
34 cpu.setup_once()
35 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
36 operations = [
37 ResOperation(rop.INT_SUB, [ConstInt(-1073741824), v7], v11),
38 ResOperation(rop.INT_GE, [v3, ConstInt(23)], v12),
39 ResOperation(rop.GUARD_TRUE, [v12], None, descr=faildescr1),
40 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr2),
41 ]
42 looptoken = JitCellToken()
43 operations[2].setfailargs([v12, v8, v3, v2, v1, v11])
44 operations[3].setfailargs([v9, v6, v10, v2, v8, v5, v1, v4])
45 cpu.compile_loop(inputargs, operations, looptoken)
46 args = [-12 , -26 , -19 , 7 , -5 , -24 , -37 , 62 , 9 , 12]
47 deadframe = cpu.execute_token(looptoken, *args)
48 assert cpu.get_int_value(deadframe, 0) == 0
49 assert cpu.get_int_value(deadframe, 1) == 62
50 assert cpu.get_int_value(deadframe, 2) == -19
51 assert cpu.get_int_value(deadframe, 3) == -26
52 assert cpu.get_int_value(deadframe, 4) == -12
53 assert cpu.get_int_value(deadframe, 5) == -1073741787
54
55 def test_overflow(self):
56 faildescr1 = BasicFailDescr(1)
57 faildescr2 = BasicFailDescr(2)
58 faildescr3 = BasicFailDescr(3)
59 v1 = BoxInt()
60 v2 = BoxInt()
61 v3 = BoxInt()
62 v4 = BoxInt()
63 v5 = BoxInt()
64 v6 = BoxInt()
65 v7 = BoxInt()
66 v8 = BoxInt()
67 v9 = BoxInt()
68 v10 = BoxInt()
69 v11 = BoxInt()
70 v12 = BoxInt()
71 v13 = BoxInt()
72 v14 = BoxInt()
73 v15 = BoxInt()
74 v16 = BoxInt()
75 v17 = BoxInt()
76 v18 = BoxInt()
77 cpu = CPU(None, None)
78 cpu.setup_once()
79 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
80 operations = [
81 ResOperation(rop.INT_SUB, [ConstInt(21), v5], v11),
82 ResOperation(rop.INT_MUL_OVF, [v8, v4], v12),
83 ResOperation(rop.GUARD_NO_OVERFLOW, [], None, descr=faildescr1),
84 ResOperation(rop.UINT_LT, [v10, v3], v13),
85 ResOperation(rop.INT_IS_TRUE, [v3], v14),
86 ResOperation(rop.INT_XOR, [v9, v8], v15),
87 ResOperation(rop.INT_LE, [v12, v6], v16),
88 ResOperation(rop.UINT_GT, [v15, v5], v17),
89 ResOperation(rop.UINT_LE, [ConstInt(-9), v13], v18),
90 ResOperation(rop.GUARD_FALSE, [v13], None, descr=faildescr2),
91 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr3),
92 ]
93 operations[2].setfailargs([v10, v6])
94 operations[9].setfailargs([v15, v7, v10, v18, v4, v17, v1])
95 operations[-1].setfailargs([v7, v1, v2])
96 looptoken = JitCellToken()
97 cpu.compile_loop(inputargs, operations, looptoken)
98 args = [16 , 5 , 5 , 16 , 46 , 6 , 63 , 39 , 78 , 0]
99 deadframe = cpu.execute_token(looptoken, *args)
100 assert cpu.get_int_value(deadframe, 0) == 105
101 assert cpu.get_int_value(deadframe, 1) == 63
102 assert cpu.get_int_value(deadframe, 2) == 0
103 assert cpu.get_int_value(deadframe, 3) == 0
104 assert cpu.get_int_value(deadframe, 4) == 16
105 assert cpu.get_int_value(deadframe, 5) == 1
106 assert cpu.get_int_value(deadframe, 6) == 16
107
108 def test_sub_with_neg_const_first_arg(self):
109 faildescr1 = BasicFailDescr(1)
110 faildescr2 = BasicFailDescr(2)
111 faildescr3 = BasicFailDescr(3)
112 v1 = BoxInt()
113 v2 = BoxInt()
114 v3 = BoxInt()
115 v4 = BoxInt()
116 v5 = BoxInt()
117 v6 = BoxInt()
118 v7 = BoxInt()
119 v8 = BoxInt()
120 v9 = BoxInt()
121 v10 = BoxInt()
122 v11 = BoxInt()
123 v12 = BoxInt()
124 tmp13 = BoxInt()
125 cpu = CPU(None, None)
126 cpu.setup_once()
127 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
128 operations = [
129 ResOperation(rop.INT_EQ, [ConstInt(17), v9], v11),
130 ResOperation(rop.INT_SUB_OVF, [ConstInt(-32), v7], v12),
131 ResOperation(rop.GUARD_NO_OVERFLOW, [], None, descr=faildescr1),
132 ResOperation(rop.INT_IS_ZERO, [v12], tmp13),
133 ResOperation(rop.GUARD_TRUE, [tmp13], None, descr=faildescr2),
134 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr3)
135 ]
136 operations[2].setfailargs([v8, v3])
137 operations[4].setfailargs([v2, v12, v1, v3, v4])
138 operations[-1].setfailargs([v5, v2, v1, v10, v3, v8, v4, v6])
139
140 looptoken = JitCellToken()
141 cpu.compile_loop(inputargs, operations, looptoken)
142 args = [-5 , 24 , 46 , -15 , 13 , -8 , 0 , -6 , 6 , 6]
143 deadframe = cpu.execute_token(looptoken, *args)
144 assert cpu.get_latest_descr(deadframe).identifier == 2
145 assert cpu.get_int_value(deadframe, 0) == 24
146 assert cpu.get_int_value(deadframe, 1) == -32
147 assert cpu.get_int_value(deadframe, 2) == -5
148 assert cpu.get_int_value(deadframe, 3) == 46
149 assert cpu.get_int_value(deadframe, 4) == -15
150
151 def test_tempbox_spilling_in_sub(self):
152 faildescr1 = BasicFailDescr(1)
153 faildescr2 = BasicFailDescr(2)
154 v1 = BoxInt()
155 v2 = BoxInt()
156 v3 = BoxInt()
157 v4 = BoxInt()
158 v5 = BoxInt()
159 v6 = BoxInt()
160 v7 = BoxInt()
161 v8 = BoxInt()
162 v9 = BoxInt()
163 v10 = BoxInt()
164 v11 = BoxInt()
165 v12 = BoxInt()
166 v13 = BoxInt()
167 v14 = BoxInt()
168 v15 = BoxInt()
169 cpu = CPU(None, None)
170 cpu.setup_once()
171 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
172 operations = [
173 ResOperation(rop.INT_LT, [v9, v9], v11),
174 ResOperation(rop.INT_ADD, [ConstInt(715827882), v4], v12),
175 ResOperation(rop.INT_NEG, [v11], v13),
176 ResOperation(rop.INT_IS_TRUE, [v3], v14),
177 ResOperation(rop.INT_SUB_OVF, [v3, ConstInt(-95)], v15),
178 ResOperation(rop.GUARD_NO_OVERFLOW, [], None, descr=faildescr1),
179 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr2),
180 ]
181 operations[5].setfailargs([])
182 operations[-1].setfailargs([v8, v2, v6, v5, v7, v1, v10])
183 looptoken = JitCellToken()
184 cpu.compile_loop(inputargs, operations, looptoken)
185 args = [19 , -3 , -58 , -7 , 12 , 22 , -54 , -29 , -19 , -64]
186 deadframe = cpu.execute_token(looptoken, *args)
187 assert cpu.get_int_value(deadframe, 0) == -29
188 assert cpu.get_int_value(deadframe, 1) == -3
189 assert cpu.get_int_value(deadframe, 2) == 22
190 assert cpu.get_int_value(deadframe, 3) == 12
191 assert cpu.get_int_value(deadframe, 4) == -54
192 assert cpu.get_int_value(deadframe, 5) == 19
193 assert cpu.get_int_value(deadframe, 6) == -64
194
195 def test_tempbox2(self):
196 faildescr1 = BasicFailDescr(1)
197 faildescr2 = BasicFailDescr(2)
198 v1 = BoxInt()
199 v2 = BoxInt()
200 v3 = BoxInt()
201 v4 = BoxInt()
202 v5 = BoxInt()
203 v6 = BoxInt()
204 v7 = BoxInt()
205 v8 = BoxInt()
206 v9 = BoxInt()
207 v10 = BoxInt()
208 v11 = BoxInt()
209 v12 = BoxInt()
210 v13 = BoxInt()
211 v14 = BoxInt()
212 v15 = BoxInt()
213 cpu = CPU(None, None)
214 cpu.setup_once()
215 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
216 operations = [
217 ResOperation(rop.INT_LT, [v5, ConstInt(-67)], v11),
218 ResOperation(rop.INT_INVERT, [v2], v12),
219 ResOperation(rop.INT_SUB, [ConstInt(-45), v2], v13),
220 ResOperation(rop.INT_SUB, [ConstInt(99), v6], v14),
221 ResOperation(rop.INT_MUL_OVF, [v6, v9], v15),
222 ResOperation(rop.GUARD_NO_OVERFLOW, [], None, descr=faildescr1),
223 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr2),
224 ]
225 looptoken = JitCellToken()
226 operations[5].setfailargs([])
227 operations[-1].setfailargs([v1, v4, v10, v8, v7, v3])
228 cpu.compile_loop(inputargs, operations, looptoken)
229 args = [1073741824 , 95 , -16 , 5 , 92 , 12 , 32 , 17 , 37 , -63]
230 deadframe = cpu.execute_token(looptoken, *args)
231 assert cpu.get_int_value(deadframe, 0) == 1073741824
232 assert cpu.get_int_value(deadframe, 1) == 5
233 assert cpu.get_int_value(deadframe, 2) == -63
234 assert cpu.get_int_value(deadframe, 3) == 17
235 assert cpu.get_int_value(deadframe, 4) == 32
236 assert cpu.get_int_value(deadframe, 5) == -16
237
238 def test_wrong_guard(self):
239 # generated by:
240 # ../test/ test/test_zll_random.py -l -k arm -s --block-length=10 --random-seed=4338
241
242 faildescr1 = BasicFailDescr(1)
243 faildescr2 = BasicFailDescr(2)
244 faildescr3 = BasicFailDescr(3)
245 faildescr4 = BasicFailDescr(4)
246 v1 = BoxInt(32)
247 v2 = BoxInt(41)
248 v3 = BoxInt(-9)
249 v4 = BoxInt(12)
250 v5 = BoxInt(-18)
251 v6 = BoxInt(46)
252 v7 = BoxInt(15)
253 v8 = BoxInt(17)
254 v9 = BoxInt(10)
255 v10 = BoxInt(12)
256 v11 = BoxInt()
257 v12 = BoxInt()
258 v13 = BoxInt()
259 v14 = BoxInt()
260 tmp15 = BoxInt()
261 tmp16 = BoxInt()
262 tmp17 = BoxInt()
263 cpu = CPU(None, None)
264 cpu.setup_once()
265 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
266 operations = [
267 ResOperation(rop.INT_IS_TRUE, [v1], tmp15),
268 ResOperation(rop.GUARD_TRUE, [tmp15], None, descr=faildescr1),
269 ResOperation(rop.INT_GT, [v4, v5], v11),
270 ResOperation(rop.INT_XOR, [ConstInt(-4), v7], v12),
271 ResOperation(rop.INT_MUL, [ConstInt(23), v11], v13),
272 ResOperation(rop.UINT_GE, [ConstInt(1), v13], v14),
273 ResOperation(rop.INT_IS_ZERO, [v14], tmp16),
274 ResOperation(rop.GUARD_TRUE, [tmp16], None, descr=faildescr2),
275 ResOperation(rop.INT_IS_TRUE, [v12], tmp17),
276 ResOperation(rop.GUARD_FALSE, [tmp17], None, descr=faildescr3),
277 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr4),
278 ]
279 looptoken = JitCellToken()
280 operations[1].setfailargs([v8, v6, v1])
281 operations[7].setfailargs([v4])
282 operations[9].setfailargs([v10, v13])
283 operations[-1].setfailargs([v8, v10, v6, v3, v2, v9])
284 args = [32 , 41 , -9 , 12 , -18 , 46 , 15 , 17 , 10 , 12]
285 cpu.compile_loop(inputargs, operations, looptoken)
286 deadframe = cpu.execute_token(looptoken, *args)
287 assert cpu.get_latest_descr(deadframe).identifier == 3
288 assert cpu.get_int_value(deadframe, 0) == 12
289 assert cpu.get_int_value(deadframe, 1) == 23
290
291 def test_wrong_guard2(self):
292 # random seed: 8029
293 # block length: 10
294 faildescr1 = BasicFailDescr(1)
295 faildescr2 = BasicFailDescr(2)
296 faildescr3 = BasicFailDescr(3)
297 v1 = BoxInt()
298 v2 = BoxInt()
299 v3 = BoxInt()
300 v4 = BoxInt()
301 v5 = BoxInt()
302 v6 = BoxInt()
303 v7 = BoxInt()
304 v8 = BoxInt()
305 v9 = BoxInt()
306 v10 = BoxInt()
307 v11 = BoxInt()
308 v12 = BoxInt()
309 v13 = BoxInt()
310 v14 = BoxInt()
311 v15 = BoxInt()
312 v16 = BoxInt()
313 tmp17 = BoxInt()
314 cpu = CPU(None, None)
315 cpu.setup_once()
316 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
317 operations = [
318 ResOperation(rop.INT_ADD_OVF, [v8, ConstInt(-30)], v11),
319 ResOperation(rop.GUARD_NO_OVERFLOW, [], None, descr=faildescr1),
320 ResOperation(rop.UINT_LE, [v11, v1], v12),
321 ResOperation(rop.INT_AND, [v11, ConstInt(31)], tmp17),
322 ResOperation(rop.UINT_RSHIFT, [v12, tmp17], v13),
323 ResOperation(rop.INT_NE, [v3, v2], v14),
324 ResOperation(rop.INT_NE, [ConstInt(1), v11], v15),
325 ResOperation(rop.INT_NE, [ConstInt(23), v15], v16),
326 ResOperation(rop.GUARD_FALSE, [v15], None, descr=faildescr2),
327 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr3),
328 ]
329 operations[1].setfailargs([v6, v8, v1, v4])
330 operations[8].setfailargs([v5, v9])
331 operations[-1].setfailargs([v4, v10, v6, v5, v9, v7])
332 looptoken = JitCellToken()
333 cpu.compile_loop(inputargs, operations, looptoken)
334 args = [-8 , 0 , 62 , 35 , 16 , 9 , 30 , 581610154 , -1 , 738197503]
335 deadframe = cpu.execute_token(looptoken, *args)
336 assert cpu.get_latest_descr(deadframe).identifier == 2
337 assert cpu.get_int_value(deadframe, 0) == 16
338 assert cpu.get_int_value(deadframe, 1) == -1
339
340 def test_wrong_guard3(self):
341 # random seed: 8029
342 # block length: 10
343 faildescr1 = BasicFailDescr(1)
344 faildescr2 = BasicFailDescr(2)
345 faildescr3 = BasicFailDescr(3)
346 faildescr4 = BasicFailDescr(4)
347 v1 = BoxInt()
348 v2 = BoxInt()
349 v3 = BoxInt()
350 v4 = BoxInt()
351 v5 = BoxInt()
352 v6 = BoxInt()
353 v7 = BoxInt()
354 v8 = BoxInt()
355 v9 = BoxInt()
356 v10 = BoxInt()
357 v11 = BoxInt()
358 v12 = BoxInt()
359 v13 = BoxInt()
360 v14 = BoxInt()
361 v15 = BoxInt()
362 v16 = BoxInt()
363 cpu = CPU(None, None)
364 cpu.setup_once()
365 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
366 operations = [
367 ResOperation(rop.UINT_LT, [ConstInt(-11), v7], v11),
368 ResOperation(rop.INT_GE, [v3, v5], v12),
369 ResOperation(rop.INT_INVERT, [v9], v13),
370 ResOperation(rop.GUARD_VALUE, [v13, ConstInt(14)], None, descr=faildescr3),
371 ResOperation(rop.INT_IS_ZERO, [v12], v14),
372 ResOperation(rop.INT_SUB, [v2, v13], v15),
373 ResOperation(rop.GUARD_VALUE, [v15, ConstInt(-32)], None, descr=faildescr4),
374 ResOperation(rop.INT_FLOORDIV, [v3, ConstInt(805306366)], v16),
375 ResOperation(rop.GUARD_VALUE, [v15, ConstInt(0)], None, descr=faildescr1),
376 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr2),
377 ]
378 operations[3].setfailargs([])
379 operations[-4].setfailargs([v15])
380 operations[-2].setfailargs([v9, v4, v10, v11, v14])
381 operations[-1].setfailargs([v10, v8, v1, v6, v4])
382 looptoken = JitCellToken()
383 cpu.compile_loop(inputargs, operations, looptoken)
384 args = [-39 , -18 , 1588243114 , -9 , -4 , 1252698794 , 0 , 715827882 , -15 , 536870912]
385 deadframe = cpu.execute_token(looptoken, *args)
386 assert cpu.get_latest_descr(deadframe).identifier == 1
387 assert cpu.get_int_value(deadframe, 0) == -15
388 assert cpu.get_int_value(deadframe, 1) == -9
389 assert cpu.get_int_value(deadframe, 2) == 536870912
390 assert cpu.get_int_value(deadframe, 3) == 0
391 assert cpu.get_int_value(deadframe, 4) == 0
392
393 def test_wrong_result(self):
394 # generated by:
395 # ../test/ test/test_zll_random.py -l -k arm -s --block-length=10 --random-seed=7389
396 faildescr1 = BasicFailDescr(1)
397 faildescr2 = BasicFailDescr(2)
398 faildescr3 = BasicFailDescr(3)
399 faildescr4 = BasicFailDescr(4)
400 v1 = BoxInt()
401 v2 = BoxInt()
402 v3 = BoxInt()
403 v4 = BoxInt()
404 v5 = BoxInt()
405 v6 = BoxInt()
406 v7 = BoxInt()
407 v8 = BoxInt()
408 v9 = BoxInt()
409 v10 = BoxInt()
410 v11 = BoxInt()
411 v12 = BoxInt()
412 v13 = BoxInt()
413 v14 = BoxInt()
414 v15 = BoxInt()
415 tmp16 = BoxInt()
416 tmp17 = BoxInt()
417 cpu = CPU(None, None)
418 cpu.setup_once()
419 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
420 operations = [
421 ResOperation(rop.INT_IS_TRUE, [v3], tmp16),
422 ResOperation(rop.GUARD_TRUE, [tmp16], None, descr=faildescr1),
423 ResOperation(rop.INT_AND, [v7, ConstInt(31)], tmp17),
424 ResOperation(rop.INT_RSHIFT, [v5, tmp17], v11),
425 ResOperation(rop.INT_OR, [v6, v8], v12),
426 ResOperation(rop.GUARD_VALUE, [v11, ConstInt(-2)], None, descr=faildescr2),
427 ResOperation(rop.INT_LE, [ConstInt(1789569706), v10], v13),
428 ResOperation(rop.INT_IS_TRUE, [v4], v14),
429 ResOperation(rop.INT_XOR, [v14, v3], v15),
430 ResOperation(rop.GUARD_VALUE, [v8, ConstInt(-8)], None, descr=faildescr3),
431 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr4),
432 ]
433 operations[1].setfailargs([v9, v1])
434 operations[5].setfailargs([v10, v2, v11, v3])
435 operations[9].setfailargs([v5, v7, v12, v14, v2, v13, v8])
436 operations[-1].setfailargs([v1, v2, v9])
437 looptoken = JitCellToken()
438 cpu.compile_loop(inputargs, operations, looptoken)
439 args = [0 , -2 , 24 , 1 , -4 , 13 , -95 , 33 , 2 , -44]
440 deadframe = cpu.execute_token(looptoken, *args)
441 assert cpu.get_latest_descr(deadframe).identifier == 3
442 assert cpu.get_int_value(deadframe, 0) == -4
443 assert cpu.get_int_value(deadframe, 1) == -95
444 assert cpu.get_int_value(deadframe, 2) == 45
445 assert cpu.get_int_value(deadframe, 3) == 1
446 assert cpu.get_int_value(deadframe, 4) == -2
447 assert cpu.get_int_value(deadframe, 5) == 0
448 assert cpu.get_int_value(deadframe, 6) == 33
449
450 def test_int_add(self):
451 # random seed: 1202
452 # block length: 4
453 # AssertionError: Got 1431655764, expected 357913940 for value #3
454 faildescr1 = BasicFailDescr(1)
455 faildescr2 = BasicFailDescr(2)
456 v1 = BoxInt()
457 v2 = BoxInt()
458 v3 = BoxInt()
459 v4 = BoxInt()
460 v5 = BoxInt()
461 v6 = BoxInt()
462 v7 = BoxInt()
463 v8 = BoxInt()
464 v9 = BoxInt()
465 v10 = BoxInt()
466 v11 = BoxInt()
467 tmp12 = BoxInt()
468 cpu = CPU(None, None)
469 cpu.setup_once()
470 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
471 operations = [
472 ResOperation(rop.INT_ADD, [ConstInt(-1073741825), v3], v11),
473 ResOperation(rop.INT_IS_TRUE, [v1], tmp12),
474 ResOperation(rop.GUARD_FALSE, [tmp12], None, descr=faildescr1),
475 ResOperation(rop.GUARD_FALSE, [v1], None, descr=faildescr2),
476 ]
477 operations[2].setfailargs([v10, v3, v6, v11, v9, v2])
478 operations[-1].setfailargs([v8, v2, v10, v6, v7, v9, v5, v4])
479 looptoken = JitCellToken()
480 cpu.compile_loop(inputargs, operations, looptoken)
481 args = [3 , -5 , 1431655765 , 47 , 12 , 1789569706 , 15 , 939524096 , 16 , -43]
482 deadframe = cpu.execute_token(looptoken, *args)
483 assert cpu.get_latest_descr(deadframe).identifier == 1
484 assert cpu.get_int_value(deadframe, 0) == -43
485 assert cpu.get_int_value(deadframe, 1) == 1431655765
486 assert cpu.get_int_value(deadframe, 2) == 1789569706
487 assert cpu.get_int_value(deadframe, 3) == 357913940
488 assert cpu.get_int_value(deadframe, 4) == 16
489 assert cpu.get_int_value(deadframe, 5) == -5
490
491 def test_wrong_result2(self):
492 # block length 10
493 # random seed 1
494 f1 = BasicFailDescr(1)
495 f2 = BasicFailDescr(2)
496 f3 = BasicFailDescr(3)
497 v1 = BoxInt()
498 v2 = BoxInt()
499 v3 = BoxInt()
500 v4 = BoxInt()
501 v5 = BoxInt()
502 v6 = BoxInt()
503 v7 = BoxInt()
504 v8 = BoxInt()
505 v9 = BoxInt()
506 v10 = BoxInt()
507 v11 = BoxInt()
508 v12 = BoxInt()
509 v13 = BoxInt()
510 v14 = BoxInt()
511 v15 = BoxInt()
512 cpu = CPU(None, None)
513 cpu.setup_once()
514 inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
515 operations = [
516 ResOperation(rop.INT_LE, [v6, v1], v11),
517 ResOperation(rop.SAME_AS, [ConstInt(-14)], v12),
518 ResOperation(rop.INT_ADD, [ConstInt(24), v4], v13),
519 ResOperation(rop.UINT_RSHIFT, [v6, ConstInt(0)], v14),
520 ResOperation(rop.GUARD_VALUE, [v14, ConstInt(1)], None, descr=f3),
521 ResOperation(rop.INT_MUL, [v13, ConstInt(12)], v15),
522 ResOperation(rop.GUARD_FALSE, [v11], None, descr=f1),
523 ResOperation(rop.GUARD_FALSE, [v1], None, descr=f2),
524 ]
525 operations[-2].setfailargs([v4, v10, v3, v9, v14, v2])
526 operations[-1].setfailargs([v2, v3, v5, v7, v10, v8, v9])
527 operations[4].setfailargs([v14])
528 looptoken = JitCellToken()
529 cpu.compile_loop(inputargs, operations, looptoken)
530 args = [14 , -20 , 18 , -2058005163 , 6 , 1 , -16 , 11 , 0 , 19]
531 deadframe = cpu.execute_token(looptoken, *args)
532 assert cpu.get_latest_descr(deadframe).identifier == 1
533 assert cpu.get_int_value(deadframe, 0) == -2058005163
534 assert cpu.get_int_value(deadframe, 1) == 19
535 assert cpu.get_int_value(deadframe, 2) == 18
536 assert cpu.get_int_value(deadframe, 3) == 0
537 assert cpu.get_int_value(deadframe, 4) == 1
538 assert cpu.get_int_value(deadframe, 5) == -20