summaryrefslogtreecommitdiff
path: root/test/immwarn.asm
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-05 19:41:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-05 19:41:32 -0700
commit9ac2b843b40c49f859318aced3a15bc7aa1e0401 (patch)
tree297988bef98d994f6486547b532dacc27c75fbb9 /test/immwarn.asm
parent1b221bed2547b7432d873074bfc62907f504aed7 (diff)
downloadnasm-9ac2b843b40c49f859318aced3a15bc7aa1e0401.tar.gz
test/immwarn.asm: new test for immediate warnings
Test for various conditions that should or should not generate immediate warnings. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'test/immwarn.asm')
-rw-r--r--test/immwarn.asm54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/immwarn.asm b/test/immwarn.asm
new file mode 100644
index 00000000..30ca0803
--- /dev/null
+++ b/test/immwarn.asm
@@ -0,0 +1,54 @@
+;Testname=onowarn; Arguments=-Ox -DOPT=1 -DWARN=0 -fbin -oimmwarn.bin; Files=.stdout .stderr immwarn.bin
+;Testname=owarn; Arguments=-Ox -DOPT=1 -DWARN=1 -fbin -oimmwarn.bin; Files=.stdout .stderr immwarn.bin
+;Testname=nowarn; Arguments=-O0 -DOPT=0 -DWARN=0 -fbin -oimmwarn.bin; Files=.stdout .stderr immwarn.bin
+;Testname=warn; Arguments=-O0 -DOPT=1 -DWARN=1 -fbin -oimmwarn.bin; Files=.stdout .stderr immwarn.bin
+
+%ifndef WARN
+ %define WARN 1
+%endif
+
+ bits 16
+ push 1
+%if WARN
+ push 0ffffffffh
+%endif
+ push -1
+ push 0ffffh
+
+ add ax,0FFFFh
+%if WARN
+ add ax,0FFFFFFFFh
+%endif
+ add ax,-1
+
+ bits 32
+ push 1
+ push 0ffffffffh
+ push -1
+ push 0ffffh
+
+ push byte 1
+%if WARN
+ push byte 0ffffffffh
+%endif
+ push byte -1
+
+ push word 1
+ push word 0ffffh
+ push word -1
+
+ push dword 1
+ push dword 0ffffffffh
+ push dword -1
+
+ add eax,0FFFFh
+ add eax,0FFFFFFFFh
+ add eax,-1
+
+ bits 64
+ mov rax,7fffffffh
+ mov rax,80000000h
+; mov rax,dword 80000000h
+ add rax,0FFFFh
+ add rax,0FFFFFFFFh
+ add rax,-1