0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00
Commit Graph

221 Commits

Author SHA1 Message Date
H. Peter Anvin
04c21dc0c5 Allow synthesis of ROLX
If the shift amount is known, there is really no reason why we can't
accept "ROLX" as an alias for "RORX" with a modified shift operand.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-13 21:25:02 -07:00
H. Peter Anvin
01cef66b23 insns.dat/preinsns.pl: fix the RORX, SHLX, SHRX, SARX patterns
These are subtle: RORX is only available in immediate shift count
form, whereas SHLX, SHRX and SARX are only available in register shift
count form...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-13 20:44:53 -07:00
H. Peter Anvin
9aa48acb3e Merge remote-tracking branch 'yongjie/master' 2025-09-13 20:10:04 -07:00
Yongjie Sheng
87e28e26bd add the remaining missing avx10.1 instructions 2025-09-14 07:15:12 +08:00
Yongjie Sheng
ef4128783f tune VCMPPH instruction and its travis test 2025-09-13 20:28:42 +08:00
Yongjie Sheng
7e304ade60 tune VADDPH instruction and its travis test 2025-09-13 14:23:20 +08:00
Yongjie Sheng
e7a3279828 add avx10_2 instruction VPDPWxxxx family and AVX10_VNNIINT flag 2025-09-13 09:05:56 +08:00
Maciej Wieczor-Retman
3b529c8c62 insns: travis: apx: Add TZCNT instruction
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-12 20:29:36 +02:00
Maciej Wieczor-Retman
f6ad2553ca insns: travis: apx: Add TILELOADD[RS][T1] and TILESTORED instructions
Add database entries and test cases for TILELOADD, TILELOADDT1,
TILELOADDRS, TILELOADDRST1 and TILESTORED.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-12 20:15:50 +02:00
Maciej Wieczor-Retman
2497087697 insns: travis: apx: STTILECFG instruction
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-12 19:30:39 +02:00
Maciej Wieczor-Retman
e2d528a938 insns: travis: apx: SHLD and SHRD instructions
Add database entries and test cases for SHLD and SHRD instructions.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-12 15:48:27 +02:00
Maciej Wieczor-Retman
0f74758bba insns: travis: apx: Shift instructions without affecting flags
Add database entries for SHLX, SARX and SHRX (APX and non-APX). Add
tests to the newly added instructions.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-12 13:29:06 +02:00
Maciej Wieczor-Retman
bfb26ab467 insns: travis: apx: Implement RORX instruction
Add the RORX instruction to the database - both non-APX and APX
variants.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 19:52:54 +02:00
Maciej Wieczor-Retman
fe1c9c380a insns: travis: apx: RDMSR instruction
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 19:52:19 +02:00
Maciej Wieczor-Retman
2ccd3a93c6 insns: travis: apx: POPCNT instruction
The EGPRs APX case if broken, the non-APX version is used for some
reason.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 17:19:31 +02:00
Maciej Wieczor-Retman
7821dd5540 insns: travis: apx: PDEP and PEXT instruction
Add test cases and the database entry for PDEP.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-11 15:56:13 +02:00
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
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
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
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
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
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
33262b072a Merge remote-tracking branch 'yongjie/apx.wip' into apx.wip 2025-09-05 01:02:52 -07:00
H. Peter Anvin
a2b1c752a4 insns.dat: add non-optimizing patterns for CRC32 byte
The CRC32 byte patterns are documented to be able to take a
(pointless) REX.W to "extend" the pattern to a 64-bit
destination... but that never changes the result.

However, be excrutiatingly correct and add those patterns when not
using optimization.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 00:41:18 -07:00
H. Peter Anvin
08969b4d38 insns.dat: fix the crc32 instructions
The crc32 instructions are kind of odd; the operand size really only
applies to the right (source) operand.

The APX forms are also kind of messy.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 00:19:14 -07:00
H. Peter Anvin
cb20ce6f01 apx: handle RN_L16 on EAs, automatically generate EVEX forms
Memory references should have RN_L16 set if and only if they are
compatible with instruction patterns requiring register numbers below
16.

Add a "vex+" encoding pattern for VEX-encoded instructions that should
be promoted to EVEX when AVX-encoded.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-04 23:49:10 -07:00
H. Peter Anvin
e9d357ba19 Merge remote-tracking branch 'maciej/apx.wip.travis' into apx.wip 2025-09-04 20:12:16 -07:00
H. Peter Anvin
31a160759d Add %ifdirective preprocessor directive
Along with C and other languages, the current trend is to be able to
probe for features rather than relying on version numbers. This is
motivated in part by the intent of bumping the major version number to
3.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-04 19:41:12 -07:00
Maciej Wieczor-Retman
5d1deaffc3 WIP apx: KMOV instructions
Add KMOV APX variants to the database. Add relevant tests.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-04 23:35:14 +02:00
Maciej Wieczor-Retman
312b89d71f x86: Fix wrong encondig of 32 bit KMOV variants
VEX.pp should be 0 for 32 bit variant of KMOV.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-04 23:35:14 +02:00
Maciej Wieczor-Retman
3387f868fd insns: travis: apx: INV instruction
Add INVPCI, INVEPT, INVVPID APX instruction variants to the database and
relevant tests.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-04 23:29:21 +02:00
Maciej Wieczor-Retman
cb453cba39 insns: travis: apx: INC instruction
Add INC test cases and the database entry.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-04 13:33:06 +02:00
Maciej Wieczor-Retman
6b137d5212 insns: travis: apx: IMUL instruction test cases and bug fix
Add the test cases for the IMUL instruction.

Fix the 0x6B database bug that used the same bit width of the immediate
operand as the other operands. Make it 8 bit wide, just like in the
legacy instruction.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
2025-09-04 13:13:12 +02:00
Yongjie2017
6f3147b4ec add avx 10.2 instructions 2025-09-04 16:33:43 +08:00