]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
12 years agoRename ppc_cache_line_szB to indicate that this is the size
Florian Krohm [Sat, 3 Aug 2013 19:36:55 +0000 (19:36 +0000)] 
Rename ppc_cache_line_szB to indicate that this is the size
of the instruction cache.

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

12 years agomips32: Correctly model SHLL_S.PH on MIPS32.
Dejan Jevtic [Fri, 2 Aug 2013 16:02:28 +0000 (16:02 +0000)] 
mips32: Correctly model SHLL_S.PH on MIPS32.

Fix problem with IRTemp size when modeling SHLL_S.PH on MIPS32.

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

12 years agos390: New machine model: zBC12
Florian Krohm [Sun, 28 Jul 2013 15:28:57 +0000 (15:28 +0000)] 
s390: New machine model: zBC12

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

12 years agomips32: Add support for mips32 DSP instruction set.
Dejan Jevtic [Thu, 25 Jul 2013 09:08:03 +0000 (09:08 +0000)] 
mips32: Add support for mips32 DSP instruction set.

Add support for mips32 DSP and DSP revision 2 ASE.
More details about the mips32 DSP(r2) ASE:
http://www.mips.com/media/files/MD00566-2B-MIPSDSP-QRC-01.00.pdf
Applied patch provided by Maja Gagic <maja.gagic@rt-rk.com>

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

12 years agoImplement the following instructions, in both ARM and Thumb
Julian Seward [Thu, 4 Jul 2013 20:35:42 +0000 (20:35 +0000)] 
Implement the following instructions, in both ARM and Thumb
encodings:
  SSAX SXTAB16 SHASX SHSAX SHSUB16 SHSUB8
  UASX USAX UQADD16 UQASX UQSAX UHASX UHSAX REVSH

Fixes
  321363 321364 321466 321467 321468 321619 321704
  321620 321621 321692 321694 321696 321697 321703

(Vasily, w.golubev@mail.ru)

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

12 years agoAdd support for
Julian Seward [Thu, 4 Jul 2013 15:25:36 +0000 (15:25 +0000)] 
Add support for
(T1) STRBT reg+#imm8
(T1) STRHT reg+#imm8
(T1) LDRBT reg+#imm8
(T1) LDRSBT reg+#imm8
(T1) PLI reg+#imm12
(T2) PLI reg-#imm8
(T3) PLI PC+/-#imm12

Fixes: 319858 319932 320083 321693 321148
(Vasily, w.golubev@mail.ru)

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

12 years agomips: implement Iop_8Uto64 in iselInt64Expr
Petar Jovanovic [Thu, 4 Jul 2013 00:39:37 +0000 (00:39 +0000)] 
mips: implement Iop_8Uto64 in iselInt64Expr

Iop_8Uto64 was missing in iselInt64Expr.
The change should resolve Bugzilla #319505.

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

