Commit graph

500 commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
56200857e2 build: only use @SET_MAKE@ in the top-level Makefile.in
@SET_MAKE@ (AC_PROG_MAKE_SET) is a legacy autoconf substitution needed
only for very old Unix make implementations that don't automatically
propagate $(MAKE) to recursively invoked sub-makes. Every Makefile.in
in the tree carried its own copy, but that's unnecessary: exporting
MAKE once, from the top-level Makefile.in, is sufficient for it to
reach any sub-make invoked (directly or transitively) from there.

Replace the top-level @SET_MAKE@ with the pair "@SET_MAKE@" followed
by "export MAKE", and drop the now-redundant @SET_MAKE@ line from
doc/Makefile.in, misc/Makefile.in and test/Makefile.in.

This incidentally fixes doc/Makefile.in being usable when fed directly
to nmake (as Mkfiles/msvc.mak's "docs" rule does, since it predates
running ./configure): a bare "@SET_MAKE@" line, left unexpanded, is
not a valid nmake assignment or rule and previously caused a hard
parse error (U1035, "expected ':' or '=' separator").

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-07 15:26:53 -07:00
H. Peter Anvin (Intel)
75024b8109 test: remove test/performtest.pl and redirect {test,golden} targets
Remove the long-since-unmaintained test/performtest.pl script and
redirect the "test" and "golden" Makefile targets to their respective
travis targets.

The test/ directory still has two important functions:

1. Running ad hoc tests manually. The test/ directory has
   infrastructure for running a quick test manually in a large number
   of configurations. This is highly useful during development.

2. It contains the infrastructure for running regression tests on
   external applications, far too big to include into NASM itself.

Reported-by: Ross Burton <ross@burtonini.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-07-06 13:58:35 -07:00
Joshua Watt
851460a10b Add --debug-prefix-map option
Adds an option to remap file prefixes in output object files. This is
analogous to the "-fdebug-prefix-map" option in GCC, and allows files to
be built in a reproducible manner regardless of the build directory.

[ hpa: this still needs to be documented in doc/running.src. ]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-07-04 19:22:48 -07:00
H. Peter Anvin (Intel)
7f69cf689c travis: reorganize directories, add tests from the test/ directory
This is a mostly automated, partially AI-assisted migration of tests
from the test/ directory into the travis framework.

Running tests manually in the test/ directory is still supported, but
move common include files into travis/test and add a default -I option
to Makefile.in in the test/ directory.

The incbin test fails for pre-existing reasons; for now it contains an
stderr file with the errors. The problem is that INCBIN is both a
macro and a special instruction (not even a directive...), but there
currently is no way to handle prefixes, *especially* TIMES, in
multi-line macros. This is a separate problem and needs to be dealt
with as such.

Reorganize the travis directory so that each test or collection of
tests are in a separate subdirectory of travis/, and travis itself
lives in tools/travis to avoid creating deeper paths.

Add support for recording compression options in the travis .json
files, so that compressed files can be recreated with the same
options: because of the generally repetitive nature of the binary
output test files, the parameters used for xz compression can matter
enormously.

These are combined into a single huge commit to avoid adding large
binary files into the repository that then would immediately be
obsoleted, but still retained in git.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-30 20:54:46 -07:00
H. Peter Anvin (Intel)
386f5d44f7 test/amx: suppress obsolete-removed warning for TMMULTF32PS
TMMULTF32PS was retagged never, suppress the warning to avoid a travis
failure.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-30 17:22:13 -07:00
H. Peter Anvin (Intel)
47f1cd8ede test: add test for %pragma list options and __?LIST_OPTIONS*?__
A simple test for tweaking the list options from the source code.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-28 20:35:56 -07:00
H. Peter Anvin (Intel)
096c82e141 fpu.asm: test a few more syntax combinations
This also underscores the missing "to" forms of some instructions, but
that is not a regression of any kind; in fact seems to have been there
since the very beginning.

It is probably so that we should use the 2-operand forms as the
preferred disassembly forms, but that's a totally different task.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-28 18:41:20 -07:00
H. Peter Anvin (Intel)
4d18bdd318 listing: allow the user to suppress abbreviation of TIMES and INCBIN
Allow the user to suppress the abbreviation of the output from TIMES
(and therefore ALIGN) and INCBIN.

Sync the documentation with the help text, too.

Fixes: https://github.com/netwide-assembler/nasm/issues/211
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-28 18:11:40 -07:00
H. Peter Anvin (Intel)
1fc631a173 directiv.c: $-hex requires nasm_isnumstart, not just nasm_isnumchar
For identifier-escapes beginning with $a-f to work, the $ hexadecimal
prefix cannot be used, nor could it ever be used, with A-F immediately
after the $. This is the main reason the $-hex has been deprecated.

When adding the non-dollarhex mode, this got accidentally promoted to
nasm_isnumchar() instead of nasm_isnumstart(), which broke using
$-escaped identifiers in directives.

To fix this properly, it would be a good thing to add a central
identifier-skipping function.

Fixes: https://github.com/netwide-assembler/nasm/issues/223
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-25 14:58:22 -07:00
knut st. osmundsen
251b9c6825 test/wrtsymtab.asm: reproducible
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-07 20:05:20 -07:00
knut st. osmundsen
f1e4e6fe16 outcoff.c: dd symbol wrt ..symtab
Added a special symbol ..symtab for emitting the COFF symbol table
index of a symbol rather than some kind of address.  For use with ehcont
metadata and possible other stuff.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-07 20:05:20 -07:00
Yongjie Sheng
8058e5df17 Add project test for cryptography-primitives
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-09 18:13:38 -07:00
H. Peter Anvin (Intel)
00fe1077dc Add \^ escape sequences for Ctrl characters
It is fairly common to want to represent characters like
Ctrl-Z. Instead of having to use character codes, allow these to be
coded as `\^z` or `\^Z` instead.

`\^?` is DEL.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-09 18:08:21 -07:00
H. Peter Anvin (Intel)
fe5235ffc9 limits: allow querying limits, and reset limits for each pass
Allow limits to be queried via a %limit() preprocessor function and a
__?NASM_LIMITS?__ macro.

Reset limits at the top of each pass. Note that the pass number limits
are checked at the *end* of the pass, so a %pragma limit will be
properly honored anyway.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-04-09 17:00:49 -07:00
H. Peter Anvin (Intel)
c8fa17205b Add support for C2y-style \o and braced escapes, and \d for decimal
C2y adds \o for octal byte escapes, and allows \x, \o, or \u escape
sequences to be enclosed in braces to indicate their termination.

Add a \d sequence as a NASM extension to allow decimal bytes to be
specified.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-06 17:59:28 -08:00
H. Peter Anvin (Intel)
99898edfc1 test/crc32.asm: remove "bits BITS" hack
The --bits option makes this pointless.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-03 08:54:01 -08:00
H. Peter Anvin (Intel)
b4f74befce test/immsize2.asm: remove bits BITS
The --bits option makes this pointless.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-03 08:54:01 -08:00
H. Peter Anvin (Intel)
5bb69e6c8b test.inc: remove BITS hack
The --bits option makes the BITS hack unnecessary, and it somewhat
conflicts with the directive name itself.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-03 08:54:01 -08:00
H. Peter Anvin (Intel)
c2344472c2 test: add a test for pushing immediates. Add a common header file.
- Add a test for pushing immediates and popping registers of various
  sizes.
- Add a common header file which probably will be useful for many
  tests.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-02 12:50:49 -08:00
H. Peter Anvin (Intel)
7c6bcd9589 test: add additional test for immediate sizes and arithmetic
Immediate sizes in arithmetic instructions can be tricky when using
optimization.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-03-02 12:13:21 -08:00
H. Peter Anvin (Intel)
94923e1382 travis: improve the RET instruction test
Split the RET instruction test by mode for ease of disassembly, and
test more subcases.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-15 22:51:34 -07:00
H. Peter Anvin (Intel)
94dd4d30a7 test: improve ret.asm
Add more valid and invalid combinations of return instructions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-15 21:12:58 -07:00
Yongjie Sheng
3e925ee75c add project test for intel-ipsec-mb isa-l_crypto isa-l 2025-10-11 09:49:07 +08:00
H. Peter Anvin (Intel)
a7457e66cf Fix matching of branch instructions with prefixes and sizes
Matching of branch instructions with prefixes and sizes is, to say the
least, tricky. Work through it, and add a new macro to help.

Fixes: https://github.com/netwide-assembler/nasm/issues/144
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-10 13:07:46 -07:00
InstLatx64
378ee0e9c5 AMX-TRANSPOSE: removed, retag instructions NEVER.
All the 16 AMX-TRANSPOSE instructions were removed from the 59th
edition of "Intel Architecture Instruction Set Extensions and Future
Features Programming Reference" September 2025, 319433-059.

Similar to PCOMMIT, they are tagged as 'NEVER'

[ hpa: don't remove from tests, but suppress the warnings.  Don't
  remove the CPUID tag; a future version of NASM will actually implement
  CPU filtering based on the various CPUID tags; that development is
  genuinely in progress. ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-09 14:44:24 -07:00
Yongjie2017
a684942de0 the list file existing or not should not fail the copy instead fail the nasm compiling itself so nasm -v is excused 2025-10-08 13:07:07 -07:00
Yongjie Sheng
420313da8c add project test support to dav1d 2025-10-08 13:07:07 -07:00
InstLatx64
019615f85f AMX fix
-- AMX instruction fixes
-- AMX test file extension with new levels
according to Intel ISA Extension Guide 58th edition

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-08 11:59:23 -07:00
InstLatx64
292d852f55 AVX-NE-CONVERT fix
AVX-NE-CONVERT fix:
- only VCVTNEPS2BF16 has EVEX version
AVX-NE-CONVERT32b/64b test files
Checked with XED version: [v2025.06.08]
2025-10-08 11:51:04 -07:00
H. Peter Anvin (Intel)
41d35bb483 Merge multiple fixes from "InstLatx64" 2025-10-07 10:13:12 -07:00
H. Peter Anvin
e72a54174c insns.dat: correct the [LD][GI]DT patterns
It is somewhat counterintuitive, but the correct flag for the memory
operand is "OSIZE". The "nw" flag takes care of promoting the default
operand size on 64 bits to 64.

Fixes: https://github.com/netwide-assembler/nasm/issues/130
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 09:58:54 -07:00
H. Peter Anvin
f047ceeae3 test/Makefile: add .bin{16,32,64} targets
Quick and easy way to run the same test for 16-, 32- and 64-bit output
without mixing them together in one binary output file.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-07 09:57:19 -07:00
Yongjie Sheng
d66187c1de reconstruct ffmpegtest to be generic to support more different projects 2025-10-07 08:11:33 -07:00
InstLatx64
2a2acca7c0 AVX512_VP2INTERSECT test files
AVX512_VP2INTERSECT 32b/64b test files
Checked with XED version: [v2025.06.08]
2025-10-07 12:07:55 +02:00
InstLatx64
172c4b2342 Missing AVX-VNNI_INT{,8,16} instructions
-- AVX-VNNI_INT{,8,16} instructions: VPDP{B,W}{SS,SU,US,UU}{D,DS}
- AVX-VNNI_INT{,8,16}  test files
Checked with XED version: [v2025.06.08]
2025-10-07 09:52:13 +02:00
Yongjie Sheng
8d4710d014 ffmpegtest: fix variable rev change in a subshell does not impact parent
Error status would get lost.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 13:58:27 -07:00
InstLatx64
70ed10d2e2 AVX512BF16 fix
AVX512BF16 fix:
-- VCVTNEPS2BF16 operand count
-- VDPBF16PS operand size
AVX512BF16 test files
Checked with XED version: [v2025.06.08]
2025-10-06 19:17:51 +02:00
InstLatx64
62f5f6990f AMX-COMPLEX support
-- TCMMIMFP16PS, TCMMRLFP16PS instructions
-- AMX.asm fix: Similar to GATHER instructions, 3-operand AMX instructions cannot have the same operand more than once
Checked with XED version: [v2025.06.08]
2025-10-06 19:17:43 +02:00
H. Peter Anvin
d9958f428a test/exitrep: test for proper %if and %rep evaluation suppression
If a line is suppressed, the %if or %rep condition must never be
evaluated. Test for it, and add the exitrep test to travis.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-06 09:38:55 -07:00
H. Peter Anvin
aa1306c308 ffmpegtest: save the results in a file
Save the result output to a file.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-30 15:19:56 -07:00
H. Peter Anvin
981740c7a1 ffmpegtest: don't redo the whole compile every time
Don't redo the whole clone and compile if one wants to re-run the
test. Only rebuild the NASM files.

Minor script cleanups.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-30 14:30:04 -07:00
Yongjie2017
9f4e8b95c4
Merge branch 'netwide-assembler:master' into master 2025-09-30 08:50:02 +08:00
H. Peter Anvin
12f6270124 asm: better error messages for missing instructions
The assembler can't know if something is a colonless label or a
misspelled instruction, so print both when complaining about a missing
instruction.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-29 16:09:04 -07:00
H. Peter Anvin
fec865e75e macros: add a %use vtern macro package for ternary logic
A very simple %use package to support the ternary logic
instructions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-29 15:51:23 -07:00
Yongjie Sheng
1838e46786 add ffmpeg test 2025-09-28 21:47:44 +08:00
H. Peter Anvin
73e666a87e test: check in the actual source file for the pshuf test
Use the source, Luke...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-23 15:57:56 -07:00
H. Peter Anvin
af40cc63d2 isnsn.dat: remove unnecessary SM from PSHUF* instructions
The MMX and early SSE PSHUF* instructions were annotated SM0-1, which
is unnecessary (no ambiguity) but broke the tighter SM matching the
assembler now uses.

This is almost certainly underspecified now, but the MMX and early SSE
instruction patterns need to be tidied up anyway, and this is the
least impactful change that seems to fix the problem.

This unbreaks compiling ffmpeg.

Reported-by: Yongjie Sheng (Intel) <sheng.yongjie@outlook.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-23 15:45:42 -07:00
H. Peter Anvin
4b0a1a4539 test: simple tests for Scc syntax
Test more Scc syntax cases.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-23 11:57:58 -07:00
H. Peter Anvin
c714d66d34 Fixes for JMP|CALL near, RETF, and segment instructions
Some weird things happened when macroizing.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-19 18:55:54 -07:00
H. Peter Anvin
b390ce4bb8 insns.dat: fix far jmp/call patterns
Far jmp and call are special in many ways... not the least because of
the old legacy syntax of putting the size on the segment instead of
the offset.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-19 16:06:25 -07:00