]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
16 years agoHandle some redundant REX.W prefixes on code from IPP (Intel
Julian Seward [Sat, 13 Dec 2008 16:49:46 +0000 (16:49 +0000)] 
Handle some redundant REX.W prefixes on code from IPP (Intel
Performance Primitives).  This fixes #173751, at least for the test
cases so far provided.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1876

16 years agoAdd to the VexAbiInfo structure, two new fields:
Julian Seward [Thu, 4 Dec 2008 00:05:12 +0000 (00:05 +0000)] 
Add to the VexAbiInfo structure, two new fields:
  guest_amd64_assume_fs_is_zero
  guest_amd64_assume_gs_is_0x60

and use them to properly enable %fs/%gs prefix decoding for
guest-amd64.  This is needed to support amd64-darwin cleanly.

Unfortunately the VexAbiInfo needs to be plumbed to every single where
an address is decoded, which means the patch is vast, although very
trivial.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1875

16 years agoInitial VEX-end support for Darwin (x86 and amd64).
Julian Seward [Wed, 3 Dec 2008 21:29:59 +0000 (21:29 +0000)] 
Initial VEX-end support for Darwin (x86 and amd64).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1874

16 years agoHandle "movsd G,E" for G and E both regs. This is the non-binutils
Julian Seward [Mon, 17 Nov 2008 20:25:37 +0000 (20:25 +0000)] 
Handle "movsd G,E" for G and E both regs.  This is the non-binutils
encoding.  Fixes #175150.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1873

16 years agoSupport "repe scas" on amd64. Fixes #168943.
Julian Seward [Sat, 8 Nov 2008 15:25:00 +0000 (15:25 +0000)] 
Support "repe scas" on amd64.  Fixes #168943.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1872

16 years agoTighten up decoding of isel instruction.
Julian Seward [Thu, 6 Nov 2008 09:22:05 +0000 (09:22 +0000)] 
Tighten up decoding of isel instruction.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1871

16 years agoSupport isel (integer conditional move).
Julian Seward [Thu, 6 Nov 2008 09:02:34 +0000 (09:02 +0000)] 
Support isel (integer conditional move).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1870

16 years agoHandle MOVSD reg,reg for the encoding which is not emitted by binutils.
Julian Seward [Tue, 4 Nov 2008 11:31:44 +0000 (11:31 +0000)] 
Handle MOVSD reg,reg for the encoding which is not emitted by binutils.
Fixes #171645.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1869

16 years agoFixes for compilation warnings from the apparently very strict
Julian Seward [Sat, 1 Nov 2008 23:54:45 +0000 (23:54 +0000)] 
Fixes for compilation warnings from the apparently very strict
gcc-4.3.2 shipped with Ubuntu 8.10.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1868

16 years agoIn 32-bit mode only, accept primary opcode 0x82 and treat it the same
Julian Seward [Fri, 31 Oct 2008 21:27:38 +0000 (21:27 +0000)] 
In 32-bit mode only, accept primary opcode 0x82 and treat it the same
as 0x80.  Fixes #172417.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1867

16 years agoStop gcc-4.4.0 (snapshot) complaining about strict-aliasing violations.
Julian Seward [Thu, 23 Oct 2008 09:47:47 +0000 (09:47 +0000)] 
Stop gcc-4.4.0 (snapshot) complaining about strict-aliasing violations.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1866

16 years agoSupport FPREM1 on amd64. Fixes #172563.
Julian Seward [Sat, 11 Oct 2008 10:07:55 +0000 (10:07 +0000)] 
Support FPREM1 on amd64.  Fixes #172563.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1865

16 years agoAdd a description of the FP offset/size to type VexGuestLayout.
Julian Seward [Tue, 19 Aug 2008 11:15:10 +0000 (11:15 +0000)] 
Add a description of the FP offset/size to type VexGuestLayout.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1864

16 years agoC89 fixes (stop gcc complaining).
Julian Seward [Mon, 18 Aug 2008 21:47:52 +0000 (21:47 +0000)] 
C89 fixes (stop gcc complaining).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1863

17 years agoHandle frin, frim, frip, friz, in 64-bit mode only, for now.
Julian Seward [Fri, 8 Aug 2008 08:37:06 +0000 (08:37 +0000)] 
Handle frin, frim, frip, friz, in 64-bit mode only, for now.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1862

17 years agoIgnore .EH bit in lwarx / ldarx as it appears to be merely a hint.
Julian Seward [Wed, 6 Aug 2008 19:13:42 +0000 (19:13 +0000)] 
Ignore .EH bit in lwarx / ldarx as it appears to be merely a hint.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1861

17 years agoAdd support needed for exp-ptrcheck on ppc32/64.
Julian Seward [Wed, 30 Jul 2008 09:56:45 +0000 (09:56 +0000)] 
Add support needed for exp-ptrcheck on ppc32/64.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1860

17 years agoHandle Iop_ReinterpF32asI32, as needed for exp-ptrcheck.
Julian Seward [Tue, 29 Jul 2008 09:48:26 +0000 (09:48 +0000)] 
Handle Iop_ReinterpF32asI32, as needed for exp-ptrcheck.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1859

17 years agoMinor printing changes.
Julian Seward [Tue, 29 Jul 2008 09:47:21 +0000 (09:47 +0000)] 
Minor printing changes.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1858

17 years agoAdd Imbe_SnoopedStoreBegin and Imbe_SnoopedStoreEnd, to be used for
Julian Seward [Mon, 30 Jun 2008 10:31:47 +0000 (10:31 +0000)] 
Add Imbe_SnoopedStoreBegin and Imbe_SnoopedStoreEnd, to be used for
bracketing snooped stores; fix up compilation pipeline to accept
(ignore) them.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1857

17 years agoTranslate "fnstsw %ax" in a slightly different way, which plays better
Julian Seward [Wed, 4 Jun 2008 09:10:38 +0000 (09:10 +0000)] 
Translate "fnstsw %ax" in a slightly different way, which plays better
with Memcheck's origin tracking stuff.  a.k.a. a lame kludge.  See
comments in source.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1855

17 years agoIn some obscure circumstances, the allocator would incorrectly omit a
Julian Seward [Fri, 30 May 2008 22:58:07 +0000 (22:58 +0000)] 
In some obscure circumstances, the allocator would incorrectly omit a
spill store on the basis that the register being spilled had the same
value as the spill slot being written to.  This change is believed to
make the equals-spill-slot optimisation correct.  Fixes a bug first
observed by Nuno Lopes and later by Marc-Oliver Straub.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1853

17 years agoAllow 64-byte line sizes (PA6T cpu).
Julian Seward [Thu, 29 May 2008 16:39:21 +0000 (16:39 +0000)] 
Allow 64-byte line sizes (PA6T cpu).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1851

17 years agoFix a couple of longstanding enum inconsistencies discovered by
Julian Seward [Wed, 28 May 2008 09:40:29 +0000 (09:40 +0000)] 
Fix a couple of longstanding enum inconsistencies discovered by
Florian Krohm's static checker.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1850

17 years agoSupport 8 bit xadd. Fixes #158744.
Julian Seward [Tue, 13 May 2008 21:21:16 +0000 (21:21 +0000)] 
Support 8 bit xadd.  Fixes #158744.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1848

17 years agoCompute the starting address of the instruction correctly. This has
Julian Seward [Sun, 11 May 2008 10:11:58 +0000 (10:11 +0000)] 
Compute the starting address of the instruction correctly.  This has
always been wrong and can cause the next-instruction-address to be
wrong in obscure circumstances.  Fixes #152818.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1838

17 years agoUpdate to check fxrstor too.
Julian Seward [Fri, 9 May 2008 13:27:47 +0000 (13:27 +0000)] 
Update to check fxrstor too.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1837

17 years agoHandle fxrstor on x86. Fixes #126389.
Julian Seward [Fri, 9 May 2008 13:24:43 +0000 (13:24 +0000)] 
Handle fxrstor on x86.  Fixes #126389.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1836

17 years agoAllow pushfw and popfw. Fixes #157748.
Julian Seward [Fri, 9 May 2008 09:34:06 +0000 (09:34 +0000)] 
Allow pushfw and popfw.  Fixes #157748.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1835

17 years agoEnable repne cmps{b,w,l}. Fixes #153196.
Julian Seward [Fri, 9 May 2008 08:53:50 +0000 (08:53 +0000)] 
Enable repne cmps{b,w,l}.  Fixes #153196.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1834

17 years agoSpecialise CondNZ after SUBW for both x86 and amd64.
Julian Seward [Fri, 2 May 2008 22:15:12 +0000 (22:15 +0000)] 
Specialise CondNZ after SUBW for both x86 and amd64.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1833

17 years agoMerge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This
Julian Seward [Thu, 1 May 2008 20:13:04 +0000 (20:13 +0000)] 
Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk.  This
provides vex-side support for origin tracking in Memcheck.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1832

17 years agoEnable FUCOMPP on amd64. Fixes #161378.
Julian Seward [Mon, 28 Apr 2008 21:05:33 +0000 (21:05 +0000)] 
Enable FUCOMPP on amd64.  Fixes #161378.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1826

17 years agoSpecialise CondNS after SUBB on amd64.
Julian Seward [Mon, 31 Mar 2008 21:57:17 +0000 (21:57 +0000)] 
Specialise CondNS after SUBB on amd64.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1817

17 years agoSpecialise CondNS after SUBB. The lack of this was causing Memcheck to
Julian Seward [Mon, 31 Mar 2008 01:51:57 +0000 (01:51 +0000)] 
Specialise CondNS after SUBB.  The lack of this was causing Memcheck to
report false positives in some tricky bitfield code in OOo 2.4 (writer)
when loading MS Word docs.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1816

17 years agoShow x86 sreg offsets.
Julian Seward [Fri, 15 Feb 2008 17:18:18 +0000 (17:18 +0000)] 
Show x86 sreg offsets.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1812

17 years agoUpdate copyright dates ("200X-2007" --> "200X-2008").
Julian Seward [Mon, 11 Feb 2008 11:35:40 +0000 (11:35 +0000)] 
Update copyright dates ("200X-2007" --> "200X-2008").

git-svn-id: svn://svn.valgrind.org/vex/trunk@1811

17 years agoFix CPUID:
Julian Seward [Sun, 10 Feb 2008 13:29:19 +0000 (13:29 +0000)] 
Fix CPUID:
- when EAX=4, output also depends on ECX
- handle out-of-range EAX correctly

git-svn-id: svn://svn.valgrind.org/vex/trunk@1810

17 years agoFinalise SSSE3 support (counterpart to r1808):
Julian Seward [Sat, 9 Feb 2008 01:16:02 +0000 (01:16 +0000)] 
Finalise SSSE3 support (counterpart to r1808):

* support SSSE3 for 32-bit insns

* For 128-bit variants accessing memory, generate an exception
  if effective address is not 128-bit aligned

* Change CPUID output to be Core-2, so now it claims to
  be a Core 2 E6600

git-svn-id: svn://svn.valgrind.org/vex/trunk@1809

17 years agoAdd SSSE3 support. Currently only for 64-bit. TODO:
Julian Seward [Wed, 6 Feb 2008 11:42:45 +0000 (11:42 +0000)] 
Add SSSE3 support.  Currently only for 64-bit.  TODO:
* Check through IR generation
* For 128-bit variants accessing memory, generate an exception
  if effective address is not 128-bit aligned
* Change CPUID output to be Core-2 like
* Enable for 32-bit code too.

* Make Memcheck handle the new IROps
* Commit test cases

git-svn-id: svn://svn.valgrind.org/vex/trunk@1808

17 years agoVery kludgey implementation of IRET. May or may not fix #155011.
Julian Seward [Fri, 4 Jan 2008 01:22:41 +0000 (01:22 +0000)] 
Very kludgey implementation of IRET.  May or may not fix #155011.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1807

17 years agoGenerate code to handle 64-bit integer loads and stores on 32-bit
Julian Seward [Tue, 4 Dec 2007 19:04:17 +0000 (19:04 +0000)] 
Generate code to handle 64-bit integer loads and stores on 32-bit
targets, as this is needed by Massif in Valgrind 3.3.0.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1804

17 years agoHandle the case Add64(expr,const) a bit better. Apparently Massif The
Julian Seward [Tue, 27 Nov 2007 00:11:13 +0000 (00:11 +0000)] 
Handle the case Add64(expr,const) a bit better.  Apparently Massif The
Second does that kind of thing a lot.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1803

17 years agoFix stupid bug in x86 isel: when generating code for a 64-bit integer
Julian Seward [Mon, 26 Nov 2007 23:18:52 +0000 (23:18 +0000)] 
Fix stupid bug in x86 isel: when generating code for a 64-bit integer
store, don't generate code to compute the address expression twice.
Spotted by Nick N whilst peering at code generated for new Massif.
Preventative changes in amd64 back end (which doesn't appear to have
the same problem).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1802

17 years agoImplement lods{b,w,l}. Fixes #152818.
Julian Seward [Sun, 25 Nov 2007 01:34:03 +0000 (01:34 +0000)] 
Implement lods{b,w,l}.  Fixes #152818.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1801

17 years agoImplement DAA/DAS/AAA/AAS. Really stupid and ugly instructions which
Julian Seward [Fri, 23 Nov 2007 02:46:29 +0000 (02:46 +0000)] 
Implement DAA/DAS/AAA/AAS.  Really stupid and ugly instructions which
might have made sense in 1973, but not now.  Fixes #152501.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1800

17 years agoSupport in{b,w,l} and out{b,w,l} on amd64. Fixes #152357.
Julian Seward [Tue, 20 Nov 2007 17:29:08 +0000 (17:29 +0000)] 
Support in{b,w,l} and out{b,w,l} on amd64.  Fixes #152357.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1799

17 years agoFix this:
Julian Seward [Mon, 19 Nov 2007 00:39:23 +0000 (00:39 +0000)] 
Fix this:
vex: priv/guest-amd64/toIR.c:3741 (dis_Grp5): Assertion `sz == 4' failed.
(CALL Ev with sz==8) as reported in #150678 and #146252.  Also change a
bunch of assertions on undecoded instructions into proper decoding failures.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1798

17 years agogcc-4.3 build fixes.
Julian Seward [Fri, 16 Nov 2007 12:43:32 +0000 (12:43 +0000)] 
gcc-4.3 build fixes.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1797

17 years agoImplement SALC. Fixes #147628.
Julian Seward [Fri, 16 Nov 2007 02:30:38 +0000 (02:30 +0000)] 
Implement SALC.  Fixes #147628.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1796

17 years agoEnable CMPXCHG Gb,Eb. Fixes #147498.
Julian Seward [Fri, 16 Nov 2007 00:18:44 +0000 (00:18 +0000)] 
Enable CMPXCHG Gb,Eb.  Fixes #147498.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1795

17 years agoHandle the "alternative" (non-binutils) encoding of 'adc' and tidy up
Julian Seward [Thu, 15 Nov 2007 23:30:16 +0000 (23:30 +0000)] 
Handle the "alternative" (non-binutils) encoding of 'adc' and tidy up
some other op-G-E / op-E-G decodings.  This fixes a bug which was
reported on valgrind-users@lists.sourceforge.net on 11 Aug 2007
("LibVEX called failure_exit() with 3.3.0svn-r6769 with Linux on
AMD64") I don't think it ever was formally filed as a bug report.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1794

17 years agoMerge changes from THRCHECK branch r1787. These changes are all to do
Julian Seward [Fri, 9 Nov 2007 21:15:04 +0000 (21:15 +0000)] 
Merge changes from THRCHECK branch r1787.  These changes are all to do
with making x86/amd64 LOCK prefixes properly visible in the IR, since
threading tools need to see them.  Probably would be no bad thing for
cachegrind/callgrind to notice them too, since asserting a bus lock on
a multiprocessor is an expensive event that programmers might like to
know about.

* amd64 front end: handle LOCK prefixes a lot more accurately

* x86 front end: ditto, and also a significant cleanup of prefix
  handling, which was a mess

* To represent prefixes, remove the IR 'Ist_MFence' construction
  and replace it with something more general: an IR Memory Bus
  Event statement (Ist_MBE), which can represent lock
  acquisition, lock release, and memory fences.

* Fix up all front ends and back ends to respectively generate
  and handle Ist_MBE.  Fix up the middle end (iropt) to deal with
  them.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1793

17 years agoAccept some apparently redundant REX.W prefixes seen on code in the
Julian Seward [Tue, 6 Nov 2007 20:39:17 +0000 (20:39 +0000)] 
Accept some apparently redundant REX.W prefixes seen on code in the
wild.  Quite possibly fixes #133962.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1792

17 years agoImplement maskmovq and maskmovdq.
Julian Seward [Sat, 1 Sep 2007 18:59:53 +0000 (18:59 +0000)] 
Implement maskmovq and maskmovdq.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1787

17 years agoSupport x86 $int 0x40 .. 0x43 instructions on Linux. Apparently these
Julian Seward [Wed, 29 Aug 2007 09:09:17 +0000 (09:09 +0000)] 
Support x86 $int 0x40 .. 0x43 instructions on Linux.  Apparently these
generate a segfault and then restart the instruction.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1786

17 years agoSupport td (64-bit counterpart to r1784).
Julian Seward [Tue, 28 Aug 2007 16:39:52 +0000 (16:39 +0000)] 
Support td (64-bit counterpart to r1784).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1785

17 years agoBetter support for trap insns. This adds support for tw (previously twi and
Julian Seward [Tue, 28 Aug 2007 14:48:35 +0000 (14:48 +0000)] 
Better support for trap insns.  This adds support for tw (previously twi and
tdi only were supported).  td to follow.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1784

17 years agoAdd missing return.
Julian Seward [Tue, 28 Aug 2007 06:06:57 +0000 (06:06 +0000)] 
Add missing return.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1783

17 years agoMerge, from CGTUNE branch, r1774:
Julian Seward [Tue, 28 Aug 2007 06:06:27 +0000 (06:06 +0000)] 
Merge, from CGTUNE branch, r1774:

Vex-side changes to allow tools to provide a final_tidy function which
they can use to mess with the final post-tree-built IR before it is
handed off to instruction selection.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1782

17 years agoMerge from CGTUNE branch, code generation improvements for amd64:
Julian Seward [Sat, 25 Aug 2007 23:21:08 +0000 (23:21 +0000)] 
Merge from CGTUNE branch, code generation improvements for amd64:

r1772:
When generating code for helper calls, be more aggressive about
computing values directly into argument registers, thereby avoiding
some reg-reg shuffling.  This reduces the amount of code (on amd64)
generated by Cachegrind by about 6% and has zero or marginal benefit
for other tools.

r1773:
Emit 64-bit branch targets using 32-bit short forms when possible.
Since (with V's default amd64 load address of 0x38000000) this is
usually possible, it saves about 7% in code size for Memcheck and even
more for Cachegrind.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1781

17 years agoMerge from CGTUNE branch:
Julian Seward [Sat, 25 Aug 2007 23:07:44 +0000 (23:07 +0000)] 
Merge from CGTUNE branch:

r1769:
This commit provides a bunch of enhancements to the IR optimiser
(iropt) and to the various backend instruction selectors.
Unfortunately the changes are interrelated and cannot easily be
committed in pieces in any meaningful way.  Between them and the
already-committed register allocation enhancements (r1765, r1767)
performance of Memcheck is improved by 0%-10%.  Improvements are also
applicable to other tools to lesser extents.

Main changes are:

* Add new IR primops Iop_Left64/32/16/8 and Iop_CmpwNEZ64/32/16/8
  which Memcheck uses to express some primitive operations on
  definedness (V) bits:

     Left(x)    = set all bits to the left of the rightmost 1 bit to 1
     CmpwNEZ(x) = if x == 0 then 0 else 0xFF...FF

  Left and CmpwNEZ are detailed in the Usenix 2005 paper (in which
  CmpwNEZ is called PCast).  The new primops expose opportunities for
  IR optimisation at tree-build time.  Prior to this change Memcheck
  expressed Left and CmpwNEZ in terms of lower level primitives
  (logical or, negation, compares, various casts) which was simpler
  but hindered further optimisation.

* Enhance the IR optimiser's tree builder so it can rewrite trees
  as they are constructed, according to useful identities, for example:

     CmpwNEZ64( Or64 ( CmpwNEZ64(x), y ) ) --> CmpwNEZ64( Or64( x, y ) )

  which gets rid of a CmpwNEZ64 operation - a win as they are relatively
  expensive.  See functions fold_IRExpr_Binop and fold_IRExpr_Unop.

  Allowing the tree builder to rewrite trees also makes it possible to
  have a single implementation of certain transformation rules which
  were previously duplicated in the x86, amd64 and ppc instruction
  selectors.  For example

     32to1(1Uto32(x)) --> x

  This simplifies the instruction selectors and gives a central place
  to put such IR-level transformations, which is a Good Thing.

* Various minor refinements to the instruction selectors:
  - ppc64 generates 32Sto64 into 1 instruction instead of 2
  - x86 can now generate movsbl
  - x86 handles 64-bit integer Mux0X better for cases typically
    arising from Memchecking of FP code
  - misc other patterns handled better

Overall these changes are a straight win - vex generates less code,
and does so a bit faster since its register allocator has to chew
through fewer instructions.  The main risk is that of correctness:
making Left and CmpwNEZ explicit, and adding rewrite rules for them,
is a substantial change in the way Memcheck deals with undefined value
tracking, and I am concerned to ensure that the changes do not cause
false negatives.  I _think_ it's all correct so far.

r1770:
Get rid of Iop_Neg64/32/16/8 as they are no longer used by Memcheck,
and any uses as generated by the front ends are so infrequent that
generating the equivalent Sub(0, ..) is good enough.  This gets rid of
quite a few lines of code.  Add isel cases for Sub(0, ..) patterns so
that the x86/amd64 backends still generate negl/negq where possible.

r1771:
Handle Left64.  Fixes failure on none/tests/x86/insn_sse2.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1780

17 years agoMerge, from CGTUNE branch:
Julian Seward [Sat, 25 Aug 2007 21:29:03 +0000 (21:29 +0000)] 
Merge, from CGTUNE branch:

r1768:
Cosmetic (non-functional) changes associated with r1767.

r1767:
Add a second spill-code-avoidance optimisation, which could be called
'directReload' for lack of a better name.

If an instruction reads exactly one vreg which is currently in a spill
slot, and this is last use of that vreg, see if the instruction can be
converted into one that reads directly from the spill slot.  This is
clearly only possible for x86 and amd64 targets, since ppc is a
load-store architecture.  So, for example,

   orl %vreg, %dst

where %vreg is in a spill slot, and this is its last use, would
previously be converted to

   movl $spill-offset(%ebp), %tmp
   orl %tmp, %dst

whereas now it becomes

   orl $spill-offset(%ebp), %dst

This not only avoids an instruction, it eliminates the need for a
reload temporary (%tmp in this example) and so potentially further
reduces spilling.

Implementation is in two parts: an architecture independent part, in
reg_alloc2.c, which finds candidate instructions, and a host dependent
function (directReload_ARCH) for each arch supporting the
optimisation.  The directReload_ function does the instruction form
conversion, when possible.  Currently only x86 hosts are supported.

As a side effect, change the form of the X86_Test32 instruction from
reg-only to reg/mem so it can participate in such transformations.

This gives a code size reduction of 0.6% for perf/bz2 on x86 memcheck,
but tends to be more effective for long blocks of x86 FP code.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1779

17 years agoMerge, from CGTUNE branch:
Julian Seward [Sat, 25 Aug 2007 21:11:33 +0000 (21:11 +0000)] 
Merge, from CGTUNE branch:

r1765:
During register allocation, keep track of which (real) registers have
the same value as their associated spill slot.  Then, if a register
needs to be freed up for some reason, and that register has the same
value as its spill slot, there is no need to produce a spill store.
This substantially reduces the number of spill store instructions
created.  Overall gives a 1.9% generated code size reduction for
perf/bz2 running on x86.

r1766:
Followup to r1765: fix some comments, and rearrange fields in struct
RRegState so as to fit it into 16 bytes.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1778

17 years agoAllow up to 7 prefixes, so as to accept
Julian Seward [Thu, 23 Aug 2007 18:53:59 +0000 (18:53 +0000)] 
Allow up to 7 prefixes, so as to accept
66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00  nopw   %cs:0x0(%rax,%rax,1)
as a valid no-op.  Blargh.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1776

18 years ago* implement fistp
Julian Seward [Wed, 11 Jul 2007 22:49:26 +0000 (22:49 +0000)] 
* implement fistp
* fix incorrect behaviour in out-of-range conversion conditions for fisttp

git-svn-id: svn://svn.valgrind.org/vex/trunk@1775

18 years agoOops. Fix longstanding bug which will have caused an unnecessary 4M
Julian Seward [Sat, 5 May 2007 12:26:23 +0000 (12:26 +0000)] 
Oops.  Fix longstanding bug which will have caused an unnecessary 4M
of bss space to be allocated.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1763

18 years agoHandle x87 FCOMP.
Julian Seward [Fri, 4 May 2007 09:41:24 +0000 (09:41 +0000)] 
Handle x87 FCOMP.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1761

18 years agoStop gcc-4.2 producing hundreds of complaints of the form "warning:
Julian Seward [Tue, 1 May 2007 13:53:01 +0000 (13:53 +0000)] 
Stop gcc-4.2 producing hundreds of complaints of the form "warning:
cast from pointer to integer of different size" when compiling on a
64-bit target.  gcc-4.2 is correct to complain.  An interesting
question is why no previous gcc warned about this.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1759

18 years agoImplement lahf/sahf on amd64. Also set NDEP on x86 sahf. Fixes #143907.
Julian Seward [Sat, 7 Apr 2007 12:25:37 +0000 (12:25 +0000)] 
Implement lahf/sahf on amd64.  Also set NDEP on x86 sahf.  Fixes #143907.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1749

18 years agoFix various cases where the instruction decoder asserted/paniced
Julian Seward [Thu, 5 Apr 2007 15:06:56 +0000 (15:06 +0000)] 
Fix various cases where the instruction decoder asserted/paniced
instead of doing the normal SIGILL thing.  Fixes #143354.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1748

18 years agoFold Add8(t,t) ==> t << 1. Fixes #143817 (Unused bitfield pad bits
Julian Seward [Wed, 4 Apr 2007 22:48:06 +0000 (22:48 +0000)] 
Fold Add8(t,t) ==> t << 1.  Fixes #143817 (Unused bitfield pad bits
confuse memcheck)

git-svn-id: svn://svn.valgrind.org/vex/trunk@1747

18 years agoCounterpart to r1745: teach the amd64 back end how to generate 'lea'
Julian Seward [Sat, 31 Mar 2007 19:12:38 +0000 (19:12 +0000)] 
Counterpart to r1745: teach the amd64 back end how to generate 'lea'
instructions, and generate them in an important place.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1746

18 years agoTeach the x86 back end how generate 'lea' instructions, and generate
Julian Seward [Sat, 31 Mar 2007 14:30:12 +0000 (14:30 +0000)] 
Teach the x86 back end how generate 'lea' instructions, and generate
them in a couple of places which are important.  This reduces the
amount of generated code for memcheck and none by about 1%, and (in
very unscientific tests on perf/bz2) speeds memcheck up by about 1%.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1745

18 years agox86 back end: use 80-bit loads/stores for floating point spills rather
Julian Seward [Sun, 25 Mar 2007 04:14:58 +0000 (04:14 +0000)] 
x86 back end: use 80-bit loads/stores for floating point spills rather
than 64-bit ones, to reduce accuracy loss.  To support this, in
reg-alloc, allocate 2 64-bit spill slots for each HRcFlt64 vreg
instead of just 1.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1744

18 years agoamd64 equivalents of vx1742 (synthesise SIGILL in the normal way for
Julian Seward [Wed, 21 Mar 2007 00:21:56 +0000 (00:21 +0000)] 
amd64 equivalents of vx1742 (synthesise SIGILL in the normal way for
some obscure invalid instruction cases, rather than asserting)

git-svn-id: svn://svn.valgrind.org/vex/trunk@1743

18 years agox86 front end: synthesise SIGILL in the normal way for some obscure
Julian Seward [Tue, 20 Mar 2007 14:18:45 +0000 (14:18 +0000)] 
x86 front end: synthesise SIGILL in the normal way for some obscure
invalid instruction cases, rather than asserting, as happened in
#143079 and #142279.  amd64 equivalents to follow.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1742

18 years agoSupport 'INT $3' instruction on amd64 (counterpart to vx1736).
Julian Seward [Mon, 12 Mar 2007 00:43:59 +0000 (00:43 +0000)] 
Support 'INT $3' instruction on amd64 (counterpart to vx1736).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1741

18 years agoTolerate redundant REX.W prefix produced by Mono for 'fsqrt' (a lame
Julian Seward [Sun, 11 Mar 2007 19:34:13 +0000 (19:34 +0000)] 
Tolerate redundant REX.W prefix produced by Mono for 'fsqrt' (a lame
kludge).

git-svn-id: svn://svn.valgrind.org/vex/trunk@1740

18 years agoWhen generating 64-bit code, ensure that any addresses used in 4 or 8
Julian Seward [Fri, 9 Mar 2007 18:07:00 +0000 (18:07 +0000)] 
When generating 64-bit code, ensure that any addresses used in 4 or 8
byte loads or stores of the form reg+imm have the lowest 2 bits of imm
set to zero, so that they can safely be used in ld/ldu/lda/std/stdu
instructions.  This boils down to doing an extra check in
iselWordExpr_AMode and avoiding the reg+imm case in cases where the
amode might end up in any of the abovementioned instructions.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1739

18 years agoComment-only changes.
Julian Seward [Fri, 9 Mar 2007 14:24:38 +0000 (14:24 +0000)] 
Comment-only changes.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1738

18 years agoHandle the (bizarre) no-op "26 2E 64 65 90 %es:%cs:%fs:%gs:nop". This
Julian Seward [Thu, 1 Mar 2007 18:42:07 +0000 (18:42 +0000)] 
Handle the (bizarre) no-op "26 2E 64 65 90 %es:%cs:%fs:%gs:nop".  This
makes it possible to run Sun's JVM 1.5.0 on Valgrind.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1737

18 years agoSupport 'INT $3' instruction.
Julian Seward [Wed, 28 Feb 2007 23:31:42 +0000 (23:31 +0000)] 
Support 'INT $3' instruction.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1736

18 years agoHandle FCOM and FCOMPP in 64-bit mode (see #141790)
Julian Seward [Fri, 23 Feb 2007 08:48:22 +0000 (08:48 +0000)] 
Handle FCOM and FCOMPP in 64-bit mode (see #141790)

git-svn-id: svn://svn.valgrind.org/vex/trunk@1735

18 years agoMore IRBB -> IRSB renaming.
Julian Seward [Tue, 6 Feb 2007 01:52:52 +0000 (01:52 +0000)] 
More IRBB -> IRSB renaming.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1734

18 years agoFill in missing cases in eqIRConst. This stops iropt's CSE pass from
Julian Seward [Sat, 27 Jan 2007 00:46:28 +0000 (00:46 +0000)] 
Fill in missing cases in eqIRConst.  This stops iropt's CSE pass from
asserting in the presence of V128 immediates, which is a regression
in valgrind 3.2.2.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1731

18 years agoConstant fold XorV128(t,t) -> 0. Effect is that memcheck 'knows'
Julian Seward [Tue, 16 Jan 2007 19:19:55 +0000 (19:19 +0000)] 
Constant fold  XorV128(t,t) -> 0.  Effect is that memcheck 'knows'
that pxor %xmm_n, %xmm_n does not depend on the previous contents
of %xmm_n.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1728

18 years agoUpdate.
Julian Seward [Fri, 12 Jan 2007 20:31:49 +0000 (20:31 +0000)] 
Update.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1726

18 years agoImplement rcl{b,w,l,q} on amd64.
Julian Seward [Fri, 12 Jan 2007 20:29:01 +0000 (20:29 +0000)] 
Implement rcl{b,w,l,q} on amd64.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1725

18 years agoImplement FXSAVE on amd64. Mysteriously my Athlon64 does not seem to
Julian Seward [Wed, 10 Jan 2007 04:59:33 +0000 (04:59 +0000)] 
Implement FXSAVE on amd64.  Mysteriously my Athlon64 does not seem to
write all the fields that the AMD documentation says it should: it
skips ROP, RIP and RDP, so vex's implementation writes zeroes there.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1722

18 years agoAdd 'missing' primop Iop_ReinterpF32asI32 and code generation support
Julian Seward [Tue, 9 Jan 2007 15:20:07 +0000 (15:20 +0000)] 
Add 'missing' primop Iop_ReinterpF32asI32 and code generation support
for it on x86 hosts.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1721

18 years agoStraggler
Julian Seward [Mon, 8 Jan 2007 06:02:53 +0000 (06:02 +0000)] 
Straggler

git-svn-id: svn://svn.valgrind.org/vex/trunk@1720

18 years agoUpdate copyright dates.
Julian Seward [Mon, 8 Jan 2007 05:51:05 +0000 (05:51 +0000)] 
Update copyright dates.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1719

18 years agoAdd mkIRExprVec_6/7.
Julian Seward [Mon, 8 Jan 2007 05:09:55 +0000 (05:09 +0000)] 
Add mkIRExprVec_6/7.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1718

18 years agoUse 'ifndef' in the makefile correctly.
Julian Seward [Thu, 4 Jan 2007 16:13:14 +0000 (16:13 +0000)] 
Use 'ifndef' in the makefile correctly.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1716

18 years agoTidy up flags spec fn, and add a rule for INCW-CondZ.
Julian Seward [Fri, 29 Dec 2006 01:54:36 +0000 (01:54 +0000)] 
Tidy up flags spec fn, and add a rule for INCW-CondZ.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1714

18 years agoTidy up and finalise x86/amd64 flag spec rules for 3.2.2.
Julian Seward [Thu, 28 Dec 2006 04:40:12 +0000 (04:40 +0000)] 
Tidy up and finalise x86/amd64 flag spec rules for 3.2.2.
x86 COPY-CondP/NP needs re-verification.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1713

18 years agoHandle recent binutils padding "nopw %cs:0x0(%eax,%eax,1)"
Julian Seward [Thu, 28 Dec 2006 01:49:29 +0000 (01:49 +0000)] 
Handle recent binutils padding "nopw %cs:0x0(%eax,%eax,1)"

git-svn-id: svn://svn.valgrind.org/vex/trunk@1711

18 years agoEnable support for altivec prefetches: dss, dst, dstt, dstst, dststt.
Julian Seward [Wed, 27 Dec 2006 23:59:31 +0000 (23:59 +0000)] 
Enable support for altivec prefetches: dss, dst, dstt, dstst, dststt.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1709

18 years agoEnable lvxl and stvxl.
Julian Seward [Wed, 27 Dec 2006 21:21:14 +0000 (21:21 +0000)] 
Enable lvxl and stvxl.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1707