-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add some additional test cases
Some test cases, mostly from bug reports. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
- Loading branch information
H. Peter Anvin
committed
Jan 30, 2024
1 parent
1e965e3
commit fc82905
Showing
10 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
%assign foo 'abcdefgh' | ||
dq foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
%define what(&x,i,n) %str(i+1),"/",%str(n),"=", x, `\n` | ||
db %map(what:(%mapi,%mapn),foo,bar,baz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
section _TEXT class=CODE | ||
nop | ||
nop | ||
nop | ||
jmp far $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |