aboutsummaryrefslogtreecommitdiffstats
path: root/travis/test
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 12:50:28 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 21:43:46 +0300
commitb87a996ef06603f98c570d66c3429cf123a89f7e (patch)
treec2ef50d3d1a77e4b0b058930dad59961f059192d /travis/test
parentbfe17213e00a8397cf2e94b79ab30d98826c492e (diff)
downloadnasm-b87a996ef06603f98c570d66c3429cf123a89f7e.tar.gz
nasm-b87a996ef06603f98c570d66c3429cf123a89f7e.tar.xz
nasm-b87a996ef06603f98c570d66c3429cf123a89f7e.zip
test: nasm-t -- Add imul
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'travis/test')
-rw-r--r--travis/test/imul-nowarn.bin.tbin0 -> 652 bytes
-rw-r--r--travis/test/imul-warn.bin.tbin0 -> 1365 bytes
-rw-r--r--travis/test/imul-warn.stderr76
-rw-r--r--travis/test/imul.asm114
-rw-r--r--travis/test/imul.json20
5 files changed, 210 insertions, 0 deletions
diff --git a/travis/test/imul-nowarn.bin.t b/travis/test/imul-nowarn.bin.t
new file mode 100644
index 00000000..c7fbb984
--- /dev/null
+++ b/travis/test/imul-nowarn.bin.t
Binary files differ
diff --git a/travis/test/imul-warn.bin.t b/travis/test/imul-warn.bin.t
new file mode 100644
index 00000000..967d354b
--- /dev/null
+++ b/travis/test/imul-warn.bin.t
Binary files differ
diff --git a/travis/test/imul-warn.stderr b/travis/test/imul-warn.stderr
new file mode 100644
index 00000000..ba0b5c19
--- /dev/null
+++ b/travis/test/imul-warn.stderr
@@ -0,0 +1,76 @@
+./travis/test/imul.asm:111: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:37: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:111: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:41: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:111: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:52: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:111: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:54: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:36: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:37: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:38: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:39: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:41: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:51: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:52: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:112: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:54: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:36: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:37: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:38: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:39: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:40: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:41: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:42: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:43: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword immediate exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:45: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:45: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:46: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword immediate exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:47: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:47: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword immediate exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:48: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:48: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: word data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:51: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:52: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:53: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:54: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword immediate exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:56: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: dword data exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:56: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed byte value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:57: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:91: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:92: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:93: ... from macro `test' defined here [-w+number-overflow]
+./travis/test/imul.asm:113: warning: signed dword value exceeds bounds [-w+number-overflow]
+./travis/test/imul.asm:102: ... from macro `test' defined here [-w+number-overflow] \ No newline at end of file
diff --git a/travis/test/imul.asm b/travis/test/imul.asm
new file mode 100644
index 00000000..bfb6e054
--- /dev/null
+++ b/travis/test/imul.asm
@@ -0,0 +1,114 @@
+%macro test 1-3 5 -2
+ bits %1
+
+%undef MEM
+%if %1 == 16
+ %define MEM [di]
+%elif %1 == 32
+ %define MEM [edi]
+%elif %1 == 64
+ %define MEM [rdi]
+%endif
+
+ imul al
+ imul byte MEM
+ imul ax
+ imul word MEM
+ imul eax
+ imul dword MEM
+%if %1 == 64
+ imul rdx
+ imul qword MEM
+%endif
+
+ imul ax,cx
+ imul ax,MEM
+ imul ax,word MEM
+ imul eax,ecx
+ imul eax,MEM
+ imul eax,dword MEM
+%if %1 == 64
+ imul rax,rcx
+ imul rax,MEM
+ imul rax,qword MEM
+%endif
+
+ imul ax,cx,%2
+ imul ax,cx,byte %2
+ imul ax,MEM,%2
+ imul ax,word MEM,%2
+ imul eax,ecx,%2
+ imul eax,ecx,byte %2
+ imul eax,MEM,%2
+ imul eax,dword MEM,%2
+%if %1 == 64
+ imul rax,rcx,%2
+ imul rax,rcx,byte %2
+ imul rax,MEM,%2
+ imul rax,qword MEM,%2
+%endif
+
+ imul ax,%2
+ imul ax,byte %2
+ imul eax,%2
+ imul eax,byte %2
+%if %1 == 64
+ imul rax,%2
+ imul rax,byte %2
+%endif
+
+ imul ax,cx,0x1234
+ imul ax,MEM,0x1234
+ imul ax,word MEM,0x1234
+ imul eax,ecx,0x12345678
+ imul eax,MEM,0x12345678
+ imul eax,dword MEM,0x12345678
+%if %1 == 64
+ imul rax,rcx,0x12345678
+ imul rax,MEM,0x12345678
+ imul rax,qword MEM,0x12345678
+%endif
+
+ imul ax,0x1234
+ imul eax,0x12345678
+%if %1 == 64
+ imul rax,0x12345678
+%endif
+
+ imul ax,cx,0xfffe
+ imul ax,MEM,0xfffe
+ imul ax,word MEM,0xfffe
+ imul ax,cx,0xfe
+ imul ax,MEM,0xfe
+ imul ax,word MEM,0xfe
+ imul eax,ecx,0xfffffffe
+ imul eax,MEM,0xfffffffe
+ imul eax,dword MEM,0xfffffffe
+ imul eax,ecx,0xfffe
+ imul eax,MEM,0xfffe
+ imul eax,dword MEM,0xfffe
+%if %1 == 64
+ imul rax,rcx,%3
+ imul rax,MEM,%3
+ imul rax,qword MEM,%3
+ imul rax,rcx,0xfffe
+ imul rax,MEM,0xfffe
+ imul rax,qword MEM,0xfffe
+%endif
+
+ imul ax,0xfffe
+ imul eax,0xfffffffe
+%if %1 == 64
+ imul rax,%3
+%endif
+%endmacro
+
+ test 16
+ test 32
+ test 64
+
+%ifdef WARN
+ test 16,0x999
+ test 32,0x999999
+ test 64,0x999999999,0xfffffffe
+%endif
diff --git a/travis/test/imul.json b/travis/test/imul.json
new file mode 100644
index 00000000..b5b9d9e8
--- /dev/null
+++ b/travis/test/imul.json
@@ -0,0 +1,20 @@
+[
+ {
+ "description": "Test warnings on imul operation (nowarn)",
+ "id": "imul",
+ "format": "bin",
+ "source": "imul.asm",
+ "target": [
+ { "output": "imul-nowarn.bin" }
+ ]
+ },
+ {
+ "description": "Test warnings on imul operation (warn)",
+ "ref": "imul",
+ "option": "-DWARN",
+ "target": [
+ { "output": "imul-warn.bin" },
+ { "stderr": "imul-warn.stderr" }
+ ]
+ }
+]