File: irbuild-int.test

package info (click to toggle)
mypy 0.812-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 18,596 kB
  • sloc: python: 74,869; cpp: 11,212; ansic: 3,935; makefile: 238; sh: 13
file content (82 lines) | stat: -rw-r--r-- 1,293 bytes parent folder | download
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
[case testIntNeq]
def f(x: int, y: int) -> bool:
    return x != y
[out]
def f(x, y):
    x, y :: int
    r0 :: native_int
    r1, r2 :: bit
    r3 :: bool
    r4, r5 :: bit
L0:
    r0 = x & 1
    r1 = r0 == 0
    if r1 goto L1 else goto L2 :: bool
L1:
    r2 = x != y
    r3 = r2
    goto L3
L2:
    r4 = CPyTagged_IsEq_(x, y)
    r5 = r4 ^ 1
    r3 = r5
L3:
    return r3

[case testShortIntComparisons]
def f(x: int) -> int:
    if x == 3:
        return 1
    elif x != 4:
        return 2
    elif 5 == x:
        return 3
    elif 6 != x:
        return 4
    elif x < 4:
        return 5
    return 6
[out]
def f(x):
    x :: int
    r0, r1, r2, r3 :: bit
    r4 :: native_int
    r5, r6, r7 :: bit
L0:
    r0 = x == 6
    if r0 goto L1 else goto L2 :: bool
L1:
    return 2
L2:
    r1 = x != 8
    if r1 goto L3 else goto L4 :: bool
L3:
    return 4
L4:
    r2 = 10 == x
    if r2 goto L5 else goto L6 :: bool
L5:
    return 6
L6:
    r3 = 12 != x
    if r3 goto L7 else goto L8 :: bool
L7:
    return 8
L8:
    r4 = x & 1
    r5 = r4 != 0
    if r5 goto L9 else goto L10 :: bool
L9:
    r6 = CPyTagged_IsLt_(x, 8)
    if r6 goto L11 else goto L12 :: bool
L10:
    r7 = x < 8 :: signed
    if r7 goto L11 else goto L12 :: bool
L11:
    return 10
L12:
L13:
L14:
L15:
L16:
    return 12