File: test_callbuilder.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 (47 lines) | stat: -rw-r--r-- 1,985 bytes parent folder | download | duplicates (9)
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
from rpython.jit.backend.arm.callbuilder import HardFloatCallBuilder
from rpython.jit.backend.arm import registers as r



def test_hf_vfp_registers_all_singlefloat():
    hf = HardFloatCallBuilder.__new__(HardFloatCallBuilder)
    got = [hf.get_next_vfp('S') for i in range(18)]
    assert got == [r.s0, r.s1, r.s2, r.s3, r.s4, r.s5, r.s6, r.s7,
                   r.s8, r.s9, r.s10, r.s11, r.s12, r.s13, r.s14, r.s15,
                   None, None]

def test_hf_vfp_registers_all_doublefloat():
    hf = HardFloatCallBuilder.__new__(HardFloatCallBuilder)
    got = [hf.get_next_vfp('f') for i in range(10)]
    assert got == [r.d0, r.d1, r.d2, r.d3, r.d4, r.d5, r.d6, r.d7,
                   None, None]

def test_hf_vfp_registers_mixture():
    hf = HardFloatCallBuilder.__new__(HardFloatCallBuilder)
    got = [hf.get_next_vfp('S'), hf.get_next_vfp('f'),
           hf.get_next_vfp('S'), hf.get_next_vfp('f'),
           hf.get_next_vfp('S'), hf.get_next_vfp('f'),
           hf.get_next_vfp('S'), hf.get_next_vfp('f'),
           hf.get_next_vfp('S'), hf.get_next_vfp('f'),
           hf.get_next_vfp('S'), hf.get_next_vfp('f'),
           hf.get_next_vfp('S'), hf.get_next_vfp('f')]
    assert got == [r.s0,  r.d1,
                   r.s1,  r.d2,
                   r.s6,  r.d4,
                   r.s7,  r.d5,
                   r.s12, r.d7,
                   r.s13, None,
                   None,  None]

def test_hf_vfp_registers_mixture_2():
    hf = HardFloatCallBuilder.__new__(HardFloatCallBuilder)
    got = [hf.get_next_vfp('f'), hf.get_next_vfp('f'),
           hf.get_next_vfp('f'), hf.get_next_vfp('f'),
           hf.get_next_vfp('f'), hf.get_next_vfp('f'),
           hf.get_next_vfp('f'), hf.get_next_vfp('S'),
           hf.get_next_vfp('f'), hf.get_next_vfp('S')]
    assert got == [r.d0, r.d1,
                   r.d2, r.d3,
                   r.d4, r.d5,
                   r.d6, r.s14,
                   None, None]    # <- and not r.s15 for the last item