Peter Johnson [Thu, 20 Sep 2007 05:15:29 +0000 (05:15 -0000)]
Follow NASM after all in only turning off default RIP-rel for FS and GS,
not all segment registers. FS and GS are the only ones which can have
a segment base != 0.
Peter Johnson [Wed, 19 Sep 2007 07:47:10 +0000 (07:47 -0000)]
Support NASM's upcoming RIP-relative syntax, with a few differences.
This adds a "default" directive that takes either "rel" or "abs". This
sets whether the default mode for simple displacements is RIP-relative (rel)
or not (abs). The default without a directive is "abs".
Also added is corresponding "rel" and "abs" effective address modifiers
to override whatever default is set:
[rel label] is RIP-relative
[abs label] is not.
In default rel mode, [label] defaults to the former, in default abs mode,
the latter. Also, segment overrides (note difference from NASM below) are
abs regardless of mode, unless explicitly overridden with rel:
[fs:label] is always abs
[rel fs:label] is always rel
However, we have a number of differences from NASM in this handling due to
what I feel to be yasm's more sane handling of [dword ...] and [qword ...].
In yasm, these set the displacement size, rather than the address size; the
latter is set using a a32/a64 prefix. I feel this is more sane as in 64-bit
mode the two can be different in the MovOffs (A0/A1 mov *ax) case.
Also, yasm disables default-rel mode if any segment register is used, not
just FS or GS as NASM currently does.
See modules/arch/x86/tests/riprel1.asm and
modules/arch/x86/tests/riprel2.asm for examples, as well as my recent
posting to the nasm-devel mailing list on SF.
Peter Johnson [Mon, 17 Sep 2007 02:58:05 +0000 (02:58 -0000)]
Make CPU feature flags and registers case insensitive again.
This was accidentally removed in [1929].
Add test case for these so it doesn't happen again.
Peter Johnson [Sun, 16 Sep 2007 20:41:16 +0000 (20:41 -0000)]
Add support for IEEE-754r "half precision" (16-bit) float format.
This format is used by SSE5.
Update minor tests; more extensive tests will be added soon.
Peter Johnson [Thu, 13 Sep 2007 06:35:24 +0000 (06:35 -0000)]
Change modifiers from a prioritized shifted sequence into an ordered array.
Move GAS suffixes to a separate field in x86_insn_info rather than
having them embedded in the modifier field.
Peter Johnson [Wed, 12 Sep 2007 04:15:33 +0000 (04:15 -0000)]
Run gen_x86_insn.py from vc and vc8 builds.
Users who build out of SVN will need to install Python, but this is painless even for
Windows users
(go to http://www.python.org/download/ and download and install the appropriate MSI)
Delete generated files from SVN; these are massive and annoying to keep updated
(massive diffs).
Peter Johnson [Tue, 11 Sep 2007 04:49:53 +0000 (04:49 -0000)]
Shrink the size of the x86_insn_info structure, particularly on 64-bit
systems, by combining operand lists into a single array (and trying to find
overlaps where possible). This saves about 4K even on a 32-bit system.
Also shrink the generated gperf code by outputting the number of info
structures directly rather than using NELEMS().
Peter Johnson [Mon, 10 Sep 2007 07:15:50 +0000 (07:15 -0000)]
Change genperf to take input and output filenames rather than outputting to
standard output. This makes for better error handling behavior with make
(redirecting the standard output could leave empty files behind on error).
Peter Johnson [Mon, 10 Sep 2007 07:03:53 +0000 (07:03 -0000)]
Check in generated files from the Python script added in [1937].
While I prefer not to have generated files in the source repository,
do this for now in the interest of sanity on the Windows side (to allow
building directly from a SVN checkout).
An alternative might be to require Python on Windows when building from
SVN. If at some point we decide to go that route, it will be easy enough
to remove these files and add the necessary bits to Mkfiles/vc and
Mkfiles/vc8.
Peter Johnson [Mon, 10 Sep 2007 06:59:47 +0000 (06:59 -0000)]
Change x86 instruction tables to be automatically generated.
This combines the C and perfect hash tables into a single source file,
and allows for easier future changes to the source-level structures.
The Python-built files are included in the distribution so that Python
is not added as a dependency.
The generated code has been verified equal against the old tables,
excepting a number of bugfixes.
Most of the bugs fixed are in the CPU field, plus a few GAS suffix fixes.
Peter Johnson [Sat, 8 Sep 2007 02:13:25 +0000 (02:13 -0000)]
Windows build fixes:
* modules.vcproj: Add x86cpu.c, x86regtmod.c, and lc3b arch files to fix build.
* x85geninsn.c: Clean up a couple of unused variables.
* genperf.c: Use sprintf instead of snprintf; convert filename backslashes to slashes.
paulbarker [Wed, 29 Aug 2007 14:08:19 +0000 (14:08 -0000)]
Fixed yasm frontend to call the correct wrappers (yasm_preproc_create and yasm_arch_create) rather than directly calling members of the preproc and arch modules.
Peter Johnson [Thu, 16 Aug 2007 05:50:59 +0000 (05:50 -0000)]
Add support for the following AMD instructions added in their July 2007
documentation update:
- LZCNT
- POPCNT
- EXTRQ
- INSERTQ
- MOVNTSD
- MOVNTSS
This required some new tricks in the x86 code, as EXTRQ and INSERTQ have
two imm8 parameters (the first one of which goes into the EA field), and
INSERTQ has a *4* parameter version (xmm1, xmm2, imm8, imm8). Instead of
globally making the structures 4 wide, we just special-case INSERTQ.
Peter Johnson [Wed, 1 Aug 2007 05:14:53 +0000 (05:14 -0000)]
HAMT: Update stored key when building tree downwards from identical keys.
Not doing this could cause us to lose an entry if the tree is deep enough
that we need to rehash the keys as we're moving downward.
Reported by: Stefan Sellmer <stefansel@hotmail.de>
Peter Johnson [Tue, 31 Jul 2007 04:53:22 +0000 (04:53 -0000)]
Fix two bugs in HAMT:
- HAMT_search() wasn't doing a full string comparison on the key before
returning success.
- HAMT_insert()'s check for the above was always doing a case-sensitive
check; fixed to use case-insensitive when the HAMT is supposed to be
case-insensitive (and likewise for HAMT_search).
Peter Johnson [Thu, 26 Jul 2007 06:55:27 +0000 (06:55 -0000)]
Change intnum so it stores long instead of unsigned long; this allows
intnum to not allocate bitvectors for "most" negative numbers.
We pay a bit more in conversion, but save big in terms of memory and
malloc/free calls
(e.g. ~10,000 allocations and ~250K bytes for elf-x86id.asm test).
Peter Johnson [Sun, 15 Jul 2007 21:54:11 +0000 (21:54 -0000)]
Don't use an inner structure for line mappings.
Fix a nit in yasm_linemap_poke() for the case when set() has not been
called before calling this function; the prior behavior could result
in incorrect line numbers due to not properly adjusting the new line
number.
Peter Johnson [Sun, 8 Jul 2007 05:31:59 +0000 (05:31 -0000)]
Change handling of frontend (mnenomic) instructions to make it easier to
customize on the arch side of things. Instead of passing around an
arch_data[4] for instructions, now the arch can extend the structure itself
to add additional information in any format it likes.
Peter Johnson [Mon, 25 Jun 2007 01:05:04 +0000 (01:05 -0000)]
Fix buglet in handling of SEG of SEG:OFF. We were deleting the term at
the wrong level. As we weren't changing numterms before either, this
really could have no effect other than not freeing the memory immediately
(it would be freed later).
Peter Johnson [Sat, 2 Jun 2007 05:21:33 +0000 (05:21 -0000)]
Correct CPU definitions for Prescott, Conroe, Penryn, and Nehalem.
All are 64-bit capable and thus should set CPU_Hammer; Prescott
was mistakingly also setting AMD features such as 3DNow.