mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
test: add some additional test cases
Some test cases, mostly from bug reports. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
1e965e30ff
commit
fc82905b3c
2
test/baddq.asm
Normal file
2
test/baddq.asm
Normal file
@ -0,0 +1,2 @@
|
||||
%assign foo 'abcdefgh'
|
||||
dq foo
|
18
test/br3392711.asm
Normal file
18
test/br3392711.asm
Normal file
@ -0,0 +1,18 @@
|
||||
;
|
||||
; In br33927711 we've not been expanding %?? and %*?? correctly
|
||||
;
|
||||
section .text
|
||||
|
||||
%define label(prefix, suffix) prefix %+ suffix
|
||||
|
||||
label_1:
|
||||
mov eax, label(%??, _1)
|
||||
label_2:
|
||||
mov eax, label(%?, _2)
|
||||
|
||||
%define label0123456789a0123456789a0123456789a0123456789a0123456789a0123456789a0123456789(prefix, suffix) prefix %+ suffix
|
||||
|
||||
label0123456789a0123456789a0123456789a0123456789a0123456789a0123456789a0123456789_1:
|
||||
mov eax, label0123456789a0123456789a0123456789a0123456789a0123456789a0123456789a0123456789(%??, _1)
|
||||
label0123456789a0123456789a0123456789a0123456789a0123456789a0123456789a0123456789_2:
|
||||
mov eax, label0123456789a0123456789a0123456789a0123456789a0123456789a0123456789a0123456789(%??, _2)
|
9
test/join.asm
Normal file
9
test/join.asm
Normal file
@ -0,0 +1,9 @@
|
||||
%define join(sep) ''
|
||||
%define _join(sep,str) sep,str
|
||||
%define join(sep,s1,sn+) %strcat(s1, %map(_join:(sep) %, sn))
|
||||
|
||||
db join(':')
|
||||
db join(':','a')
|
||||
db join(':','a','b')
|
||||
db join(':','a','b','c')
|
||||
db join(':','a','b','c','d')
|
2
test/mapi.asm
Normal file
2
test/mapi.asm
Normal file
@ -0,0 +1,2 @@
|
||||
%define what(&x,i,n) %str(i+1),"/",%str(n),"=", x, `\n`
|
||||
db %map(what:(%mapi,%mapn),foo,bar,baz)
|
71
test/memleak.asm
Normal file
71
test/memleak.asm
Normal file
@ -0,0 +1,71 @@
|
||||
%imacro call 1.nolist
|
||||
%push
|
||||
%assign %$size 2
|
||||
%assign %$isreg 0
|
||||
%assign %$exit 0
|
||||
%rep 2
|
||||
%ifn %$exit
|
||||
%if %$size == 2
|
||||
%define %$regnames "ax cx dx bx sp bp si di "
|
||||
%elif %$size == 4
|
||||
%define %$regnames "eax ecx edx ebx esp ebp esi edi "
|
||||
%endif
|
||||
%assign %$index 0
|
||||
%rep 8
|
||||
%ifn %$exit
|
||||
%substr %$reg %$regnames %$index * 4 + 1, 4
|
||||
%deftok %$reg %$reg
|
||||
%ifnempty %$reg
|
||||
%ifidni %$reg, %1
|
||||
%assign %$isreg %$size
|
||||
%assign %$exit 1
|
||||
%exitrep
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
%assign %$index %$index + 1
|
||||
%endrep
|
||||
%if %$exit
|
||||
%exitrep
|
||||
%endif
|
||||
%assign %$size %$size * 2
|
||||
%endif
|
||||
%endrep
|
||||
|
||||
%assign %$ismulti 0
|
||||
%assign %$ismem 0
|
||||
%defstr %$string %1
|
||||
%strlen %$length %$string
|
||||
%assign %$ii 0
|
||||
%rep %$length
|
||||
%substr %$point %$string %$ii + 1, 1
|
||||
%if %$point == 32 || %$point == 9
|
||||
%assign %$ismulti 1
|
||||
%endif
|
||||
%ifidn %$point, '['
|
||||
%assign %$ismem 1
|
||||
%endif
|
||||
%assign %$ii %$ii + 1
|
||||
%endrep
|
||||
%pop
|
||||
%endmacro
|
||||
|
||||
|
||||
%ifndef _OUTER
|
||||
%assign _OUTER 100
|
||||
%endif
|
||||
%ifndef _INNER
|
||||
%assign _INNER 50
|
||||
%endif
|
||||
|
||||
%rep _OUTER
|
||||
call cx
|
||||
call near [0]
|
||||
call .
|
||||
%rep _INNER
|
||||
call label
|
||||
call labelfoo
|
||||
call labelbar
|
||||
call labelbaz
|
||||
%endrep
|
||||
%endrep
|
5
test/omferr.asm
Normal file
5
test/omferr.asm
Normal file
@ -0,0 +1,5 @@
|
||||
section _TEXT class=CODE
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
jmp far $
|
5
test/sm3-64.asm
Normal file
5
test/sm3-64.asm
Normal file
@ -0,0 +1,5 @@
|
||||
;Testname=sm3-64; Arguments=-felf64 -osm3-64.o -O0; Files=stdout stderr sm3-64.o
|
||||
BITS 64
|
||||
vsm3rnds2 xmm1, xmm2, xmm0, 0
|
||||
vsm3msg1 xmm1, xmm2, xmm3
|
||||
vsm3msg2 xmm1, xmm2, xmm3
|
5
test/sm3.asm
Normal file
5
test/sm3.asm
Normal file
@ -0,0 +1,5 @@
|
||||
;Testname=sm3; Arguments=-felf -osm3.o -O0; Files=stdout stderr sm3.o
|
||||
BITS 32
|
||||
vsm3rnds2 xmm1, xmm2, xmm0, 0
|
||||
vsm3msg1 xmm1, xmm2, xmm3
|
||||
vsm3msg2 xmm1, xmm2, xmm3
|
21
test/sm4-64.asm
Normal file
21
test/sm4-64.asm
Normal file
@ -0,0 +1,21 @@
|
||||
;Testname=sm4-64; Arguments=-felf -osm4-64.o -O0; Files=stdout stderr sm4-64.o
|
||||
BITS 64
|
||||
vsm4rnds4 xmm1, xmm2, xmm0
|
||||
vsm4rnds4 xmm2, xmm3, [rax]
|
||||
vsm4rnds4 xmm3, xmm4, [rax+0x12]
|
||||
vsm4rnds4 xmm4, xmm5, [rax+rbx*2]
|
||||
|
||||
vsm4rnds4 ymm1, ymm2, ymm0
|
||||
vsm4rnds4 ymm2, ymm3, [rax]
|
||||
vsm4rnds4 ymm3, ymm4, [rax+0x12]
|
||||
vsm4rnds4 ymm4, ymm5, [rax+rbx*2]
|
||||
|
||||
vsm4key4 xmm1, xmm2, xmm0
|
||||
vsm4key4 xmm2, xmm3, [rax]
|
||||
vsm4key4 xmm3, xmm4, [rax+0x12]
|
||||
vsm4key4 xmm4, xmm5, [rax+rbx*2]
|
||||
|
||||
vsm4key4 ymm1, ymm2, ymm0
|
||||
vsm4key4 ymm2, ymm3, [rax]
|
||||
vsm4key4 ymm3, ymm4, [rax+0x12]
|
||||
vsm4key4 ymm4, ymm5, [rax+rbx*2]
|
21
test/sm4.asm
Normal file
21
test/sm4.asm
Normal file
@ -0,0 +1,21 @@
|
||||
;Testname=sm4; Arguments=-felf -osm4.o -O0; Files=stdout stderr sm4.o
|
||||
BITS 32
|
||||
vsm4rnds4 xmm1, xmm2, xmm0
|
||||
vsm4rnds4 xmm2, xmm3, [eax]
|
||||
vsm4rnds4 xmm3, xmm4, [eax+0x12]
|
||||
vsm4rnds4 xmm4, xmm5, [eax+ebx*2]
|
||||
|
||||
vsm4rnds4 ymm1, ymm2, ymm0
|
||||
vsm4rnds4 ymm2, ymm3, [eax]
|
||||
vsm4rnds4 ymm3, ymm4, [eax+0x12]
|
||||
vsm4rnds4 ymm4, ymm5, [eax+ebx*2]
|
||||
|
||||
vsm4key4 xmm1, xmm2, xmm0
|
||||
vsm4key4 xmm2, xmm3, [eax]
|
||||
vsm4key4 xmm3, xmm4, [eax+0x12]
|
||||
vsm4key4 xmm4, xmm5, [eax+ebx*2]
|
||||
|
||||
vsm4key4 ymm1, ymm2, ymm0
|
||||
vsm4key4 ymm2, ymm3, [eax]
|
||||
vsm4key4 ymm3, ymm4, [eax+0x12]
|
||||
vsm4key4 ymm4, ymm5, [eax+ebx*2]
|
Loading…
Reference in New Issue
Block a user