12 years agos390: Support some more BFP <-> DFP conversions (the ones
Florian Krohm [Mon, 17 Jun 2013 21:03:56 +0000 (21:03 +0000)] 
s390: Support some more BFP <-> DFP conversions (the ones
that were added in VEX r2727).
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agoAdd some more IRops to convert between binary floating point and
Florian Krohm [Mon, 17 Jun 2013 18:59:51 +0000 (18:59 +0000)] 
Add some more IRops to convert between binary floating point and
decimal floating point values. Needed to complete s390 DFP support.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agomips64: fix 'unused variable' warning
Petar Jovanovic [Sun, 9 Jun 2013 16:46:14 +0000 (16:46 +0000)] 
mips64: fix 'unused variable' warning

On a couple of places, the code expected either _MIPSEB or _MIPSEL flag to
use some variables, but none of these flags is set when the code is compiled
for non-MIPS architectures.

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

12 years agoEliminate IRRoundingModeDFP by merging its values into IRRoundingMode.
Florian Krohm [Thu, 6 Jun 2013 19:12:46 +0000 (19:12 +0000)] 
Eliminate IRRoundingModeDFP by merging its values into IRRoundingMode.
Retain encodings. The rationale is that a rounding mode is an abstraction
and as such independent of formats used to represent numeric values.
This was triggered by the need for a rounding mode to express conversions
between binary floating point values and decimal floating point values.

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

12 years agos390x: Make the CC_DEP1 field appear completely initialised when
Florian Krohm [Fri, 31 May 2013 15:41:55 +0000 (15:41 +0000)] 
s390x: Make the CC_DEP1 field appear completely initialised when
writing a 32-bit floating point value into it.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agomips32/mips64: implement sdl, sdr, swl and swr without reading memory
Petar Jovanovic [Fri, 31 May 2013 15:09:56 +0000 (15:09 +0000)] 
mips32/mips64: implement sdl, sdr, swl and swr without reading memory

New implementation of SDL, SDW, SWL and SWR instructions in a way in which
no memory read is required. This came as an issue for programs that map
memory as write-exec only.

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

12 years agoImplement STRT. Fixes #319395. (Vasily Golubev, w.golubev@mail.ru)
Julian Seward [Mon, 13 May 2013 10:28:59 +0000 (10:28 +0000)] 
Implement STRT.  Fixes #319395.  (Vasily Golubev, w.golubev@mail.ru)

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

12 years agoImplement SSAT16. Fixes #318929. (Vasily Golubev, w.golubev@mail.ru)
Julian Seward [Mon, 13 May 2013 10:02:33 +0000 (10:02 +0000)] 
Implement SSAT16.  Fixes #318929.  (Vasily Golubev, w.golubev@mail.ru)

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

12 years agoFix s390 build failure.
Florian Krohm [Sun, 12 May 2013 13:57:13 +0000 (13:57 +0000)] 
Fix s390 build failure.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years agos390: First round of changes to support the PFPO insn.
Florian Krohm [Sat, 11 May 2013 15:02:58 +0000 (15:02 +0000)] 
s390: First round of changes to support the PFPO insn.
Support these IROps:
Iop_F64toD64, Iop_D64toF64
Iop_F64toD128, Iop_D128toF64,
Iop_F128toD128, Iop_D128toF128,

Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113

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

12 years agoGet rid of gcc warning on non-MIPS platforms.
Julian Seward [Wed, 8 May 2013 08:56:45 +0000 (08:56 +0000)] 
Get rid of gcc warning on non-MIPS platforms.

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

12 years agoAdd the following IROPs which are needed for s390 DFP support:
Florian Krohm [Sun, 5 May 2013 15:04:30 +0000 (15:04 +0000)] 
Add the following IROPs which are needed for s390 DFP support:
Iop_F64toD64, Iop_D64toF64
Iop_F64toD128, Iop_D128toF64,
Iop_F128toD128, Iop_D128toF128,

Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113

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

12 years agomips: fix some style issues, non-functional change
Petar Jovanovic [Sat, 27 Apr 2013 02:18:11 +0000 (02:18 +0000)] 
mips: fix some style issues, non-functional change

Minor cleanup, no real functional change.

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

12 years agomips: fix corner case for INS instruction
Petar Jovanovic [Sat, 27 Apr 2013 01:15:48 +0000 (01:15 +0000)] 
mips: fix corner case for INS instruction

This change fixes corner case for INS instruction when lsb = 0.
The test in none/tests/mips32/MIPS32int.c will be extended to include
additional test cases that trigger this condition.

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

12 years agoSTRD (both ARM and Thumb): for push-like cases -- specifically, STRD
Julian Seward [Fri, 26 Apr 2013 10:24:31 +0000 (10:24 +0000)] 
STRD (both ARM and Thumb): for push-like cases -- specifically, STRD
rD1,rD2, [sp, #-8], generate IR for the SP writeback before the
stores.  This loses restartability of the instruction but avoids
Memcheck complaining that we're writing below the stack pointer.

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

12 years agoImplement SMMLA{r}, both ARM and Thumb. n-i-bz.
Julian Seward [Tue, 23 Apr 2013 08:56:43 +0000 (08:56 +0000)] 
Implement SMMLA{r}, both ARM and Thumb.  n-i-bz.
(Ben Cheng <bccheng@google.com>)

Also, move ARM encoding of SMMUL{R} to a more sensible place.

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

12 years agoGenerate better code for Shl64(x, imm8) since the Neon front end
Julian Seward [Sun, 21 Apr 2013 00:45:18 +0000 (00:45 +0000)] 
Generate better code for Shl64(x, imm8) since the Neon front end
produces a lot of those for V{LD,ST}{1,2,3,4}.

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

12 years agoVLD4/VST4: generate in-line interleave/de-interleave code, so that
Julian Seward [Sat, 20 Apr 2013 23:27:36 +0000 (23:27 +0000)] 
VLD4/VST4: generate in-line interleave/de-interleave code, so that
loads can always be done in 8 byte units.

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

12 years agoVLD3/VST3: generate in-line interleave/de-interleave code, so that
Julian Seward [Sat, 20 Apr 2013 21:19:44 +0000 (21:19 +0000)] 
VLD3/VST3: generate in-line interleave/de-interleave code, so that
loads can always be done in 8 byte units.

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

12 years agomips: fix endian issues for LWL, LWR, LDR and LDL for mips64
Petar Jovanovic [Fri, 19 Apr 2013 12:35:00 +0000 (12:35 +0000)] 
mips: fix endian issues for LWL, LWR, LDR and LDL for mips64

This change:
- fixes endian issues for unaligned loads for MIPS64,
- (re)moves endian dependencies in guest-to-IR for Iop_ReinterpI32asF32
   and Iop_ReinterpI64asF64 to host-mips-isel,
- adds minor style changes in the area touched by the code.

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

12 years agoImproved front end translations for Neon V{LD,ST}{1,2} instructions,
Julian Seward [Thu, 18 Apr 2013 11:50:58 +0000 (11:50 +0000)] 
Improved front end translations for Neon V{LD,ST}{1,2} instructions,
that do deinterleaving/interleaving via IROps and so generate far
fewer memory references.  As a side effect, fix incorrect ARM back end
implementation of many of the SIMD lane interleaving/deinterleaving
and concatenation IROps.

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

12 years agoRemove some unused ifdeffery that allowed disabling QC flag updating
Julian Seward [Wed, 17 Apr 2013 11:21:58 +0000 (11:21 +0000)] 
Remove some unused ifdeffery that allowed disabling QC flag updating
for Neon.

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

12 years agoImplement ARM SDIV and UDIV instructions. Fixes #314178. Partially
Julian Seward [Thu, 11 Apr 2013 13:57:43 +0000 (13:57 +0000)] 
Implement ARM SDIV and UDIV instructions.  Fixes #314178.  Partially
based on a patch by Ben Cheng, bccheng@android.com.  Also renames two
misnamed PPC helpers.

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

12 years agoImplement (T1) LDRT reg+#imm8. Fixes #315689.
Julian Seward [Thu, 11 Apr 2013 10:56:42 +0000 (10:56 +0000)] 
Implement (T1) LDRT reg+#imm8.  Fixes #315689.
(Vasily, w.golubev@mail.ru)

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

12 years agoFix some rebasing fallout pertaining to today's AVX2 landing.
Julian Seward [Wed, 27 Mar 2013 22:15:36 +0000 (22:15 +0000)] 
Fix some rebasing fallout pertaining to today's AVX2 landing.
Fixes #317463.

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

12 years agoAdd support for the EQ_UQ SSE FP comparison operation. BZ#317444.
Tom Hughes [Wed, 27 Mar 2013 15:38:47 +0000 (15:38 +0000)] 
Add support for the EQ_UQ SSE FP comparison operation. BZ#317444.

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

12 years agoAMD64: Add support for AVX2, BMI1, BMI2 and FMA instructions (VEX side).
Julian Seward [Wed, 27 Mar 2013 11:37:33 +0000 (11:37 +0000)] 
AMD64: Add support for AVX2, BMI1, BMI2 and FMA instructions (VEX side).
Fixes #305728.  (Jakub Jelinek, jakub@redhat.com)

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

12 years agoImplement RDTSCP on amd64, finally. This fixes #251569 and dups
Julian Seward [Tue, 26 Mar 2013 13:53:18 +0000 (13:53 +0000)] 
Implement RDTSCP on amd64, finally.  This fixes #251569 and dups
311933, 313348 and 313354.

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

12 years agoImplement SSE4 MOVNTDQA insn. Fixes #316503.
Julian Seward [Tue, 26 Mar 2013 10:27:39 +0000 (10:27 +0000)] 
Implement SSE4 MOVNTDQA insn.  Fixes #316503.
(Patrick J. LoPresti, lopresti@gmail.com)

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

12 years agoFix an assertion failure on CVT.F64.S32 d16, d16, #1. Fixes #317186 (I think).
Julian Seward [Fri, 22 Mar 2013 13:28:50 +0000 (13:28 +0000)] 
Fix an assertion failure on CVT.F64.S32 d16, d16, #1.  Fixes #317186 (I think).

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

12 years agoVEX, ppc code cleanup
Carl Love [Wed, 20 Mar 2013 15:51:34 +0000 (15:51 +0000)] 
VEX, ppc code cleanup

This patch removes some dead code left behind when the code was restructured
to fix the implementation changes to make it compliant with the iop
definitions.

The patch makes no functional changes as it is just removing code that is not
reachable.

This patch is for Bugzilla 314269.

Signed-off-by: Carl Love <cel@us.ibm.com>
git-svn-id: svn://svn.valgrind.org/vex/trunk@2697

12 years agos390: Support the SRNMT instruction.
Florian Krohm [Tue, 12 Mar 2013 01:31:24 +0000 (01:31 +0000)] 
s390: Support the SRNMT instruction.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agoImplement VCVT.{S,U}32.F64 D[d], D[d], #frac_bits. Fixes #315738.
Julian Seward [Wed, 6 Mar 2013 08:34:04 +0000 (08:34 +0000)] 
Implement VCVT.{S,U}32.F64 D[d], D[d], #frac_bits.  Fixes #315738.

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

12 years agoImplement VCVT.F64.{SU}32, #imm. Fixes #308717.
Julian Seward [Tue, 5 Mar 2013 14:26:22 +0000 (14:26 +0000)] 
Implement VCVT.F64.{SU}32, #imm.  Fixes #308717.

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

12 years agoHandle "vmov qDest.I32 V128{0xFFFF}" so to speak, and make the case
Julian Seward [Tue, 5 Mar 2013 10:35:44 +0000 (10:35 +0000)] 
Handle "vmov qDest.I32 V128{0xFFFF}" so to speak, and make the case
for a zero immediate more similar.  Verify assembled output against
GNU as.  Fixes #311318.

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

12 years agoImplement SMLAL{BB,BT,TB,TT}. Fixes #308718. (Mans Rullgard,
Julian Seward [Mon, 4 Mar 2013 18:33:56 +0000 (18:33 +0000)] 
Implement SMLAL{BB,BT,TB,TT}.  Fixes #308718.  (Mans Rullgard,
mans@mansr.com)

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

12 years agos390: Fix disassembly. Wrong argument order was causing asserts.
Florian Krohm [Sun, 3 Mar 2013 03:21:57 +0000 (03:21 +0000)] 
s390: Fix disassembly. Wrong argument order was causing asserts.

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

12 years agoRemove dead code (a Coverity finding).
Florian Krohm [Sat, 2 Mar 2013 20:46:08 +0000 (20:46 +0000)] 
Remove dead code (a Coverity finding).

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

12 years agomips: fix for some warnings in mips files when compiling on amd64/x86
Petar Jovanovic [Sat, 2 Mar 2013 02:37:01 +0000 (02:37 +0000)] 
mips: fix for some warnings in mips files when compiling on amd64/x86

Fixing some constant size related warnings in mips files on gcc20(amd64).
Thanks Philippe for reporting it.

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

12 years agoHandle WFE and SEV, needed for spinlock hinting.
Julian Seward [Fri, 1 Mar 2013 21:13:24 +0000 (21:13 +0000)] 
Handle WFE and SEV, needed for spinlock hinting.

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

12 years agomips: adding MIPS64LE support to VEX
Petar Jovanovic [Wed, 27 Feb 2013 22:57:17 +0000 (22:57 +0000)] 
mips: adding MIPS64LE support to VEX

Necessary changes to VEX to support MIPS64LE on Linux.
Minor cleanup/style changes embedded in the patch as well.
Patch written by Dejan Jevtic and Petar Jovanovic.

More information about this issue:
https://bugs.kde.org/show_bug.cgi?id=313267

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

12 years agos390: Non-functional change. Pedant at work...
Florian Krohm [Fri, 22 Feb 2013 03:40:22 +0000 (03:40 +0000)] 
s390: Non-functional change. Pedant at work...

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

12 years agos390: Fix a type mixup found by BEAM.
Florian Krohm [Thu, 21 Feb 2013 03:03:05 +0000 (03:03 +0000)] 
s390: Fix a type mixup found by BEAM.

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

12 years agos390: Support the following DFP insns:
Florian Krohm [Thu, 14 Feb 2013 14:27:12 +0000 (14:27 +0000)] 
s390: Support the following DFP insns:
- extract basied exponent
- insert biased exponent
- quantize
- reround to significance
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113.

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

12 years agoStop gcc-4.4 complaining when this file is compiled on a 32 bit platform.
Julian Seward [Mon, 11 Feb 2013 16:06:03 +0000 (16:06 +0000)] 
Stop gcc-4.4 complaining when this file is compiled on a 32 bit platform.

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

12 years agoMake HReg a struct. In the past there were several occurences where
Florian Krohm [Mon, 11 Feb 2013 00:47:35 +0000 (00:47 +0000)] 
Make HReg a struct. In the past there were several occurences where
a HReg was assigned to an integer. This worked by accident because the
bits representing the register number (which was meant to be accessed)
happened to be in the right place.
Two new functions: hregIsInvalid and sameHReg.
The HReg struct just wraps the integer that was previously used to
represent a register without changing the encoding.

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

12 years agos390: Be consistent with emulation warnings about unsupported
Florian Krohm [Mon, 11 Feb 2013 00:03:27 +0000 (00:03 +0000)] 
s390: Be consistent with emulation warnings about unsupported
rounding modes in absence of the floating-point extension facility.
For some insns we would vassert for others we'd give a warning.
Now we always issue an emulation warning.

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

12 years agos390: Support these DFP insns: CDGTRA, CXGTR, CGXTR, and CGDTR.
Florian Krohm [Fri, 8 Feb 2013 23:32:54 +0000 (23:32 +0000)] 
s390: Support these DFP insns: CDGTRA, CXGTR, CGXTR, and CGDTR.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113.

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

12 years agos390: Change get_dfp_rounding_mode to map IR rounding modes to
Florian Krohm [Fri, 8 Feb 2013 20:22:03 +0000 (20:22 +0000)] 
s390: Change get_dfp_rounding_mode to map IR rounding modes to
S390_DEP_ROUND_.. values in the range [8;15]. See comments in code.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years agos390: Add cc thunk description for S390_CC_OP_DFP_{64|128}_TO_INT_32.
Florian Krohm [Fri, 8 Feb 2013 16:01:23 +0000 (16:01 +0000)] 
s390: Add cc thunk description for S390_CC_OP_DFP_{64|128}_TO_INT_32.
This should have been part of r2632.

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

12 years agos390: Fix debugging output in IR injection.
Florian Krohm [Thu, 7 Feb 2013 03:28:52 +0000 (03:28 +0000)] 
s390: Fix debugging output in IR injection.

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

12 years agos390: It is not necessary to save/restore the link register when
Florian Krohm [Sat, 2 Feb 2013 22:58:25 +0000 (22:58 +0000)] 
s390: It is not necessary to save/restore the link register when
making a helper call. The link register needs to be saved when
switching between valgrind and client code and the dispatcher code
already does that. Julian suggested this change when he merged the
COMEM branch.
This saves between 6% and 13% of insns on the perf bucket.
Runtime difference is within noise margin.

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

12 years agos390: Change insn selection to recognize memcpy-like statements.
Florian Krohm [Sat, 2 Feb 2013 00:16:58 +0000 (00:16 +0000)] 
s390: Change insn selection to recognize memcpy-like statements.
Add S390_INCN_MEMCPY and generate MVC for that later on. Saves between
0.1 - 1.5% of insns. Observed runtime differences on the perf bucket were
within noise margin.

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

12 years agoShifting an int and assigning it to a long could be trouble.
Florian Krohm [Sat, 2 Feb 2013 00:10:36 +0000 (00:10 +0000)] 
Shifting an int and assigning it to a long could be trouble.
It isn't here, but let's make the code clear in this respect.

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

12 years agoFix a few more HReg <-> UInt mixups.
Florian Krohm [Fri, 1 Feb 2013 16:11:51 +0000 (16:11 +0000)] 
Fix a few more HReg <-> UInt mixups.

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

12 years agoPost-patch to r2668. Choose more sensible names. Purely mechanical, no
Florian Krohm [Thu, 31 Jan 2013 02:04:02 +0000 (02:04 +0000)] 
Post-patch to r2668. Choose more sensible names. Purely mechanical, no
functional changes.
Mttt -> Ittt
Mtct -> Ittc
Mttc -> Itct
MTcc -> Itcc
eX -> e1  and conX -> con1

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

12 years agoThe Coverity tool was run against the Valgrind source code and identified a
Carl Love [Wed, 30 Jan 2013 18:39:57 +0000 (18:39 +0000)] 
The Coverity tool was run against the Valgrind source code and identified a
problem in VEX/priv/guest_ppc_toIR.c saying the variable 'insn_suffix' was
assigned but not used. The function _do_vsx_fp_roundToInt() has an
HChar * parameter named 'insn_suffix', and the intention of this function was
to set the insn_suffix appropriately for the passed opcode so that the caller
could use that suffix as needed (some callers needed, and others didn't).
However, since the parameter type is a simple pointer, passed by value,
insn_suffix was only modified locally, and the caller did not see the new
value. Since most of the callers of _do_vsx_fp_roundToInt() ignore the
insn_suffix, I have removed that from the parameter list and moved the code
for ascertaining the appropriate suffix into a new function called
_get_vsx_rdpi_suffix().

This patch is for Bugzilla 314099

The patch was written by Maynard Johnson.

The patch does not add any additional regtest errors.  The vbit tester
was also run.  No issues were found.

The patch was reviewed, tested and committed by Carl Love

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

12 years agomips: Fixing some HReg <--> UInt mixups spotted by Florian.
Petar Jovanovic [Wed, 30 Jan 2013 18:06:26 +0000 (18:06 +0000)] 
mips: Fixing some HReg <--> UInt mixups spotted by Florian.

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

12 years agoFollow-up on r2664-r2668 changes for IRExpr_Mux0X and Iex_Mux0X for MIPS32.
Petar Jovanovic [Tue, 29 Jan 2013 15:42:29 +0000 (15:42 +0000)] 
Follow-up on r2664-r2668 changes for IRExpr_Mux0X and Iex_Mux0X for MIPS32.

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

12 years agoInfrastructure cleanup part 2.
Florian Krohm [Tue, 29 Jan 2013 03:56:06 +0000 (03:56 +0000)] 
Infrastructure cleanup part 2.
Replace Iex_Mux0X with Iex_ITE (if-then-else)
and
IRExpr_Mux0X( cond, iffalse, iftrue ) with
IRExpr_ITE  ( cond, iftrue, iffalse );

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

12 years agoMux0X cond type change: fix a front end case that got missed.
Julian Seward [Sat, 26 Jan 2013 20:28:00 +0000 (20:28 +0000)] 
Mux0X cond type change: fix a front end case that got missed.

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

12 years agoMux0X cond type change: verify all isel cases, and implement one
Julian Seward [Sat, 26 Jan 2013 20:26:58 +0000 (20:26 +0000)] 
Mux0X cond type change: verify all isel cases, and implement one
that got missed (for F64).

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

12 years agoFix up a non-handled Mux0X case following r2664, and verify that
Julian Seward [Sat, 26 Jan 2013 13:32:09 +0000 (13:32 +0000)] 
Fix up a non-handled Mux0X case following r2664, and verify that
the sense of all of the Mux0X cases is correct.

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

12 years agoInfrastructure cleanup: change type of the condition field of
Julian Seward [Sat, 26 Jan 2013 11:47:55 +0000 (11:47 +0000)] 
Infrastructure cleanup: change type of the condition field of
IRExpr_Mux0X from Ity_I8 to Ity_I1.  This makes more sense, makes it
consistent with condition fields in IRStmt_Dirty and IRStmt_Exit, and
avoids some pointless 1Uto8 casting of the condition, in many cases.
Fixes for s390 are from Florian.

Also, make a small extension to ir_opt.c, that allows the constant
folder to look backwards through arbitrary expressions even in flat
IR.  This makes it possible to do arbitrary tree folding in ir_opt,
which is where it belongs.  Use this to implement the folding rule
CmpNE32(1Uto32(b), 0) ==> b.

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

12 years agoFix incorrect comment.
Julian Seward [Sat, 26 Jan 2013 11:39:13 +0000 (11:39 +0000)] 
Fix incorrect comment.

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

12 years agoChanges to make this usable for ARM/Thumb.
Julian Seward [Sat, 26 Jan 2013 11:37:51 +0000 (11:37 +0000)] 
Changes to make this usable for ARM/Thumb.

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

12 years agoAnnotate ARMNImm_to_Imm64 with fallthrough markers following
Julian Seward [Fri, 25 Jan 2013 09:46:43 +0000 (09:46 +0000)] 
Annotate ARMNImm_to_Imm64 with fallthrough markers following
verification against the table in host_arm_defs.h, "Neon Immediate
operand".  A particularly nasty piece of code.

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

12 years agoFix some HReg/UInt mixups, spotted by Florian.
Julian Seward [Fri, 25 Jan 2013 09:03:32 +0000 (09:03 +0000)] 
Fix some HReg/UInt mixups, spotted by Florian.

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

12 years agoRemove two unused variables that sneaked in in r2657.
Florian Krohm [Thu, 24 Jan 2013 17:02:34 +0000 (17:02 +0000)] 
Remove two unused variables that sneaked in in r2657.

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

12 years agoFix HReg <--> UInt mixup.
Florian Krohm [Thu, 24 Jan 2013 16:18:48 +0000 (16:18 +0000)] 
Fix HReg <--> UInt mixup.
vreg is a HReg, so we should not assign a hregNumber() to it.
Introduce and use vregno instead.

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

12 years agos390: Fix HReg <--> UInt mixups.
Florian Krohm [Thu, 24 Jan 2013 15:55:52 +0000 (15:55 +0000)] 
s390: Fix HReg <--> UInt mixups.

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

12 years agoFix some HReg/UInt mixups spotted by Florian.
Julian Seward [Thu, 24 Jan 2013 08:55:25 +0000 (08:55 +0000)] 
Fix some HReg/UInt mixups spotted by Florian.

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

12 years agoFix HReg <--> integer mixup. vreg2ireg returns an HReg not an integer.
Florian Krohm [Thu, 24 Jan 2013 04:59:49 +0000 (04:59 +0000)] 
Fix HReg <--> integer mixup. vreg2ireg returns an HReg not an integer.

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

12 years agoFix HReg <--> Uint mixup. iregNo returns an integer not a HReg.
Florian Krohm [Thu, 24 Jan 2013 04:58:11 +0000 (04:58 +0000)] 
Fix HReg <--> Uint mixup.  iregNo returns an integer not a HReg.

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

12 years agoUnreachable default case should vassert.
Florian Krohm [Wed, 23 Jan 2013 17:17:22 +0000 (17:17 +0000)] 
Unreachable default case should vassert.

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

12 years agoFix implementation of the DFP integer operands.
Carl Love [Tue, 22 Jan 2013 20:25:31 +0000 (20:25 +0000)] 
Fix implementation of the DFP integer operands.

The implementation of integer operands doesn't really match the documentation
for the Iop. Take for example Iop_ExtractExpD64. It is documented as
D64 -> I64 but the implementation of the UNARY is defined as
UNARY(Ity_D64, Ity_D64). The result is an integer that is stored in an integer
format in a floating point register. On the IBM s390 however, the architecture
stores the integer value in a general purpose register (GPR) not a floating
point register. This issue exists with the implementation of 11 Iops where the
PPC implementation has either a source or destination whose value is an integer
but the value is stored in a floating point register in an integer format. After
reviewing the PPC implementation with the s390 developer, it was agreed the
cleanest way to fix this is to change the PPC implementation. The BINOP will be
changed to be consistent with the Iop description. This means the PPC
instruction implementation of the PPC instruction in guest_ppc_toIR.c will need
to reinterpret integer source operands as integers which will move the value
from a floating point register to an integer register before calling binop().
The underlying PPC implementation of the unop() for the specific Iop will also
need to change to move the value from the integer register back to the floating
point register so the native instruction can be issued with the integer value
in a floating point register. It was decided that making the changed in PPC,
rather then having the s390 reinterpret integers as DFP and then move the value
back to an integer register, was preferable as it makes the implementation of
the unop(), binops(), triop() consistent with the definition of the Iop.

This patch also includes the needed changes for the vbit tester.  The Iop
definitions in memcheck/tests/vbit-test/util.c had to be updated to be consitent
with the changes in the Iops as documented below.  Also, the function mkLazy3()
in memcheck/mc_translate.c had to be updated to handle the I32 x I8 x I64 -> I64
and I32 x I8 x I128 -> I128 cases.

The specific list of changes are as follows:

Iop name in pub/libvex_ir.h
   documented type
     type of UNARY/BINARY/TERNARY in priv/ir_defs.c
-------------------------------------------------------

Iop_ExtractExpD64
   D64 -> I64
      UNARY(Ity_D64, Ity_D64); (current)
      UNARY(Ity_D64, Ity_I64); (fix)

Iop_ExtractExpD128
   D128 -> I64
       UNARY(Ity_D128, Ity_D64); (current)
       UNARY(Ity_D128, Ity_I64); (fix)

Iop_InsertExpD64
   I64 x I64 -> D64
   I64 x D64 -> D64 (fix definition)
       BINARY(Ity_D64,Ity_D64, Ity_D64); (current)
       BINARY(Ity_I64,Ity_D64, Ity_D64); (fix)

Iop_InsertExpD128
    I64 x I128 -> D128
    I64 x D128 -> D128 (fix definition)
        BINARY(Ity_D64,Ity_D128, Ity_D128); (current)
        BINARY(Ity_I64,Ity_D128, Ity_D128); (fix)

Iop_I64StoD128
    I64S -> D128
        UNARY(Ity_D64, Ity_D128); (current)
        UNARY(Ity_I64, Ity_D128); (fix)

Iop_D64toI64S
    IRRoundingModeDFP(I32) x D64 -> I64
        BINARY(ity_RMode, Ity_D64, Ity_D64) (current)
        BINARY(ity_RMode, Ity_D64, Ity_I64) (fix)

Iop_D128toI64S
    IRRoundingModeDFP(I32) x D128 -> I64
        BINARY(ity_RMode, Ity_D128, Ity_D64); (current)
        BINARY(ity_RMode, Ity_D128, Ity_I64); (fix)

Iop_I64StoD64
    IRRoundingModeDFP(I32) x I64 -> D64
        BINARY(ity_RMode, Ity_D64, Ity_D64); (current)
        BINARY(ity_RMode, Ity_I64, Ity_D64); (fix)

Iop_SignificanceRoundD64
    IRRoundingModeDFP(I32) x I8 x D64 -> D64
        TERNARY(ity_RMode,Ity_D64,Ity_D64, Ity_D64); (current)
        TERNARY(ity_RMode,Ity_I8,Ity_D64, Ity_D64); (fix)

Iop_SignificanceRoundD128
    IRRoundingModeDFP(I32) x I8 x D128 -> D128
         TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128); (current)
         TERNARY(ity_RMode,Ity_I8,Ity_D128, Ity_D128); (fix)

The patch is for bugzilla 311100

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

12 years agos390: Remove unreachable break statements.
Florian Krohm [Tue, 22 Jan 2013 14:02:05 +0000 (14:02 +0000)] 
s390: Remove unreachable break statements.
Spotted and fixed by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years ago The 32-bit DFP value is stored in a 64-bit register in
Carl Love [Mon, 21 Jan 2013 18:12:31 +0000 (18:12 +0000)] 
 The 32-bit DFP value is stored in a 64-bit register in
 ppc. The D32 to D64 and D64 to D32 definitions for the
 Iop type was specified in VEX/priv/ir_defs.c, function
 typeOfPrimop() as:

   case Iop_D32toD64:
      UNARY(Ity_64, Ity_D64);
   case Iop_D64toD32:
      BINARY(ity_RMode, Ity_D64, Ity_D64);

since the values resided in a 64-bit register. As part of the s390 DFP support
the definitions were changed to:

   case Iop_D32toD64:
      UNARY(Ity_32, Ity_D64);
   case Iop_D64toD32:
      BINARY(ity_RMode, Ity_D64, Ity_D32);

to reflect what they really should be. However, this broke the ppc
implementation. Valgrind would fail and report a mismatch on the types as the
ppc code was using a D64 instead of a D32.

This patch adds support for fetching and storing the Dfp32 operand as a 32-bit
value.  The support includes adding the functions iselDfp32Expr() and
iselDfp32Expr_wrk() and additional code to support the DFP32 bit iops.

This patch is for Bugzilla 312620.

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

12 years agomips: fixing issues spotted by a static code analysis tool
Petar Jovanovic [Sun, 20 Jan 2013 23:13:14 +0000 (23:13 +0000)] 
mips: fixing issues spotted by a static code analysis tool

Florian ran a static code analysis tool and found the issues.
Cleaning out old cruft now.

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

12 years agomips: fix for mips-disassembler when branch is at block_size-2 position
Petar Jovanovic [Sun, 20 Jan 2013 18:16:45 +0000 (18:16 +0000)] 
mips: fix for mips-disassembler when branch is at block_size-2 position

Check if the last instruction in the block is a branch or jump instruction
should happen only if the disassembler was not already stopped.
Incorrect conditional led to a boundary case in which jumps/branches were not
executed when placed on "max_insns - 2" position in the block.
none/tests/mips32/block_size test will be added to Valgrind to describe the case
and check for regressions in future.

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

12 years agoFold out an expression which is always False. Spotted by Florian using Coverity.
Julian Seward [Sun, 20 Jan 2013 11:39:52 +0000 (11:39 +0000)] 
Fold out an expression which is always False.  Spotted by Florian using Coverity.

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

12 years agoRemove a bit of dead code, spotted by Florian using Coverity.
Julian Seward [Sun, 20 Jan 2013 11:38:43 +0000 (11:38 +0000)] 
Remove a bit of dead code, spotted by Florian using Coverity.

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

12 years agoImprove the tree builder in IR optimisation. Allow load expressions to be
Florian Krohm [Sun, 20 Jan 2013 03:51:04 +0000 (03:51 +0000)] 
Improve the tree builder in IR optimisation. Allow load expressions to be
moved past Put/I statements and dirty helpers, when it is safe to do so.
It is safe, when the statement does not require exact memory exceptions.
New functions stmt_modifies_guest_state and dirty_helper_puts have been
added to determine the side effect on the guest state.
This optimisation enables the use of  memory-to-memory insns on
architectures that have those.

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

12 years agos390: Fix a type mixup spotted by IBM's BEAM checker.
Florian Krohm [Sun, 20 Jan 2013 03:08:04 +0000 (03:08 +0000)] 
s390: Fix a type mixup spotted by IBM's BEAM checker.

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

12 years agoAdd a vg_alignof macro
Philippe Waroquiers [Fri, 18 Jan 2013 06:15:44 +0000 (06:15 +0000)] 
Add a vg_alignof macro

Note that this macro behaves slightly differently for some types
from the gcc __alignof__ and from the equivalent (new) standardised
alignof.

vg_alignof macro is needed for the "perm_malloc" callers (next commit)
to determine the alignment of small blocks, but might be useful
for other purposes => placed in libvex_basictypes.h, close to offsetof.

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

12 years agoMerge, from branches/COMEM, revisions 2568 to 2641.
Julian Seward [Thu, 17 Jan 2013 14:23:53 +0000 (14:23 +0000)] 
Merge, from branches/COMEM, revisions 2568 to 2641.

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

12 years agomips32 equivalent to r2636: fix up the mips32 back end to be in sync
Julian Seward [Wed, 16 Jan 2013 22:11:13 +0000 (22:11 +0000)] 
mips32 equivalent to r2636: fix up the mips32 back end to be in sync
with infrastructural changes w.r.t. conditional dirty helpers that
return values.  Does not actually handle such cases since the mips32
front end does not generate them.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2641

12 years agoFix up the s390 back end to be in sync with infrastructural changes
Julian Seward [Wed, 16 Jan 2013 21:10:01 +0000 (21:10 +0000)] 
Fix up the s390 back end to be in sync with infrastructural changes
w.r.t. conditional dirty helpers that return values.  Does not
actually handle such cases since the s390 front end does not generate
them.  Further ahead, it would be more general to redo this by
incorporating a RetLoc as part of the helper_call struct.  This change
is OK for now, though.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2640

12 years agoppc32/64 equivalents to r2636: fix up the ppc back end to be in sync
Julian Seward [Wed, 16 Jan 2013 14:56:06 +0000 (14:56 +0000)] 
ppc32/64 equivalents to r2636: fix up the ppc back end to be in sync
with infrastructural changes w.r.t. conditional dirty helpers that
return values.  Does not actually handle such cases since the ppc
front end does not generate them.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2639

12 years agox86 equivalent to r2636: fix up the x86 back end to be in sync with
Julian Seward [Wed, 16 Jan 2013 09:29:37 +0000 (09:29 +0000)] 
x86 equivalent to r2636: fix up the x86 back end to be in sync with
infrastructural changes w.r.t. conditional dirty helpers that return
values.  Does not actually handle such cases since the x86 front end
does not generate them.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2638

12 years agoGet rid of a pointless assert, and let the isel fail in the normal
Julian Seward [Wed, 16 Jan 2013 09:22:27 +0000 (09:22 +0000)] 
Get rid of a pointless assert, and let the isel fail in the normal
way, if it wants to.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2637

12 years agoFix up the amd64 back end to be in sync with infrastructural changes
Julian Seward [Tue, 15 Jan 2013 22:30:39 +0000 (22:30 +0000)] 
Fix up the amd64 back end to be in sync with infrastructural changes
w.r.t. conditional dirty helpers that return values.  Does not
actually handle such cases since the amd64 front end does not generat
them.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2636

12 years agoComment-only changes.
Julian Seward [Tue, 15 Jan 2013 17:26:33 +0000 (17:26 +0000)] 
Comment-only changes.

git-svn-id: svn://svn.valgrind.org/vex/branches/COMEM@2635