Commit Graph

274 Commits

Author SHA1 Message Date
H. Peter Anvin
114ba75f7b test/Makefile: add a rule for nasm itself
If NASM needs to be rebuilt, build it in the proper directory.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-02-18 13:06:04 -08:00
H. Peter Anvin
89f78f5010 Merge branch 'nasm-2.11.xx'
Resolved Conflicts:
	assemble.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-05-21 08:30:40 -07:00
H. Peter Anvin
0a9250c2ab BR 3392279: Fix duplicated REX prefixes
The fix for BR 3392278:

aa29b1d93f assemble.c: Don't drop rex prefix from instruction itself

... would cause multiple REX prefixes to be emitted for some
instructions.  Create a new flag to indicate that REX has already been
emitted, which can be cleared for each instance of an instruction.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-05-21 08:24:21 -07:00
H. Peter Anvin
49de44e56d Merge remote-tracking branch 'origin/signrel' 2014-05-09 15:09:43 -07:00
H. Peter Anvin
1eef781594 BR 3392275: Don't require xmm0 to be specified when implicit
BR 3392275 complains about xmm0 having to be explicitly included in
the assembly syntax when it is implicit in the encoding.  In the
interest of "be liberal in what you accept", accept either form in the
input.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-16 10:25:25 -08:00
Jin Kyu Song
b0c729baeb mpx: Clean up instruction data
Cleaned up unneccessary size specifiers in the instruction data.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-12-18 22:37:36 -08:00
H. Peter Anvin
621a69ac5c Add {vex3} and {vex2} prefixes by analogy with {evex}
Allow specifying {vex3} or {vex2} (the latter is currently always
redundant, unless we end up with instructions at some point can be
specified with legacy prefixes or VEX) to select a specific encoding
of VEX-encoded instructions.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-11-28 12:21:11 -08:00
Jin Kyu Song
376701ef9a testcase: Remove escape characters - '\'
Since the multi-line macro preprocessor is modified to expand
grouped parameter with braces. The escape character is not needed
any more.
The testcase converter script is also modified not to generate '\'.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 21:01:01 -08:00
H. Peter Anvin
72bf3fe98c assemble: Only treat a displacement as signed if it is < asize
Only generate a signed relocation if the displacement size is less
than the address size.  This matters when involving address size
overrides.

It is technically impossible to do this one perfectly, because it is
never really knowable if the displacement offset is used as a base or
an index.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-26 20:19:53 -08:00
H. Peter Anvin
186b533425 test: Add a test for various 32- and 64-bit relocations
Test signedness in a couple of different contexts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-11-26 18:24:22 -08:00
Jin Kyu Song
305f3cee04 bnd: Drop bnd prefix for relaxed short jmp instructions
Reverted the redundant branch instruction patterns for bnd prefix.
And when a relaxed jmp instruction becomes a short (Jb) form,
bnd prefix is not needed because it does not initialize bnd registers.
So in that case, bnd prefix is silently dropped.

BND JMP foo       -> drops bnd prefix
BND JMP short foo -> shows an explicit error

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-22 11:59:14 -08:00
Jin Kyu Song
3b65323d80 MPX: Adapt GAS's mib syntax with an index reg only
GAS uses *1 multiplier for explicitly marking an index register in mib operand.
e.g.) [rdx * 1 + 3] is equivalent to [3, rdx] in NASM's split EA format
So only for mib operands, this is encoded same as gas does.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
Jin Kyu Song
c7fcf6d516 SHA: SHA test cases
32bit and 64bit test asm files.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
Jin Kyu Song
40762afbe8 MPX: Add test cases for MPX
MPX test asm files are added. These include all three different styles of
mib syntax (NASM, ICC and gas).

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:42 -08:00
H. Peter Anvin
9148fb5951 parser: support split base,index effective address
Mostly intended for the "mib" expressions in BNDLDX/BNDSTX.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:41 -08:00
Jin Kyu Song
9f6188f05e AVX-512: Add perfomtest-compliant headers to test cases
test/avx512*.asm files are now tested by using perfomtest.pl
Refer to pefomtest help message for the usage.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-20 11:29:41 -08:00
Jin Kyu Song
eb595942b2 AVX-512: Added AVX-512PF instructions
Added Prefetch (AVX-512PF) instructions.
These instructions are supported
if CPUID.(EAX=07H, ECX=0):EBX.AVX512PF[bit 26] = 1.
CPUID feature flag for PREFETCHWT1 is TBD
but PREFETCHWT1 is included in this commit.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-14 01:27:10 +04:00
Jin Kyu Song
dd1c0c13c8 AVX-512: Add AVX-512ER instructions
Added Exponential and Reciprocal (AVX-512ER) instructions.
These instructions are supported
if CPUID.(EAX=07H, ECX=0):EBX.AVX512ER[bit 27] = 1.
IF_AVX512 is now shared by all AVX-512* instructions as a bit mask.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-14 01:27:06 +04:00
Jin Kyu Song
d4b2b5f17c AVX-512: Add AVX-512CD instructions
Added Conflict Detection (AVX-512CD) instructions.
These instructions are supported
if CPUID.(EAX=07H, ECX=0):EBX.AVX512CD[bit 28] = 1.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-14 01:27:02 +04:00
Jin Kyu Song
c257bb6ae0 AVX-512: Add Pseudo-ops for CMP instructions
Added three-operand pseudo-ops for VCMPPD, VPCMPD and so on.
Test case is also updated to validate them.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-09-07 11:50:39 +04:00
Jin Kyu Song
088827bc6c AVX-512: Add test case for opmask instructions
Added K* instructions test cases in test/avx512f.asm.
The previous test case from GNU AS were repeating the same instruction twice,
so the repeated half part is removed.
Changed the python script (gas2nasm.py) to include opmask instructions.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-29 10:03:36 +04:00
Jin Kyu Song
6d16d2836d AVX-512: Fix comments
Fixed or purged some old comments and added a comment for a previous patch.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-29 10:03:09 +04:00
Jin Kyu Song
fe0ee08586 AVX-512: Add a feature to generate a raw bytecode file
From gas testsuite file, a text file containing raw bytecodes
is useful when verifying the output of NASM.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-28 14:27:25 +04:00
Jin Kyu Song
f9442f67d5 AVX-512: Add a test case for EVEX encoded instructions
This was converted from a gas testsuite.
(gas/testsuite/gas/i386/x86-64-avx512f-intel.d)
A python script that is used for converting is also included.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-28 14:27:17 +04:00
Cyrill Gorcunov
340ac1a915 test: Add br978756
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-07-21 14:45:48 +04:00
Cyrill Gorcunov
31d73aefb3 test: Add br3392259
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-07-21 14:45:48 +04:00
H. Peter Anvin
e20ca02cfb BR 3392260: Handle instructions only separated by vector SIB size
There are two instructions (VGATHERQPS, VPGATHERQD) where the only
separation between two forms is the vector length given to the vector
SIB.  This means the *matcher* has to be able to distinguish
instructions by vector SIB length and the matcher only operates on the
operands and the instruction flags, not on the bytecode.

Export the vector index-ness into the operand flags and add to the
matcher.

This resolves BR 3392260.

Reported-by: Agner <agner@anger.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-07-19 17:09:39 -07:00
Cyrill Gorcunov
29e2f74a58 test: Add br3392252 test
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-05-13 02:21:08 +04:00
H. Peter Anvin
56bff2df92 hle: opcode A2 forbidden with HLE prefixes
The moffset opcodes A2 and A3 do not support HLE.  Unfortunately
checkin

fb3f4e6d HLE: Change NOHLE to be an instruction flag

... inadvertently lost the NOHLE flag for opcode A2.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-07-22 21:04:20 -07:00
H. Peter Anvin
b55a1436e4 test: ilog2() test
Test for the ilog2 function/macros.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-05-31 10:28:00 -07:00
Cyrill Gorcunov
eaebcb4258 test: Add br3385573 testcase
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2012-03-06 11:18:02 +04:00
H. Peter Anvin
b106ba161f Try again to fix our handling of MOVD/MOVQ
Try to implement the handling of MOVD as attempted in checkin:

    70712c0df6

and reverted in:

    d279fbbd80

