Change rights 644 to 755
[nasm/github.git] / test / optimization.asm
blobd78209d96e9c2380a76744f65c5bc47dc60b2212
1 ;Testname=O0; Arguments=-O0 -fbin -ooptimization.bin; Files=stdout stderr optimization.bin
2 ;Testname=O1; Arguments=-O1 -fbin -ooptimization.bin; Files=stdout stderr optimization.bin
3 ;Testname=Ox; Arguments=-Ox -fbin -ooptimization.bin; Files=stdout stderr optimization.bin
5 BITS 32
7 ; Simple
8 jmp foo
9 times 124 nop
10 foo:
12 ; Must start short to converge optimally
13 jmp car
14 times 127 nop
15 car:
17 ; Always near
18 jmp cdr
19 times 128 nop
20 cdr:
23 ; Simple
24 add eax, quux2 - quux1
25 quux1:
26 times 127 nop
27 quux2:
29 ; Must start short
30 corge1:
31 add eax, corge2 - corge1
32 times 127 - 3 nop
33 corge2:
36 ; Simple
37 lea eax, [bolug2-bolug1]
38 bolug1:
39 times 127 nop
40 bolug2:
42 ; Must start short
43 calog1:
44 lea eax, [calog2-calog1]
45 times 127 - 3 nop
46 calog2:
49 ; Simple
50 lea eax, [eax+dolug2-dolug1]
51 dolug1:
52 times 127 nop
53 dolug2:
55 ; Must start short
56 ealog1:
57 lea eax, [eax+ealog2-ealog1]
58 times 127 - 3 nop
59 ealog2:
61 ; Must stay long!
62 lea eax, [eax+folug2-folug1]
63 folug1:
64 times 128 nop
65 folug2:
67 ; Must stay long!
68 galog1:
69 lea eax, [eax+galog2-galog1]
70 times 128 - 3 nop
71 galog2:
73 ; Sbyte tests...
74 onetwentysix equ 126
75 onetwentynine equ 129
77 add eax,onetwentyseven ; sbyte (forward)
78 add eax,onetwentyeight ; not sbyte (forward)
79 add eax,onetwentyseven ; sbyte (forward)
80 add eax,onetwentysix ; sbyte (backward)
81 add eax,onetwentynine ; not sbyte (backward)
82 add ecx,onetwentyseven ; sbyte (forward)
83 add ecx,onetwentyeight ; not sbyte (forward)
84 add ecx,onetwentyseven ; sbyte (forward)
85 add ecx,onetwentysix ; sbyte (backward)
86 add ecx,onetwentynine ; not sbyte (backward)
88 onetwentyseven equ 127
89 onetwentyeight equ 128
91 ; Simple
92 add eax, holug2-holug1
93 holug1:
94 times 127 nop
95 holug2:
97 ; Must start short
98 ialog1:
99 add eax, ialog2-ialog1
100 times 127 - 3 nop
101 ialog2:
103 ; Do not confuse forward references and segmentless addresses!
104 jmp 12345