Commit graph

97 commits

Author SHA1 Message Date
H. Peter Anvin
adf4f5cd5e x86/insns.dat: add missing semicolon in comment
Comment was missing a semicolon; fix to avoid unnecessary warning and
to make sure the documentation is generated correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:37:09 -08:00
Tomasz Kantecki
b0ab00b6a7 x86: SM4-NI VEX support
Add VEX-encoded SM4-NI instructions.

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:24:38 -08:00
Tomasz Kantecki
5cab6596bc x86/insns.dat: SM3-NI VEX support
Add VEX-encoded SM3-NI instructions.

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:23:30 -08:00
Tomasz Kantecki
5f684412c7 x86/insns.dat: SHA512-NI VEX support
Add support for VEX-encoded SHA512-NI instructions.

Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:21:21 -08:00
H. Peter Anvin
24275695ff x86/insns.dat: PTWRITE requires the F3 prefix
PTWRITE takes an f3 prefix, not np.

Reported-by: Markus T. Metzger <markus.t.metzger@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 16:15:56 -08:00
H. Peter Anvin
b4300ac280 x86: SMAP instructions are NP
The SMAP instructions are np; notably the prefixed versions of CLAC
are ERETU/ERETS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-12-14 17:57:27 -08:00
H. Peter Anvin
dd52f386b9 x86: implement FRED: ERETS, ERETU, LKGS
Kind of embarrassing... I had not implemented the FRED instruction,
despite personally being one of the architects of FRED ;)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-12-14 17:04:49 -08:00
H. Peter Anvin
e993b75aa6 XCHG: adjust lock prefix warning, add specific warning for LOCK XCHG
"LOCK XCHG reg,mem" would issue a warning for being unlockable, which
is incorrect. In this case the RM encoding is simply an alias for the
MR encoding. Add a "LOCK1" bit to deal with that.

However, XCHG is *always* locked, so create a new warning to
explicitly flag a user-specified LOCK XCHG; default off.

Consider optimizing that prefix away in the future, but for now, let's
stick to the user-requested code sequence.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-12 14:53:40 -07:00
H. Peter Anvin
9f31c84405 insns: handle late-introduced VEX encoded instructions
For VEX instructions created *after* the corresponding EVEX
instructions, we need the user to either explicitly declare them {vex}
or specifying "cpu latevex".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-06 13:38:33 -08:00
H. Peter Anvin
5a25ad12b2 insns: fix instruction flags for the ENQCMD instructions
Set a more complete set of flags for the ENQCMD family instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-14 17:53:06 -08:00
H. Peter Anvin
7c784b0ddb insns: add HRESET instruction
Add the HRESET instruction

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-14 17:45:29 -08:00
H. Peter Anvin
4369faf827 insns: add vector instructions from ISE 046, Sept 2022
Add vector instructions from the Intel Instruction Set Extensions
document, version 046, September 2022.

