0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00
Commit Graph

5363 Commits

Author SHA1 Message Date
Maciej Wieczor-Retman
55e25b12fe insns: travis: apx: NEG and NOT legacy fix and APX variant
Add test cases and the database entry for the NEG and NOT instructions.

Fix the 0xF7 variants not generating due to a missing hash sign after f6.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 14:23:22 +02:00
Maciej Wieczor-Retman
4d0d859dd0 insns: travis: apx: MULX instruction
Add the APX database entry and test cases.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 14:17:32 +02:00
Maciej Wieczor-Retman
a3acacc3ad insns: travis: apx: MUL instruction
Add test cases.

Modify what I assume is a typo in the MUL clone of IMUL 0x6B. It should
only use 8bit IMM operand but the preprocessor has i# specified which
would allow other sizes too.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 14:17:32 +02:00
Maciej Wieczor-Retman
ed290acf80 insns: travis: apx: APX MOVRS instruction
Add the APX database entry for MOVRS and relevant test cases.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 14:17:32 +02:00
Yongjie2017
361a1fe4a7 Fix a typo of VGETMANTPH opcode from 25 to 26 per SDM 325462-088 2025-09-10 20:36:00 +08:00
Yongjie2017
967602c195 Fix for VFMSUB132PH instruction family on opcode based on SDM 325462-088 2025-09-10 20:34:06 +08:00
Yongjie2017
396c077d78 Fix for VFMADD132PH instruction family on opcode based on SDM 325462-088 2025-09-10 20:25:17 +08:00
Yongjie2017
d0d802c8f7 Fix a typo of BTR opcode from ab to ba per SDM 325462-088 2025-09-09 22:07:21 +08:00
Yongjie2017
5db0fbe4bd Fix a typo of KSHIFTR opcode base from 32 to 30 per SDM 325462-088 2025-09-09 21:59:15 +08:00
H. Peter Anvin
746fe8384d doc: even more tidying up of text and index
Purely editorial cleanups.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 23:59:10 -07:00
H. Peter Anvin
90e37ce7f1 doc: more index tweaks and removal of really really old information
Tidy up the index some more, and remove some very, very out of date
information.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 23:36:10 -07:00
H. Peter Anvin
d79fb158e1 outobj: make sure segment alignment warnings are kept
Warnings are flushed at the end of each pass, but the segment
directive in outobj is only processed once. Therefore, keep track of
the originally requested alignment size so the warning can be
re-issued on later passes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 22:10:18 -07:00
H. Peter Anvin
afaa3b5b09 NASM 3.00rc3 nasm-3.00rc3 2025-09-05 20:15:48 -07:00
H. Peter Anvin
fef549da11 zlib: yet one more portability hack
... this time for Win64 ...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 20:08:18 -07:00
H. Peter Anvin
76df52818a zlib: hack for portability...
zlib/zconf.h is ... "special".

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 19:59:12 -07:00
H. Peter Anvin
e52aa40daa Include "compiler.h" in zconf.h
This seems to actually work with Z_SOLO? Still might have to resolve
problems, but...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 19:34:34 -07:00
H. Peter Anvin
f129d7ea5b zlib: disable Z_SOLO, enable Z_LARGE64
Without Z_LARGE64, compilation breaks on some platforms. Unfortunately
it seems that Z_SOLO disables Z_LARGE64...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 19:05:35 -07:00
H. Peter Anvin
a3291bd8fb preproc: return NULL, not false
In at least one place, returned false instead of NULL, which caused
build failures on some platforms.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 19:04:34 -07:00
H. Peter Anvin
68ea20e5f9 NASM 3.00rc2 nasm-3.00rc2 2025-09-05 18:38:12 -07:00
H. Peter Anvin
276cbf9682 autoconf/Makefile.in: add include for local zlib
When using the internal zlib, need to make sure to add the appropriate
-I option for the header...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 18:36:28 -07:00
H. Peter Anvin
6fc4a7e668 NASM 3.0rc1 nasm-3.0rc1 2025-09-05 18:08:52 -07:00
H. Peter Anvin
7e4e937f97 Merge remote-tracking branch 'origin/master' 2025-09-05 18:03:44 -07:00
H. Peter Anvin
fb54b25f66 insns.dat: fix MOVRS pattern
MOVRS is a pretty basic instruction; it uses the normal operand size
handling.

Fix apx.bin.t accordingly.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 18:02:52 -07:00
H. Peter Anvin
419f369b42 doc: a few more index tweaks
Very minor cleanpus to the index.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:53:48 -07:00
H. Peter Anvin
7cc5291ece doc: tweaks to the index
Make the index at least a little bit more legible.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:51:38 -07:00
H. Peter Anvin
1d63ae2a3b doc: update the documentation, and auto-generate some indexes
There are currently six variations of each conditionals, and there may
be more in the future (e.g. %while). Stop trying to enumerate them all
everywhere.

Add support for index copying in the document processor.

