Debian Codegraph @

travis/test/optimization.asm

raw
1 BITS 32
2
3 ; Simple
4 jmp foo
5 times 124 nop
6 foo:
7
8 ; Must start short to converge optimally
9 jmp car
10 times 127 nop
11 car:
12
13 ; Always near
14 jmp cdr
15 times 128 nop
16 cdr:
17
18
19 ; Simple
20 add eax, quux2 - quux1
21 quux1:
22 times 127 nop
23 quux2:
24
25 ; Must start short
26 corge1:
27 add eax, corge2 - corge1
28 times 127 - 3 nop
29 corge2:
30
31
32 ; Simple
33 lea eax, [bolug2-bolug1]
34 bolug1:
35 times 127 nop
36 bolug2:
37
38 ; Must start short
39 calog1:
40 lea eax, [calog2-calog1]
41 times 127 - 3 nop
42 calog2:
43
44
45 ; Simple
46 lea eax, [eax+dolug2-dolug1]
47 dolug1:
48 times 127 nop
49 dolug2:
50
51 ; Must start short
52 ealog1:
53 lea eax, [eax+ealog2-ealog1]
54 times 127 - 3 nop
55 ealog2:
56
57 ; Must stay long!
58 lea eax, [eax+folug2-folug1]
59 folug1:
60 times 128 nop
61 folug2:
62
63 ; Must stay long!
64 galog1:
65 lea eax, [eax+galog2-galog1]
66 times 128 - 3 nop
67 galog2:
68
69 ; Sbyte tests...
70 onetwentysix equ 126
71 onetwentynine equ 129
72
73 add eax,onetwentyseven ; sbyte (forward)
74 add eax,onetwentyeight ; not sbyte (forward)
75 add eax,onetwentyseven ; sbyte (forward)
76 add eax,onetwentysix ; sbyte (backward)
77 add eax,onetwentynine ; not sbyte (backward)
78 add ecx,onetwentyseven ; sbyte (forward)
79 add ecx,onetwentyeight ; not sbyte (forward)
80 add ecx,onetwentyseven ; sbyte (forward)
81 add ecx,onetwentysix ; sbyte (backward)
82 add ecx,onetwentynine ; not sbyte (backward)
83
84 onetwentyseven equ 127
85 onetwentyeight equ 128
86
87 ; Simple
88 add eax, holug2-holug1
89 holug1:
90 times 127 nop
91 holug2:
92
93 ; Must start short
94 ialog1:
95 add eax, ialog2-ialog1
96 times 127 - 3 nop
97 ialog2:
98
99 ; Do not confuse forward references and segmentless addresses!
100 jmp 12345