due to BR3392199.  This time make sure to use the SX flag to only
match when a size is explicitly given, and also don't duplicate the 0F
6F/7F opcodes, which are documented as MOVQ by AMD as well as Intel.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-03-05 22:37:21 -08:00
H. Peter Anvin
fb3f4e6ddb HLE: Change NOHLE to be an instruction flag
The way our matching system works we have to make NOHLE an instruction
flag rather than an byte code; by the time we run the byte code
interpreter we have already picked an instruction pattern once and for
all.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-25 22:22:07 -08:00
H. Peter Anvin
9fa2e72997 Add support for UTF-16BE and UTF-32BE
Add support for bigendian UTF-16 and UTF-32, and (for symmetry) add
explicitly littleendian operators.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-25 15:29:37 -08:00
H. Peter Anvin
c3bfc7f643 Clean up JMP/CALL patterns, especially for 64 bits
Clean up JMP/CALL patterns so they don't disassemble quite so uglily.
Fix a CALL pattern which would have incorrectly generated a (harmless)
REX.W prefix.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2012-02-25 12:13:50 -08:00
Cyrill Gorcunov
2c3f7573b8 Add AVX2 test file
nasm64developer kindly provided a testfile converted
to nasm format.

http://sourceware.org/ml/binutils/2011-06/msg00150.html

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-08-31 01:22:43 +04:00
Cyrill Gorcunov
767a4e8313 test: Add movd.asm
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-06-26 01:53:38 +04:00
H. Peter Anvin
95adeabff5 Implement the VGATHERP instruction
As an initial test of the VSIB handling, implement the VGATHERP
instruction.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2011-06-22 18:20:28 -07:00
Cyrill Gorcunov
a09fe1ebfb Merge branch 'nasm-2.09.xx'
Conflicts:
	doc/changes.src
	version

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-03-12 22:35:42 +03:00
Cyrill Gorcunov
ffa4c37eaf test: Add br3189064
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-03-07 12:42:46 +03:00
Cyrill Gorcunov
f66e71b2cc test: Add br3200749
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-03-07 11:29:56 +03:00
Cyrill Gorcunov
8c918b30b9 Merge branch 'nasm-2.09.xx' 2011-02-21 18:19:26 +03:00
Cyrill Gorcunov
2e6f7c342d test: Add test for BR 3187743
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-21 18:19:04 +03:00
Cyrill Gorcunov
8a0eb96c11 Merge branch 'nasm-2.09.xx'
Conflicts:
	insns.dat

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-14 22:21:50 +03:00
Cyrill Gorcunov
2059aa9806 test: Add test for BR3174983
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-02-14 22:14:51 +03:00
Victor van den Elzen
6dfbddb6b0 Move implicit operand size override logic to calc_size
It is more logical, it cleans up the code and it makes implicit
operand size override prefixes come out in the same order as explicit
ones instead of after all other prefixes.

Suggested-by: H. Peter Anvin <hpa@zytor.com>
2010-12-29 18:13:38 +01:00
Victor van den Elzen
41f1f2badc BR3058845: mostly fix bogus warning with implicit operand size override
The implicit operand size override code didn't set the operand size
prefix, which confused the size calculation code for the range check.

The BITS 64 operand size calculation is still off, but "fixing" it by
making it 32-bit unless REX.W is set breaks PUSH and maybe others.
2010-11-21 19:40:49 +03:00
H. Peter Anvin
bcf9f2a08b Merge branch 'nasm-2.09.xx' 2010-11-16 09:40:03 -08:00
H. Peter Anvin
3cb0e8c052 BR 3109604: Fix C4 vs C5 VEX form selection in calcsize()
calcsize() had the wrong criterion for when C5 prefixes are permitted
(REX.R is permitted, REX.X is forbidden.)  assemble() had the right
test already.  This caused symbol value errors.
2010-11-16 09:39:32 -08:00
Victor van den Elzen
b3cee5a57a BR3058845: mostly fix bogus warning with implicit operand size override
The implicit operand size override code didn't set the operand size
prefix, which confused the size calculation code for the range check.

The BITS 64 operand size calculation is still off, but "fixing" it by
making it 32-bit unless REX.W is set breaks PUSH and maybe others.
2010-11-07 23:27:48 +01:00