optimization.asm: add EA optimization tests
[nasm/perl-rewrite.git] / test / optimization.asm
blobfcc209e310d6ba559be0ea5f481946fee4d1753d
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 ; Do not confuse forward references and segmentless addresses!
74 jmp 12345