File: test_regalloc_mov.py

package info (click to toggle)
pypy 5.6.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 97,040 kB
  • ctags: 185,069
  • sloc: python: 1,147,862; ansic: 49,642; cpp: 5,245; asm: 5,169; makefile: 529; sh: 481; xml: 232; lisp: 45
file content (575 lines) | stat: -rw-r--r-- 19,839 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
from rpython.rlib.objectmodel import instantiate
from rpython.jit.backend.arm.assembler import AssemblerARM
from rpython.jit.backend.arm.locations import imm, ConstFloatLoc
from rpython.jit.backend.arm.locations import RegisterLocation, StackLocation
from rpython.jit.backend.arm.locations import VFPRegisterLocation, get_fp_offset
from rpython.jit.backend.arm.locations import RawSPStackLocation
from rpython.jit.backend.arm.registers import lr, ip, fp, vfp_ip, sp
from rpython.jit.backend.arm.conditions import AL
from rpython.jit.backend.arm.arch import WORD
from rpython.jit.metainterp.history import FLOAT
import py


class MockInstr(object):
    def __init__(self, name, *args, **kwargs):
        self.name = name
        self.args = args
        self.kwargs = kwargs

    def __call__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs

    def __repr__(self):
        return "%s %r %r" % (self.name, self.args, self.kwargs)

    __str__ = __repr__

    def __eq__(self, other):
        return (self.__class__ == other.__class__
                and self.name == other.name
                and self.args == other.args
                and self.kwargs == other.kwargs)
mi = MockInstr


# helper method for tests
def r(i):
    return RegisterLocation(i)


def vfp(i):
    return VFPRegisterLocation(i)


def stack(i, **kwargs):
    return StackLocation(i, get_fp_offset(0, i), **kwargs)


def stack_float(i, **kwargs):
    return StackLocation(i, get_fp_offset(0, i + 1), type=FLOAT)


def imm_float(value):
    addr = int(value)  # whatever
    return ConstFloatLoc(addr)

def raw_stack(i):
    return RawSPStackLocation(i)

def raw_stack_float(i):
    return RawSPStackLocation(i, type=FLOAT)


class MockBuilder(object):
    def __init__(self):
        self.instrs = []

    def __getattr__(self, name):
        i = MockInstr(name)
        self.instrs.append(i)
        return i

class MockRegalloc(object):
    def get_free_reg(self):
        return r('helper')

class BaseMovTest(object):
    def setup_method(self, method):
        self.builder = MockBuilder()
        self.asm = instantiate(AssemblerARM)
        self.asm._regalloc = MockRegalloc()
        self.asm.mc = self.builder

    def validate(self, expected):
        result = self.builder.instrs
        assert result == expected

    def mov(self, a, b, expected=None):
        self.asm.regalloc_mov(a, b)
        self.validate(expected)