Still need to check for missing instructions that have already passed
through the ISE into the SDM.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-14 17:28:52 -08:00
H. Peter Anvin
2b01ddf2ec x86/insns.dat: non-vector instructions from ISE 319433-046 2022-09
Additional nonvector instructions from the Intel Instruction Set
Extensions document 319433-046 September 2022.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-12 13:15:03 -08:00
H. Peter Anvin
a3fd34ab80 x86/insns.pl: sort conditional instructions alphabetically
Makes the build a bit more predictable and debuggable.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-12 12:59:23 -08:00
H. Peter Anvin
a2eabbe1d7 insns: drop special handling of conditional instructions
Instead of handling conditional instructions ad hoc, generate
individual instruction patterns as normal. This simplifies the code
and makes CMPccXADD support simpler (otherwise it would be necessary
to hack in the handling of a condition code in the middle of an
instruction.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-12 12:37:37 -08:00
H. Peter Anvin
1e50772539 Merge remote-tracking branch 'Gramner/vpexpand' 2022-11-07 16:28:12 -08:00
H. Peter Anvin
b18e870d90 Merge remote-tracking branch 'ElyesH/typos' 2022-11-07 12:39:44 -08:00
Iouri Kharon
21d8dbfabb restire: Support of AVX512-FP16 Instructions
Add support for AVX512-FP16 instructions and the associated
handling. Allow "mapN" syntax as well as "mN" syntax to match the
documentation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 12:21:23 -08:00
H. Peter Anvin
7a2b5c9221 x86/insns.dat: fix VCVTNEPS2BF16
The VCVTNEPS2BF16 instruction was incorrectly specified as
VCVTNE2S2BF16. Fortunately, the correct opcode for the latter was
specified first, so it would emit the correct result when that
instruction was specified.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392821
Reported-by: Agner <agner@agner.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-07 10:03:45 -08:00
H. Peter Anvin
bb1233ccde Add FRED instructions
Add the FRED instructions: ERETU, ERETS, LKGS

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-10-05 13:31:30 -07:00
Henrik Gramner
3578cd907f x86/insns.dat: Fix VPCOMPRESSB and VPCOMPRESSW disp8
Signed-off-by: Henrik Gramner <henrik@gramner.com>
2022-01-25 04:14:23 +01:00
Henrik Gramner
1b84b4e276 x86/insns.dat: Fix VPEXPANDB and VPEXPANDW encoding
Signed-off-by: Henrik Gramner <henrik@gramner.com>
2022-01-25 01:53:31 +01:00
Elyes HAOUAS
cdf7ad02c2 Fix some typos
while on it, remove unneeded white spaces.

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2022-01-09 17:34:35 +01:00
Cyrill Gorcunov
e2ed7b7e12 x86/insns: add VMGEXIT
The instruction supports two forms with [f2] and [f3].
I guess we might add aliases as VMGEXIT2 and VMGEXIT3.
For now simly leave a second form for ndisasm sake.

https://bugzilla.nasm.us/show_bug.cgi?id=3392755

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2021-05-13 09:14:10 +03:00
Cyrill Gorcunov
c4babdf2db x86/insns: add RMPADJUST
https://bugzilla.nasm.us/show_bug.cgi?id=3392754

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2021-05-13 01:29:32 +03:00
Cyrill Gorcunov
1430995095 x86/insns: add PVALIDATE
https://bugzilla.nasm.us/show_bug.cgi?id=3392753

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2021-05-13 01:27:07 +03:00
H. Peter Anvin
d988ce719c Fix inefficient encoding of MPX instructions
BNDMK, BNDLDX, and BNDSTX are split-SIB (MIB) instructions, but do
*not* require a SIB encoding. However, TILELOAD* and TILESTORE* *do*
require a SIB in all cases. Split the MIB flag into MIB (split
address) and SIB (SIB required) flags.

This fixes travis test mpx.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-08-13 17:21:00 -07:00
H. Peter Anvin (Intel)
bae6b070ff BR 3392705: AVX512: reinstate the SSE-like opcodes for VPCMPEQ/GT
The VPCMP instructions are controlled by an immediate byte, but there
is also a set of SSE-derived legacy opcodes for VPCMPEQ and
VPCMPGT. For the specific cases of VPCMPEQ and VPCMPGT, prefer those
opcodes since they are one byte shorter.

Reported-by: ig <glucksmann@avast.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-30 16:56:52 -07:00
H. Peter Anvin (Intel)
e56c2dc5b7 insns.pl: audit for impossible Sx patterns; fix a few
Break the instruction processing if there are impossible combinations
of Sx flags and operand sizes. If the intent is to always require
explicit sizes, use the SX flag.

The INSERTPS instruction pattern was explicitly wrong, the rest of
these are nuisance fixes.

TODO: fix the disassembler to be able to exclude patterns where these
bits don't matter.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-30 15:16:11 -07:00
H. Peter Anvin (Intel)
9d96e7a6a4 BR 3392704: unbreak MOVHPD instruction
MOVHPD takes a mem64, but was incorrectly tagged SO - an impossible
combination.

The Sx tags really are a problem and should be removed in the future
whereever possible, presumably in the master branch.

Reported-by: Lukas Hönig <lukashoenig@icloud.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-28 13:39:44 -07:00
H. Peter Anvin (Intel)
e743b89f25 BR 2292703: Add memory sizes to SSE and some other instructions
Most SSE instructions were missing memory operand sizes, resulting in
error if a memory operand was specified with explicit size.

Reported-by: <nemeth.marton@hotmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-27 13:20:38 -07:00
H. Peter Anvin (Intel)
9abbaa133d BR 2292702: fix ENQCMDS and TILELOADT1 instructions
Wrong prefixes for ENQCMDS and TILELOADT1.

Reported-by:  Iouri Kharon <bc-info@styx.cabel.net>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-27 11:44:04 -07:00
H. Peter Anvin
66a0dd460c insns.dat: fix accidentally duplicated patterns
Some patterns were accidentally duplicated during the conversion of
the X64 marker.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2020-07-17 19:29:37 -07:00
H. Peter Anvin
6c1ad43d5e insns.dat: get rid of the X64 marker (= X86_64,LONG)
The X64 marker for "X86_64,LONG" has turned out to be a problem in
that it is easy to mistake for "long mode" when adding new
instructions, which results in duplicate CPU flags. Kill it off; it
isn't like we will legitimately have new instructions with this
pattern ever again.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-17 19:25:19 -07:00
H. Peter Anvin
1d8c09b24e x86/insns.dat: add tuple type for the latest AVX512 instructions
Add missing tuple type (all are Full - fv:) for the latest AVX512
instructions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-17 17:44:27 -07:00
H. Peter Anvin
b31a4c9906 Add support for new instructions from ISE June 2020
Add support for new instructions as defined in the Instruction Set
Extensions manual as of June 2020.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2020-07-16 21:52:15 -07:00
Henrik Gramner
bca6b26a7e insns.dat: Add Intel Control-Flow Enforcement Technology (CET) instructions
Add instructions for Intel Control Flow Enforcement Technology (CET).

Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-27 16:12:37 -07:00
H. Peter Anvin (Intel)
d85a6101d7 BR 3392681: handle a64 instruction patters correctly
The a64 instruction patterns would incorrectly force REX to zero at a
point where REX prefixes have already been assigned. This is not only
incorrect in case of instructions which can use high registers, but it
causes an assertion failure. It happened to work for J*CXZ and LOOP*.

Reported-by: Philip Lantz <philip.lantz@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-22 13:52:02 -07:00
H. Peter Anvin (Intel)
221ff044ba avx512: remove bogus imm8 for specific VCMP and VPCMP operations
When using VCMP and VPCMP operations with the condition in the opcode,
we should not have an immediate operand!

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:07:17 -07:00
H. Peter Anvin (Intel)
801f0c7815 avx512: implement shorthand forms of VCMP and VPCMP opcodes
The VCMP and VPCMP pseudo-op forms where the destination is a mask
were simply broken. Fix them.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:01:52 -07:00
H. Peter Anvin (Intel)
152cbd37e2 BR 3392676: fix cmpxchg8b/16b with explicit size
CMPXCHG8b/16b should be legitimate with an explicit operand size.

Reported-by: Xusheng Li <xushengli@protonmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 20:22:34 -07:00
H. Peter Anvin
7002bb76a3 BR 3392674: fix handling of {ud1,ud2b} <reg>,<reg>
We need the instruction table to contain the correct information for
both the reg and the rm field in the various modes.

Reported-by: <fasdfqwer@mail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-01 16:03:54 -07:00
Henrik Gramner
284ad955a4 insns.dat: Fix the opcodes for the AVX512-VBMI2 instructions
The two VPSH{R|L}DV* instructions had the wrong opcode.

Reported-by: Henrik Gramner <herik@gramner.com>
Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392607
Signed-off-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
2020-04-22 00:10:08 +00:00
H. Peter Anvin (Intel)
02b60ddd1c LEA: allow immediate syntax; ignore operand size entirely
The memory operand size of LEA doesn't matter in any way as it isn't
"real memory". Add an ANYSIZE option to ignore sizes entirely.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-14 15:23:00 -07:00
H. Peter Anvin (Intel)
5b39461178 obsolete handing: handle a few more subcases in a useful way
Distinguish instructions which have once been valid (OBSOLETE) from
those that never saw the light of day (NEVER). Futhermore, flag
instructions which devolve to an architectural noop from those with
undefined behavior and possibly recycled opcodes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 14:52:16 -07:00
H. Peter Anvin (Intel)
177a05d0ce perl files: clean up warnings
Clean up some perl warnings, some of which were legitimate (apparently
undef doesn't actually take a list of arguments, a common enough
mistake that it is mentioned in the man page!, and a list of variables
after "my" can be cantankerous), and some of which were nuisance but
were easy enough to clean up.

Maybe this can resolve the problems with very old version of Perl?

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 13:30:19 -07:00
H. Peter Anvin (Intel)
b1e15f42fe Add implicitly sized versions of the K instructions
This allows the K instructions to be specified without a size suffix
as long as the operands are sized; this matches the way most other x86
instructions work. As this is not the syntax specified in the SDM,
don't use it for disassembly.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 02:44:46 -07:00
H. Peter Anvin (Intel)
602e67f932 insns.pl: use less cantankerous string expansion; better error info
The flags massaging in insns.pl could end up with things like double
commas in some pathological cases, which would make insns_flag_index()
very unhappy due to the appearance of an empty argument. Fix this by
processing the flags as a list already in insns.pl.

Be more explicit and consistent in error messages.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 02:41:37 -07:00
H. Peter Anvin
21b0aa4c29 x86/insns-iflags.ph: add comments in iflag.c
Add comments to iflag.c so a human user can have any hope of
figuring out what a particular bitmask actually means.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2019-08-07 01:11:21 -07:00
H. Peter Anvin (Intel)
67289aefb5 iflags.ph: add file missing from commit 418138c8f2
Add file missing from commit 418138c8f2:
iflags: move definitions to a separate file; auto-generate more

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-07 00:56:39 -07:00