diff options
author | Victor van den Elzen <victor.vde@gmail.com> | 2009-03-31 04:59:44 +0200 |
---|---|---|
committer | Victor van den Elzen <victor.vde@gmail.com> | 2010-07-24 22:00:12 +0200 |
commit | ac732cb6a599836bf4c988e59ac6de4498758c72 (patch) | |
tree | 9983e099a978cd40786f9529eb687a6d5a14d265 /test | |
parent | 088d151130b427367766057feadd8351e03ee19b (diff) | |
download | nasm-ac732cb6a599836bf4c988e59ac6de4498758c72.tar.gz nasm-ac732cb6a599836bf4c988e59ac6de4498758c72.tar.bz2 nasm-ac732cb6a599836bf4c988e59ac6de4498758c72.zip |
Improve process_ea and introduce -OL
Two fixes:
1. Optimization of [bx+0xFFFF] etc
0xFFFF is an sbyte under 16-bit semantics,
so make sure to check it right.
2. Don't optimize displacements in -O0
Displacements that fit into an sbyte or
can be removed should *not* be optimized in -O0.
Implicit zero displacements are still optimized, e.g.:
[eax] -> 0 bit displacement, [ebp] -> 8 bit displacement.
However explicit displacements are not optimized:
[eax+0] -> 32 bit displacement, [ebp+0] -> 32 bit displacement.
Because #2 breaks compatibility with 0.98,
I introduced a new optimization level: -OL, legacy.
Diffstat (limited to 'test')
-rw-r--r-- | test/zero_displacement.asm | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/zero_displacement.asm b/test/zero_displacement.asm new file mode 100644 index 0000000..5aa4743 --- /dev/null +++ b/test/zero_displacement.asm @@ -0,0 +1,37 @@ +;Testname=O0; Arguments=-O0 -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin +;Testname=OL; Arguments=-OL -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin +;Testname=O1; Arguments=-O1 -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin +;Testname=Ox; Arguments=-Ox -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin + +bits 16 + +mov ax, [bx] +mov ax, [bx+0] + +mov ax, [bx+di] +mov ax, [bx+di+0] + +mov ax, [bp] +mov ax, [bp+0] + +bits 32 + +mov eax, [eax] +mov eax, [eax+0] + +mov eax, [eax+ebx] +mov eax, [eax+ebx+0] + +mov eax, [ebp] +mov eax, [ebp+0] + +bits 64 + +mov eax, [rax] +mov eax, [rax+0] + +mov eax, [rax+rbx] +mov eax, [rax+rbx+0] + +mov eax, [rbp] +mov eax, [rbp+0] |