aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-11-05 12:13:21 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 21:43:46 +0300
commit2776c76763ff98c7f9d88e7b394b82ec0bc9f37f (patch)
treeb9e1b69fb7b0a8749a00dceba0557173f9211352
parent9b6f94a410333c65d9151c5ff50a0a51fcb94327 (diff)
downloadnasm-2776c76763ff98c7f9d88e7b394b82ec0bc9f37f.tar.gz
nasm-2776c76763ff98c7f9d88e7b394b82ec0bc9f37f.tar.xz
nasm-2776c76763ff98c7f9d88e7b394b82ec0bc9f37f.zip
test: nasm-t -- Add optimization
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--travis/test/optimization-o0.bin.tbin0 -> 1764 bytes
-rw-r--r--travis/test/optimization-o1.bin.tbin0 -> 1741 bytes
-rw-r--r--travis/test/optimization-ox.bin.tbin0 -> 1732 bytes
-rw-r--r--travis/test/optimization.asm100
-rw-r--r--travis/test/optimization.json30
5 files changed, 130 insertions, 0 deletions
diff --git a/travis/test/optimization-o0.bin.t b/travis/test/optimization-o0.bin.t
new file mode 100644
index 00000000..4fd5ba59
--- /dev/null
+++ b/travis/test/optimization-o0.bin.t
Binary files differ
diff --git a/travis/test/optimization-o1.bin.t b/travis/test/optimization-o1.bin.t
new file mode 100644
index 00000000..a630ec2c
--- /dev/null
+++ b/travis/test/optimization-o1.bin.t
Binary files differ
diff --git a/travis/test/optimization-ox.bin.t b/travis/test/optimization-ox.bin.t
new file mode 100644
index 00000000..d21baf8d
--- /dev/null
+++ b/travis/test/optimization-ox.bin.t
Binary files differ
diff --git a/travis/test/optimization.asm b/travis/test/optimization.asm
new file mode 100644
index 00000000..0c1451ba
--- /dev/null
+++ b/travis/test/optimization.asm
@@ -0,0 +1,100 @@
+BITS 32
+
+; Simple
+jmp foo
+times 124 nop
+foo:
+
+; Must start short to converge optimally
+jmp car
+times 127 nop
+car:
+
+; Always near
+jmp cdr
+times 128 nop
+cdr:
+
+
+; Simple
+add eax, quux2 - quux1
+quux1:
+times 127 nop
+quux2:
+
+; Must start short
+corge1:
+add eax, corge2 - corge1
+times 127 - 3 nop
+corge2:
+
+
+; Simple
+lea eax, [bolug2-bolug1]
+bolug1:
+times 127 nop
+bolug2:
+
+; Must start short
+calog1:
+lea eax, [calog2-calog1]
+times 127 - 3 nop
+calog2:
+
+
+; Simple
+lea eax, [eax+dolug2-dolug1]
+dolug1:
+times 127 nop
+dolug2:
+
+; Must start short
+ealog1:
+lea eax, [eax+ealog2-ealog1]
+times 127 - 3 nop
+ealog2:
+
+; Must stay long!
+lea eax, [eax+folug2-folug1]
+folug1:
+times 128 nop
+folug2:
+
+; Must stay long!
+galog1:
+lea eax, [eax+galog2-galog1]
+times 128 - 3 nop
+galog2:
+
+; Sbyte tests...
+onetwentysix equ 126
+onetwentynine equ 129
+
+add eax,onetwentyseven ; sbyte (forward)
+add eax,onetwentyeight ; not sbyte (forward)
+add eax,onetwentyseven ; sbyte (forward)
+add eax,onetwentysix ; sbyte (backward)
+add eax,onetwentynine ; not sbyte (backward)
+add ecx,onetwentyseven ; sbyte (forward)
+add ecx,onetwentyeight ; not sbyte (forward)
+add ecx,onetwentyseven ; sbyte (forward)
+add ecx,onetwentysix ; sbyte (backward)
+add ecx,onetwentynine ; not sbyte (backward)
+
+onetwentyseven equ 127
+onetwentyeight equ 128
+
+; Simple
+add eax, holug2-holug1
+holug1:
+times 127 nop
+holug2:
+
+; Must start short
+ialog1:
+add eax, ialog2-ialog1
+times 127 - 3 nop
+ialog2:
+
+; Do not confuse forward references and segmentless addresses!
+jmp 12345
diff --git a/travis/test/optimization.json b/travis/test/optimization.json
new file mode 100644
index 00000000..85bb9a82
--- /dev/null
+++ b/travis/test/optimization.json
@@ -0,0 +1,30 @@
+[
+ {
+ "description": "Test optimization options (-Ox)",
+ "id": "optimization",
+ "format": "bin",
+ "source": "optimization.asm",
+ "option": "-Ox",
+ "target": [
+ { "output": "optimization-ox.bin" }
+ ]
+ },
+ {
+ "description": "Test optimization options (-O0)",
+ "ref": "optimization",
+ "source": "optimization.asm",
+ "option": "-O0",
+ "target": [
+ { "output": "optimization-o0.bin" }
+ ]
+ },
+ {
+ "description": "Test optimization options (-O1)",
+ "ref": "optimization",
+ "source": "optimization.asm",
+ "option": "-O1",
+ "target": [
+ { "output": "optimization-o1.bin" }
+ ]
+ }
+]