Have pptok.pl auto-generate index metadata for conditional
preprocessor directives.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:12:06 -07:00
H. Peter Anvin
4cf4333ba2 standard.mac: define __?NASM_HAS_IFDIRECTIVE?__
Define a __?NASM_HAS_IFDIRECTIVE?__ to know when it is safe to use
%ifdirective and other dynamic probing features.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:12:06 -07:00
Maciej Wieczor-Retman
30eb8e2e2a insns: travis: apx: MOVRS instruction
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 23:25:42 +02:00
Maciej Wieczor-Retman
beaeb77bce insns: travis: apx: MOVDIR instructions
Add MOVDIR64B and MOVDIRI to the database. Add relevant testcases

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 23:25:20 +02:00
H. Peter Anvin
f39677d527 test: add -DSRC as a standard option; bin32 and bin64 targets
Make it a little easier to run bench tests which include multiple bit
sizes, and add the SRC define to make SRC/BIN tests easier to run on
the bench.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 12:56:46 -07:00
H. Peter Anvin
ac93d75da3 Sanitize the handling of messsages; improve info and debug
Make the handling of messages saner. In particular, regularize the
handling of info and debug messages, so that nasm_info() and
nasm_debug() actually become useful.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 12:53:20 -07:00
Maciej Wieczor-Retman
05a07b7ccf insns: travis: apx: MOVBE instruction
Add the database entry and test cases.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 21:44:57 +02:00
Maciej Wieczor-Retman
712095fffe insns: travis: apx: LZCNT instruction
Doesn't yet work with EGPRs.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 17:23:29 +02:00
Maciej Wieczor-Retman
ca85c1c3b5 insns: travis: apx: LDTILECFG instruction
Add database entry and test cases.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 16:02:58 +02:00
Maciej Wieczor-Retman
3b3a115754 travis: apx: Finish the KMOV test cases
Add remaining APX versions of the KMOV tests (kmovw - kmovq)

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 15:19:36 +02:00
Maciej Wieczor-Retman
1054b5aefc x86: Fix handling of the ko# specifier
KMOV opcodes of 0x90 and 0x91 have similar bits set in all size
implementations. .66 and .W1 for 32bit, and .NP and .W1 for 64 bits.

Correct my previous mistake where I swapped the VEX/EVEX.pp values by
accident.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 15:17:05 +02:00
H. Peter Anvin
dfe7d54901 insns.dat: fix ADCX/ADOX patterns for proper disassembly
The 66 prefix on these instructions are an opcode extension prefix,
not an operand prefix, so use w# to set the size rather than o#.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 03:37:24 -07:00
H. Peter Anvin
a92616af5c disasm: fix the masking of the V4/X4 bit
This bit needs to be masked *except* when:
- There is no V operand
- The modr/m has mod == 3 OR there is an scc

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 03:32:28 -07:00
H. Peter Anvin
3ff46c587a assemble: trivially optimize emissions of REX+map prefixes
Emit rex+map prefixes as a single chunk of data.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 03:04:51 -07:00
H. Peter Anvin
29bc7c4811 ndisasm: REX2 *can* take REP or OSZ prefixes
Only VEX and EVEX may not take REP or OSZ prefixes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 02:56:27 -07:00
H. Peter Anvin
52c5ee24cf ndisasm: fix legacy map handling, 8-bit GPRs
Fix the handling of legacy map prefixes (0F, 0F 38, 0F 3A).

Fix 8-bit GPRs decoding (REX vs no-REX versions.)

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 02:41:59 -07:00
Maciej Wieczor-Retman
fca408f86a travis: apx: Remove a TODO comment
The problems got fixed at 3.0rc0.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 11:10:38 +02:00
H. Peter Anvin
3a5cbc7a09 ndisasm: don't generate REX2 patterns for NOAPX instructions
The wrong flags field was examined for the NOAPX or NOREX flags.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 02:07:35 -07:00
Maciej Wieczor-Retman
e30047b2ff x86: travis: apx: Fix IMUL 0x6B not being able to use EVEX.ZU
64bit and 32bit variant of the IMUL 0x6B instruction can't make use of
the zero-upper bit. It gets assembled normally. With equal operand size
this makes sense since 64 and 32 bit legacy behavior was the same as the
APX ZU one. But the 0x6B IMUL variant uses 8 bit immediate values as the
second operand, hence it should be able to make use of ZU for 32 and 64
bit registers too.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-05 11:05:57 +02:00
H. Peter Anvin
62cc95297c insns.dat: fix encoding for JMPABS
JMPABS does not need .w1 and in fact is documented to NOT have or
require it.

Add jump-over emulation for the !APX case, similar to the jump-over
for long conditional branches in < 386.

Move JMP ABS patterns ahead of regular jumps; otherwise JMP ABS syntax
doesn't work.

Prefer JMPABS in the disassembler, since that is the documented form.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 02:00:39 -07:00
H. Peter Anvin
0da8e15640 insns.dat: fix JMPABS encoding
JMPABS is defined as REX2 + A1; there are no extra encoding bits.
MOVABS is only supported without REX2; since there are no register
numbers used for that instruction that is good enough.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 01:51:34 -07:00
H. Peter Anvin
78c98dac0f version: bump version number to 3.0rc0
It seems to make sense to call this upcoming release NASM 3.0.

Suggested by: Yongjie Sheng <sheng.yongjie@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 01:12:27 -07:00
H. Peter Anvin
5158467d55 Add missing header file asm/asmutil.h
This file was missing from a previous checkin.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 01:08:25 -07:00
H. Peter Anvin
33262b072a Merge remote-tracking branch 'yongjie/apx.wip' into apx.wip 2025-09-05 01:02:52 -07:00
H. Peter Anvin
9a55314a23 travis: update tests for new or fixed errors/warnings
Some new warnings, some duplicate warnings removed.

The selfref test was broken because of mishandling of $ escaped
symbols; the new set of error messages are far more correct.

With all of this, travis now passes again.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 00:59:23 -07:00