Commit graph

595 commits

Author SHA1 Message Date
H. Peter Anvin
cfbe7c3cc2 Fix handling of DO; support unary + for floating-point numbers
Floating-point users generally expect to be able to use a unary plus.
Fix support for the DO instruction in several places.
2007-09-18 17:49:09 -07:00
H. Peter Anvin
141d7cf68d Support 16-bit IEEE floating point; used in SSE5
SSE5 supports standard IEEE 16-bit floating point, so we should
support that too.
2007-09-18 16:39:03 -07:00
H. Peter Anvin
510a2508e6 Merge commit 'origin/master' into sse5 2007-09-18 15:43:40 -07:00
H. Peter Anvin
eef59fc328 Add NOP with argument to the instruction list
0F 1F /0 is documented as an EA-taking NOP since the P6.
0F 18..1F + EA are all "hinting nops" (instructions which, when
unimplemented, have no effect rather than #UD) but 0F 1F /0
specifically has no operation whatsoever.
2007-09-18 15:43:08 -07:00
H. Peter Anvin
76815bf60b Remove 0FC2 from list of instruction prefixes
0FC2 is not really an instruction prefix; it's the opcode for
CMPPS/CMPSS, which takes a control immediate which Intel chose to have
opcode aliases for.  However, we can't dispatch on a tail byte, so
it's useless.
2007-09-18 15:24:38 -07:00
H. Peter Anvin
19e2010536 Speed up the disassembler by allowing prefixed instruction tables
Modify the disassembler so that we can have separate instruction
tables for prefixed instructions.  As it was, all instructions which
started with 0F were linearly searched, and that is by now more than
half the instruction set.
2007-09-18 15:08:20 -07:00
H. Peter Anvin
0edc309505 Document oword, do and reso
Document oword and the associated do and reso pseudoinstructions.
2007-09-18 13:45:12 -07:00
H. Peter Anvin
41c9f6fde0 Implement "oword" (128 bits) as a first-class size
Implement oword, reso, do, as well as the SO flag to instructions.  No
instructions are actually flagged with SO yet, but this allows us to
specify 128-bit sizes in instruction patterns.
2007-09-18 13:01:32 -07:00
H. Peter Anvin
5255fd1f36 Change the token prehash function for better convergence
Combining arithmetric (add) and bitwise (xor) mixing seems to give
better result than either.

With the new prehash function, we find a valid hash much quicker.
2007-09-18 12:38:07 -07:00
H. Peter Anvin
3ce3715fba SSE5 instruction table
Implement the full SSE5 instruction table.
2007-09-18 12:23:21 -07:00
H. Peter Anvin
7786c364b4 Disassembler support for SSE5 instructions
Support for the SSE5 instruction format in the disassembler.

Also adds some comments to insnsd.c for easier debugging.
2007-09-17 18:45:44 -07:00
H. Peter Anvin
0a80739c46 insns.dat: All SSE5 instructions are AMD
SSE5 is an AMD-defined instruction set, so tag those AMD.
2007-09-17 17:27:46 -07:00
H. Peter Anvin
cf5180a955 Actually generate SSE5 instructions
This checkin completes what is required to actually generate SSE5
instructions.  No support in the disassembler yet.

This checkin covers:

- Support for actually generating DREX prefixes.
- Support for matching operand "operand X must match Y"
2007-09-17 17:25:27 -07:00
H. Peter Anvin
401c07e20d Initial support for generating DREX suffixes
Initial support for generating DREX suffixes.  Not used yet.  No
disassembler support yet, and no support for "operand X must match
operand Y."
2007-09-17 16:55:04 -07:00
H. Peter Anvin
8f94f988f0 Fix a few instances of missing renumbers
parser.c: change hard-coded argument count 3 to MAX_ARGUMENTS
assemble.c: change a few missed code renumbers
2007-09-17 16:31:33 -07:00
H. Peter Anvin
19315e012f Enable IF_AR3
Enable IF_AR3, which was incorrectly disabled in a previous checkin.
2007-09-17 16:20:45 -07:00
H. Peter Anvin
18b78815b9 Merge commit 'origin/master' into sse5 2007-09-17 15:49:53 -07:00
H. Peter Anvin
7eb4a38793 Initial support for four arguments per instruction
For SSE5, we will need to support four arguments per instruction.
2007-09-17 15:49:30 -07:00
H. Peter Anvin
2dba5c218d CLFLUSH: Neither an x64 instruction nor AMD
CLFLUSH was introduced at least in Katmai, if not sooner.  It's
available in all modes.
2007-09-17 15:48:32 -07:00
H. Peter Anvin
3a7edd73a3 Sort dependency lists
Sort the dependency lists generated by "mkdep.pl", to make sure that
re-running "make alldeps" doesn't change anything unless there has
been real dependency changes.  The previous version could produce
different output between runs and across platforms.
2007-09-17 13:56:26 -07:00
H. Peter Anvin
b8af9aa522 Cleaner way to handle MSVC's _snprintf() underscore damage
Some versions of MSVC have snprintf() and vsnprintf() only with a
leading underscore.  Handle that a bit more cleanly.
2007-09-17 13:53:14 -07:00
H. Peter Anvin
2ced2ec370 test/r13.asm: test special-casing of rbp and r13 in 64-bit mode
Test that we correctly special-case the modr/m generation for r13 in
64-bit mode.
2007-09-17 13:19:25 -07:00
H. Peter Anvin
2f3c4c056e Additional documentation for 64-bit programming
Flesh out the documentation for 64-bit programming a little bit; in
particular, include links to the ABI documentation for various
platforms.
2007-09-17 13:03:33 -07:00
H. Peter Anvin
b9957462d6 INSTALL: MSVC++ compilation instructions
Update compilation instructions for MSVC++, and point out that it's
not just Unix systems which can use the GNU instructions -- it also
applies to MacOS X and Windows with either Cygwin or MinGW.
2007-09-16 22:27:07 -07:00
H. Peter Anvin
39afbce9d4 make alldeps: change Mkfiles/Makefile.* to Mkfiles/*.mak
The previous checkin switched to the naming scheme *.mak to be able to
be more descriptive.  Thus, change "make alldeps" accordingly.
2007-09-16 22:17:29 -07:00
H. Peter Anvin
e8bfecf275 Fix Makefile for MSVC++ 2005, delete obsolete Makefiles
New Makefile for MSVC++ 2005, delete old unmaintained Makefiles.
2007-09-16 22:16:24 -07:00
H. Peter Anvin
21d6be423f Minor fixes needed to compile with MSVC++ 2005
Minor fixes to make it possible to compile with MS Visual C++ 2005.
Unfortunately, MSVC++ is not fully C99 compliant; in particular, it
doesn't handle interspersed declarations and other code.  Furthermore,
it chokes on some expressions in outelf64.c, which fortunately can be
easily substituted with simpler expressions.
2007-09-16 22:15:34 -07:00
H. Peter Anvin
9e8e948f86 Run "make alldeps" 2007-09-16 18:35:02 -07:00
H. Peter Anvin
97a234782d Switch the preprocessor over to using the hash table library
Switch the preprocessor over to using the hash table library.  On my
system, this improves the runtime of the output of test/pref/macro.pl
from over 600 seconds to 7 seconds.

Macros have an odd mix of case-sensitive and case-insensitive
behaviour, plus there are matching parameters for arguments, etc.  As
a result, we use case-insensitive hash tables and use a linked list to
store all the possible isomorphs.
2007-09-16 18:04:57 -07:00
H. Peter Anvin
d2fb7a699e Fix the handling of local labels
In converting the label system over to the new hash table library,
accidentally broke local labels by prepending the prefix twice.  Fix.
2007-09-16 17:53:17 -07:00
H. Peter Anvin
8cfdb9d185 preproc.c: remove unnecessary int64_t
We hardly need to support more than 2^31 arguments to a macro.
2007-09-14 18:36:01 -07:00
H. Peter Anvin
6244f4b5b9 Use the new hash table function library to store labels
Use the new hash table function library to store labels.  When
compiling on my 64-bit system, it reduces the assembly time for the
output of test/perf/label.pl from 73 to 7 seconds.
2007-09-14 18:03:29 -07:00
H. Peter Anvin
cde08292d6 Define a proper hash table library
Define a proper hash table library, instead of the current ad hoc stuff
used for both labels and macros.  This only implements the actual
library; it is not yet used.

We use a CRC64 as a prehash.  This is almost certainly overkill,
although it is rather efficient (except, arguably, the table lookup)
on 64-bit platforms, and not all that bad on 32-bit platforms.  All we
really need is a function which produces two independent 32-bit
results which are used as the primary and secondary hash
respectively.  Either way, the prehash function is easily replacable
if/when we have a quicker alternative.
2007-09-14 09:24:38 -07:00
H. Peter Anvin
9ab60dabcc Simple performance benchmarks: label, macro and token lookups
Simple scripts to generate performance benchmarks for label,
macro and token lookups.  The label and macro lookups are simple
numerical sequences; it may be desirable to add some more
sophisticated algorithms for producing tokens in case we want to
compare different hash functions against each other.
2007-09-13 18:13:20 -07:00
H. Peter Anvin
942acbf782 release script: fix final cleanup
Make sure we're in the right place for the final cleanup.
2007-09-13 12:25:32 -07:00
H. Peter Anvin
c338779174 Modify release script for a git-centric world
Change the release script to use git rather than CVS.
THE BEHAVIOR OF THE SCRIPT HAS CHANGED -- make sure to look at it
before use.
2007-09-13 12:22:00 -07:00
H. Peter Anvin
1a6e76d682 pptok.c: don't insist on C99 compiler behaviour
Declarations that are not at the head is C99 behaviour, but it's
rather pointless for this little piece of code.  Fix to work with
older compilers.
2007-09-13 11:06:42 -07:00
H. Peter Anvin
388b3ab3a3 Fix literal F2 and F3 prefixes
Correct literal F2 and F3 prefixes and instead use \332 and \333.
Otherwise we get the REX prefixes in the wrong place.
2007-09-12 22:02:06 -07:00
H. Peter Anvin
cb9b690ae6 Add (untested!) SSSE3, SSE4.1, SSE4.2 instructions
Add the SSSE3, SSE4.1 and SSE4.2 instruction sets.  Change \332 to be
a literal 0xF2 prefix, by analog with \333 for 0xF3 prefix (the
previous \332 flag changed to \335).  This is necessary to get the REX
prefix in the right place for instructions that use it.

We are going to have to go in and change existing instruction patterns
which use these, as well.
2007-09-12 21:58:51 -07:00
H. Peter Anvin
daffd79372 Add support for Tejas New Instructions (SSSE3)
Add the SSSE3 instruction set.
2007-09-12 21:06:36 -07:00
H. Peter Anvin
d105682096 Remove $Id$ tags (useless with git)
Remove CVS $Id$ tags, since git doesn't use them.
2007-09-12 21:05:06 -07:00
H. Peter Anvin
c9f8ee92f0 Use rm32 operands for VMREAD/VMWRITE
Use rm32 instead of coding reg32 and mem32 separately.
2007-09-12 21:04:58 -07:00
H. Peter Anvin
2e7dd975eb Macros for SSSE3/SSE4 instruction sets
Add instruction set flags for the SSSE3, SSE4.1 and SSE4.2 instruction
subsets.
2007-09-12 21:04:51 -07:00
H. Peter Anvin
0da6b580eb Support r/m operands for non-integer types
Support r/m operands for non-integer operands types, i.e. mmx or xmm
operands.  This allows mmx and xmm operands to be written more
compactly, speeding up the assembler.
2007-09-12 21:04:39 -07:00
H. Peter Anvin
16b0a33cea Use enumerations where practical to ease debugging
We have a lot of enumerations; by declaring fields as such, we make it
easier when debugging, since the debugger can display the enumerations
in cleartext.  However, make sure exceptional values (like -1) are
included in the enumeration, since the compiler otherwise may not
include it in the valid range of the enumeration.
2007-09-12 20:27:41 -07:00
H. Peter Anvin
7978feebd2 pptok.c: quick-and-dirty downcasing during prehashing
Speed up pptok.c by just doing |= 0x20 instead of calling tolower() for
every character during prehashing.  This is good enough for our needs,
since we don't have any tokens containing the characters @ [ \ ] _ nor
any high-bit characters (in which case we'd have to worry about multibyte
anyway.)
2007-09-12 17:02:55 +00:00
H. Peter Anvin
ff6e9b4699 phash: Tell the user when the graph is OK
Tell the user when the graph is OK, so that we don't get quite so much of
"a list of errors followed by a long pause."
2007-09-12 16:55:57 +00:00
H. Peter Anvin
3100e6cb63 pptok.c: handle holes in the pp_directives array
We need to fail if we land in a hole in the pp_directives array, since
we have a noncontiguous enum preproc_token now.
2007-09-12 05:18:20 +00:00
H. Peter Anvin
95e28828ab preproc.c: adjust whitespace
Be consistent about whitespace.
2007-09-12 04:20:08 +00:00
H. Peter Anvin
da10e7b85e More automation in the preprocessor conditionals handling
Further automate the production of preprocessor conditionals.  Now the
code automatically folds if/elif and the negatives.
2007-09-12 04:18:37 +00:00