class TestRegallocMov(BaseMovTest):

    def test_mov_imm_to_reg(self):
        val = imm(123)
        reg = r(7)
        expected = [mi('gen_load_int', 7, 123, cond=AL)]
        self.mov(val, reg, expected)

    def test_mov_large_imm_to_reg(self):
        val = imm(65536)
        reg = r(7)
        expected = [mi('gen_load_int', 7, 65536, cond=AL)]
        self.mov(val, reg, expected)

    def test_mov_imm_to_stacklock(self):
        val = imm(100)
        s = stack(7)
        expected = [
                mi('gen_load_int', lr.value, 100, cond=AL),
                mi('STR_ri', lr.value, fp.value, imm=s.value, cond=AL),
        ]
        self.mov(val, s, expected)

    def test_mov_big_imm_to_stacklock(self):
        val = imm(65536)
        s = stack(7)
        expected = [
                mi('gen_load_int', lr.value, 65536, cond=AL),
                mi('STR_ri', lr.value, fp.value, imm=s.value, cond=AL),
                ]
        self.mov(val, s, expected)

    def test_mov_imm_to_big_stacklock(self):
        val = imm(100)
        s = stack(8191)
        expected = [ mi('gen_load_int', lr.value, 100, cond=AL),
                    mi('gen_load_int', ip.value, s.value, cond=AL),
                    mi('STR_rr', lr.value, fp.value, ip.value, cond=AL),
                    ]
        self.mov(val, s, expected)

    def test_mov_big_imm_to_big_stacklock(self):
        val = imm(65536)
        s = stack(8191)
        expected = [
                    mi('gen_load_int', lr.value, 65536, cond=AL),
                    mi('gen_load_int', ip.value, s.value, cond=AL),
                    mi('STR_rr', lr.value, fp.value, ip.value, cond=AL),
                    ]
        self.mov(val, s, expected)

    def test_mov_reg_to_reg(self):
        r1 = r(1)
        r9 = r(9)
        expected = [mi('MOV_rr', r9.value, r1.value, cond=AL)]
        self.mov(r1, r9, expected)

    def test_mov_reg_to_stack(self):
        s = stack(10)
        r6 = r(6)
        expected = [mi('STR_ri', r6.value, fp.value, imm=s.value, cond=AL)]
        self.mov(r6, s, expected)

    def test_mov_reg_to_big_stackloc(self):
        s = stack(8191)
        r6 = r(6)
        expected = [
                    mi('gen_load_int', ip.value, s.value, cond=AL),
                    mi('STR_rr', r6.value, fp.value, ip.value, cond=AL),
                   ]
        self.mov(r6, s, expected)

    def test_mov_stack_to_reg(self):
        s = stack(10)
        r6 = r(6)
        expected = [mi('LDR_ri', r6.value, fp.value, imm=s.value, cond=AL)]
        self.mov(s, r6, expected)

    def test_mov_big_stackloc_to_reg(self):
        s = stack(8191)
        r6 = r(6)
        expected = [
                   mi('gen_load_int', ip.value, 32940, cond=AL),
                   mi('LDR_rr', r6.value, fp.value, ip.value, cond=AL),
        ]
        self.mov(s, r6, expected)

    def test_mov_float_imm_to_vfp_reg(self):
        f = imm_float(3.5)
        reg = vfp(5)
        expected = [
                    mi('gen_load_int', ip.value, f.value, cond=AL),
                    mi('VLDR', 5, ip.value, imm=0, cond=AL),
                    ]
        self.mov(f, reg, expected)

    def test_mov_vfp_reg_to_vfp_reg(self):
        reg1 = vfp(5)
        reg2 = vfp(14)
        expected = [mi('VMOV_cc', reg2.value, reg1.value, cond=AL)]
        self.mov(reg1, reg2, expected)

    def test_mov_vfp_reg_to_stack(self):
        reg = vfp(7)
        s = stack_float(3)
        expected = [mi('VSTR', reg.value, fp.value, imm=192, cond=AL)]
        self.mov(reg, s, expected)

    def test_mov_vfp_reg_to_large_stackloc(self):
        reg = vfp(7)
        s = stack_float(800)
        expected = [
                    mi('gen_load_int', ip.value, s.value, cond=AL),
                    mi('ADD_rr', ip.value, fp.value, ip.value, cond=AL),
                    mi('VSTR', reg.value, ip.value, cond=AL),
                   ]
        self.mov(reg, s, expected)

    def test_mov_stack_to_vfp_reg(self):
        reg = vfp(7)
        s = stack_float(3)
        expected = [mi('VLDR', reg.value, fp.value, imm=192, cond=AL)]
        self.mov(s, reg, expected)

    def test_mov_big_stackloc_to_vfp_reg(self):
        reg = vfp(7)
        s = stack_float(800)
        expected = [
                    mi('gen_load_int', ip.value, s.value, cond=AL),
                    mi('ADD_rr', ip.value, fp.value, ip.value, cond=AL),
                    mi('VSTR', reg.value, ip.value, cond=AL),
                   ]
        self.mov(reg, s, expected)

    def test_unsopported_cases(self):
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm(1), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm(1), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm(1), vfp(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm(1), stack_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm_float(1), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm_float(1), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm_float(1), r(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(imm_float(1), stack(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(r(1), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(r(1), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(r(1), stack_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(r(1), vfp(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack(1), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack(1), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack(1), stack(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack(1), stack_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack(1), vfp(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack_float(1), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack_float(1), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack_float(1), r(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack_float(1), stack(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(stack_float(1), stack_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(vfp(1), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(vfp(1), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(vfp(1), r(2))')
        py.test.raises(AssertionError,
                    'self.asm.regalloc_mov(vfp(1), stack(2))')


class TestMovFromVFPLoc(BaseMovTest):
    def mov(self, a, b, c, expected=None):
        self.asm.mov_from_vfp_loc(a, b, c)
        self.validate(expected)

    def test_from_vfp(self):
        vr = vfp(10)
        r1 = r(1)
        r2 = r(2)
        e = [mi('VMOV_rc', r1.value, r2.value, vr.value, cond=AL)]
        self.mov(vr, r1, r2, e)

    def test_from_vfp_stack(self):
        s = stack_float(4)
        r1 = r(1)
        r2 = r(2)
        e = [
            mi('LDR_ri', r1.value, fp.value, imm=s.value, cond=AL),
            mi('LDR_ri', r2.value, fp.value, imm=s.value + WORD, cond=AL)]
        self.mov(s, r1, r2, e)

    def test_from_big_vfp_stack(self):
        s = stack_float(2049)
        r1 = r(1)
        r2 = r(2)
        e = [
            mi('gen_load_int', ip.value, s.value, cond=AL),
            mi('LDR_rr', r1.value, fp.value, ip.value, cond=AL),
            mi('ADD_ri', ip.value, ip.value, imm=WORD, cond=AL),
            mi('LDR_rr', r2.value, fp.value, ip.value, cond=AL),
            ]
        self.mov(s, r1, r2, e)

    def test_from_imm_float(self):
        i = imm_float(4)
        r1 = r(1)
        r2 = r(2)
        e = [
            mi('gen_load_int', ip.value, i.value, cond=AL),
            mi('LDR_ri', r1.value, ip.value, cond=AL),
            mi('LDR_ri', r2.value, ip.value, imm=4, cond=AL),
            ]
        self.mov(i, r1, r2, e)

    def test_unsupported(self):
        py.test.raises(AssertionError,
                        'self.asm.mov_from_vfp_loc(vfp(1), r(5), r(2))')
        py.test.raises(AssertionError,
                        'self.asm.mov_from_vfp_loc(stack(1), r(1), r(2))')
        py.test.raises(AssertionError,
                        'self.asm.mov_from_vfp_loc(imm(1), r(1), r(2))')
        py.test.raises(AssertionError,
                        'self.asm.mov_from_vfp_loc(r(1), r(1), r(2))')


class TestMoveToVFPLoc(BaseMovTest):
    def mov(self, r1, r2, vfp, expected):
        self.asm.mov_to_vfp_loc(r1, r2, vfp)
        self.validate(expected)

    def mov_to_vfp_reg(self):
        vr = vfp(10)
        r1 = r(1)
        r2 = r(2)
        e = [mi('VMOV_cr', vr.value, r1.value, r2.value, cond=AL)]
        self.mov(vr, r1, r2, e)

    def test_to_vfp_stack(self):
        s = stack_float(4)
        r1 = r(1)
        r2 = r(2)
        e = [
            mi('STR_ri', r1.value, fp.value, imm=s.value, cond=AL),
            mi('STR_ri', r2.value, fp.value, imm=s.value + WORD, cond=AL)]
        self.mov(r1, r2, s, e)

    def test_from_big_vfp_stack(self):
        s = stack_float(2049)
        r1 = r(1)
        r2 = r(2)
        e = [
            mi('gen_load_int', ip.value, s.value, cond=AL),
            mi('STR_rr', r1.value, fp.value, ip.value, cond=AL),
            mi('ADD_ri', ip.value, ip.value, imm=4, cond=AL),
            mi('STR_rr', r2.value, fp.value, ip.value, cond=AL),
            ]
        self.mov(r1, r2, s, e)

    def unsupported(self):
        py.test.raises(AssertionError,
                    'self.asm.mov_from_vfp_loc(r(5), r(2), vfp(4))')
        py.test.raises(AssertionError,
                    'self.asm.mov_from_vfp_loc(r(1), r(2), stack(2))')
        py.test.raises(AssertionError,
                    'self.asm.mov_from_vfp_loc(r(1), r(2), imm(2))')
        py.test.raises(AssertionError,
                    'self.asm.mov_from_vfp_loc(r(1), r(2), imm_float(2))')
        py.test.raises(AssertionError,
                    'self.asm.mov_from_vfp_loc(r(1), r(1), r(2))')


class TestRegallocPush(BaseMovTest):
    def push(self, v, e):
        self.asm.regalloc_push(v)
        self.validate(e)

    def test_push_imm(self):
        i = imm(12)
        e = [mi('gen_load_int', ip.value, 12, cond=AL),
             mi('PUSH', [ip.value], cond=AL)]
        self.push(i, e)

    def test_push_reg(self):
        r7 = r(7)
        e = [mi('PUSH', [r7.value], cond=AL)]
        self.push(r7, e)

    def test_push_imm_float(self):
        f = imm_float(7)
        e = [
            mi('gen_load_int', ip.value, 7, cond=AL),
            mi('VLDR', vfp_ip.value, ip.value, imm=0, cond=AL),
            mi('VPUSH', [vfp_ip.value], cond=AL)
            ]
        self.push(f, e)

    def test_push_stack(self):
        s = stack(7)
        e = [mi('LDR_ri', ip.value, fp.value, imm=s.value, cond=AL),
            mi('PUSH', [ip.value], cond=AL)
            ]
        self.push(s, e)

    def test_push_big_stack(self):
        s = stack(1025)
        e = [
            mi('gen_load_int', lr.value, s.value, cond=AL),
            mi('LDR_rr', ip.value, fp.value, lr.value, cond=AL),
            mi('PUSH', [ip.value], cond=AL)
            ]
        self.push(s, e)

    def test_push_vfp_reg(self):
        v1 = vfp(1)
        e = [mi('VPUSH', [v1.value], cond=AL)]
        self.push(v1, e)

    def test_push_stack_float(self):
        sf = stack_float(4)
        e = [
            mi('VLDR', vfp_ip.value, fp.value, imm=196, cond=AL),
            mi('VPUSH', [vfp_ip.value], cond=AL),
        ]
        self.push(sf, e)

    def test_push_large_stackfloat(self):
        sf = stack_float(1000)
        e = [
            mi('gen_load_int', ip.value, sf.value, cond=AL),
            mi('ADD_rr', ip.value, fp.value, ip.value, cond=AL),
            mi('VLDR', vfp_ip.value, ip.value, cond=AL),
            mi('VPUSH', [vfp_ip.value], cond=AL),
        ]
        self.push(sf, e)


class TestRegallocPop(BaseMovTest):
    def pop(self, loc, e):
        self.asm.regalloc_pop(loc)
        self.validate(e)

    def test_pop_reg(self):
        r1 = r(1)
        e = [mi('POP', [r1.value], cond=AL)]
        self.pop(r1, e)

    def test_pop_vfp_reg(self):
        vr1 = vfp(1)
        e = [mi('VPOP', [vr1.value], cond=AL)]
        self.pop(vr1, e)

    def test_pop_stackloc(self):
        s = stack(12)
        e = [
            mi('POP', [ip.value], cond=AL),
            mi('STR_ri', ip.value, fp.value, imm=s.value, cond=AL)]
        self.pop(s, e)

    def test_pop_big_stackloc(self):
        s = stack(1200)
        e = [
            mi('POP', [ip.value], cond=AL),
            mi('gen_load_int', lr.value, s.value, cond=AL),
            mi('STR_rr', ip.value, fp.value, lr.value, cond=AL),
            ]
        self.pop(s, e)

    def test_pop_float_stackloc(self):
        s = stack_float(12)
        e = [
            mi('VPOP', [vfp_ip.value], cond=AL),
            mi('VSTR', vfp_ip.value, fp.value, imm=s.value, cond=AL),
            ]
        self.pop(s, e)

    def test_pop_big_float_stackloc(self):
        s = stack_float(1200)
        e = [
            mi('VPOP', [vfp_ip.value], cond=AL),
            mi('gen_load_int', ip.value, s.value, cond=AL),
            mi('ADD_rr', ip.value, fp.value, ip.value, cond=AL),
            mi('VSTR', vfp_ip.value, ip.value, cond=AL),
        ]
        self.pop(s, e)

    def test_unsupported(self):
        py.test.raises(AssertionError, 'self.asm.regalloc_pop(imm(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_pop(imm_float(1))')

class TestRawStackLocs(BaseMovTest):
    def test_unsupported(self):
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(raw_stack(0), imm(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(raw_stack(0), imm_float(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(raw_stack(0), vfp(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(raw_stack(0), stack(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(raw_stack(0), stack_float(1))')

        py.test.raises(AssertionError, 'self.asm.regalloc_mov(imm_float(1), raw_stack(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(imm(1), raw_stack_float(1))')

        py.test.raises(AssertionError, 'self.asm.regalloc_mov(vfp(1), raw_stack(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(r(1), raw_stack_float(1))')

        py.test.raises(AssertionError, 'self.asm.regalloc_mov(stack_float(1), raw_stack(1))')
        py.test.raises(AssertionError, 'self.asm.regalloc_mov(stack(1), raw_stack_float(1))')

    def test_from_imm(self):
        s = raw_stack(1024)
        i = imm(999)
        e = [
            mi('gen_load_int', lr.value, i.value, cond=AL),
            mi('gen_load_int', ip.value, s.value, cond=AL),
            mi('STR_rr', lr.value, sp.value, ip.value, cond=AL),
            ]
        self.mov(i, s, e)

    def test_from_vfp_imm(self):
        s = raw_stack_float(1024)
        i = imm_float(999)
        e = [
            mi('gen_load_int', ip.value, i.value, cond=AL),
            mi('VLDR', vfp_ip.value, ip.value, cond=AL, imm=0),
            mi('gen_load_int', ip.value, s.value, cond=AL),
            mi('ADD_rr', ip.value, sp.value, ip.value, cond=AL),
            mi('VSTR', vfp_ip.value, ip.value, cond=AL),
            ]
        self.mov(i, s, e)

    def test_from_reg(self):
        s = raw_stack(1024)
        reg = r(10)
        e = [mi('gen_load_int', ip.value, s.value, cond=AL),
             mi('STR_rr', reg.value, sp.value, ip.value, cond=AL),
            ]
        self.mov(reg, s, e)

    def test_from_vfp_reg(self):
        s = raw_stack_float(1024)
        reg = vfp(10)
        e = [mi('gen_load_int', ip.value, s.value, cond=AL),
             mi('ADD_rr', ip.value, sp.value, ip.value, cond=AL),
             mi('VSTR', reg.value, ip.value, cond=AL),
            ]
        self.mov(reg, s, e)

    def test_from_stack(self):
        s = raw_stack(1024)
        reg = stack(10)
        e = [mi('LDR_ri', ip.value, fp.value, imm=216, cond=AL),
             mi('gen_load_int', lr.value, s.value, cond=AL),
             mi('STR_rr', ip.value, sp.value, lr.value, cond=AL),
            ]
        self.mov(reg, s, e)

    def test_from_vfp_stack(self):
        s = raw_stack_float(1024)
        reg = stack_float(10)
        e = [mi('VLDR', vfp_ip.value, fp.value, imm=220, cond=AL),
             mi('gen_load_int', ip.value, s.value, cond=AL),
             mi('ADD_rr', ip.value, sp.value, ip.value, cond=AL),
             mi('VSTR', vfp_ip.value, ip.value, cond=AL),
            ]
        self.mov(reg, s, e)