]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
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

12 years agoRemove const qualifier from function return type.
Florian Krohm [Tue, 15 Jan 2013 03:25:17 +0000 (03:25 +0000)] 
Remove const qualifier from function return type.
It's not meaningful.
Patch Guy Harris (guy@alum.mit.edu). Part of fixing BZ 312980.

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

12 years agoFix a comment and add one.
Florian Krohm [Sun, 13 Jan 2013 02:34:28 +0000 (02:34 +0000)] 
Fix a comment and add one.

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

12 years agos390: Support insns to convert between DFP values and signed/unsigned
Florian Krohm [Sun, 13 Jan 2013 02:29:05 +0000 (02:29 +0000)] 
s390: Support insns to convert between DFP values and signed/unsigned
integers. Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agoAdd 12 IROps for converting betwen DFP values and signed/unsigned integers.
Florian Krohm [Sat, 12 Jan 2013 22:02:07 +0000 (22:02 +0000)] 
Add 12 IROps for converting betwen DFP values and signed/unsigned integers.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agos390: bug fix. DFP rounding mode mixup.
Florian Krohm [Thu, 10 Jan 2013 15:41:46 +0000 (15:41 +0000)] 
s390: bug fix. DFP rounding mode mixup.
Spotted and fixed by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years agoGet rid of selectable default (return) values in conditional dirty
Julian Seward [Tue, 8 Jan 2013 14:09:04 +0000 (14:09 +0000)] 
Get rid of selectable default (return) values in conditional dirty
calls, as introduced in r2594.  It is overkill -- unnecessary
complexity.  Instead have a pre-assumed default bit pattern of 0101010
(0x55..) to be returned in such cases.

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

12 years agoRemove unused function.
Julian Seward [Mon, 7 Jan 2013 11:17:43 +0000 (11:17 +0000)] 
Remove unused function.

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

12 years agoThe call to set the rounding mode for DFP iops: Iop_AddD128, Iop_SubD128,
Carl Love [Thu, 3 Jan 2013 23:34:18 +0000 (23:34 +0000)] 
The call to set the rounding mode for DFP iops: Iop_AddD128, Iop_SubD128,
Iop_MulD128, Iop_DivD128, and Iop_D128toI64 is wrong. The call being used is
set_FPU_rounding_mode(). This call is used to set the two rounding mode bits
for the Floating point instructions. The call set_FPU_DFP_rounding_mode()
should have been used to set the three rounding mode bits for the DFP
instructions.

This patch changes the call to the correct function to set the DFP
rounding mode bits.

The patch must be applied from the VEX directory.

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

12 years agos390: Add support for DFP "shift significant" insns.
Florian Krohm [Tue, 1 Jan 2013 22:19:24 +0000 (22:19 +0000)] 
s390: Add support for DFP "shift significant" insns.
Based on patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.

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

12 years agoImprove handling of dirty helper calls when building trees in ado_treebuild_BB.
Florian Krohm [Sun, 30 Dec 2012 18:17:18 +0000 (18:17 +0000)] 
Improve handling of dirty helper calls when building trees in ado_treebuild_BB.
This function took an overly conservative approach and always assumed
that calling a dirty helper would modify both guest state and memory. This
patch introduces two new functions dirty_helper_stores and dirty_helper_puts,
to determine the actual side effets of a helper call. Using these functions
increases precision and allows the tree builder to move a GET past a dirty
helper call.

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

12 years agoShow the guest->host code expansion ratio when debug-printing
Julian Seward [Fri, 28 Dec 2012 09:01:59 +0000 (09:01 +0000)] 
Show the guest->host code expansion ratio when debug-printing
translations.

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

12 years agoIndentation only change.
Florian Krohm [Thu, 27 Dec 2012 20:59:43 +0000 (20:59 +0000)] 
Indentation only change.

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

12 years agos390: Support the "test data class/group" and "extract significance"
Florian Krohm [Thu, 27 Dec 2012 20:14:03 +0000 (20:14 +0000)] 
s390: Support the "test data class/group" and "extract significance"
insns. Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
This is part of fixing BZ 307113.

[ revision 2621 was also implemented by Maran. ]

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

12 years agoNew IROps: Iop_ExtractSigD64 and Iop_ExtractSigD128. These are needed to
Florian Krohm [Thu, 27 Dec 2012 20:01:13 +0000 (20:01 +0000)] 
New IROps: Iop_ExtractSigD64 and Iop_ExtractSigD128. These are needed to
implement s390's "extract significance" insns.

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

12 years agoRemove Makefile-icc which has been broken for a long time.
Florian Krohm [Thu, 27 Dec 2012 17:19:12 +0000 (17:19 +0000)] 
Remove Makefile-icc which has been broken for a long time.

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

12 years agos390: Do not waste a register when assigning a constant to a memory
Florian Krohm [Thu, 27 Dec 2012 00:59:43 +0000 (00:59 +0000)] 
s390: Do not waste a register when assigning a constant to a memory
location. If available, use MVHI and friends. If those are not available,
load the constant value into register r0 and store that. r0 is not visible
to register allocation and therefore using it does not increase register
pressure.
Remove S390_INSN_MZERO and replace it with S390_INSN_MIMM. Assigning zero
is just a special case..
Saves between 0.9% and 2.4% of insns as measured with the perf regression
bucket.

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

12 years agos390: Remove a forgotten debug print statement.
Florian Krohm [Thu, 27 Dec 2012 00:44:30 +0000 (00:44 +0000)] 
s390: Remove a forgotten debug print statement.

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

12 years agos390x: Support "compare biased exponent" insns CEDTR, CEXTR.
Florian Krohm [Wed, 26 Dec 2012 17:47:19 +0000 (17:47 +0000)] 
s390x: Support "compare biased exponent" insns CEDTR, CEXTR.
To do that properly, two new IROps are needed: Iop_CmpExpD64 and
Iop_CmpExpD128. It might seem that extracting the exponents using
Iop_ExtractExpD64/D128 and comparing the values could be used here.
But that only works for finite DFP values. Hence, the new IROps.

Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
This is part of fixing BZ 307113.

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

12 years agoFix VEX standalone build with Makefile-gcc. This has been bit-rotting
Florian Krohm [Mon, 24 Dec 2012 00:25:34 +0000 (00:25 +0000)] 
Fix VEX standalone build with Makefile-gcc. This has been bit-rotting
for a while.

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

12 years agos390: New file s390_defs.h to contain definitions that are
Florian Krohm [Mon, 24 Dec 2012 00:14:31 +0000 (00:14 +0000)] 
s390: New file s390_defs.h to contain definitions that are
neither guest nor host specific, but just s390 specific. These
definitions formerly resided in host_s390_defs.h

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

12 years agos390: Simplify the optimisation for PUTs to tracked registers.
Florian Krohm [Sun, 23 Dec 2012 01:09:16 +0000 (01:09 +0000)] 
s390: Simplify the optimisation for PUTs to tracked registers.

There is no need to treat the guest IA register specially. The first
assignment in a SB to any tracked register will always assign the full value
and not do an incremental update. Therefore, maintaining
env->first_IA_assignment is redundant. Interestingly, the old code
forgot to mark the tracking state as valid when first_IA_assignment was
true, resulting in an inefficiency (in the order of 0.8% of insns).

Also, when a tracked register already contains the value that it is
being assigned, there is not need to
(a) check whether that register requires precise memory exceptions and
(b) if so, assign the new value.
By definition, the register is up-to-date and reassigning the new value
which is also the old value is meaningless. No idea, what I was thinking
at the time.

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

12 years agos390: Reduce the size of an s390_insn from 48 bytes to 32 bytes by
Florian Krohm [Sat, 22 Dec 2012 15:01:04 +0000 (15:01 +0000)] 
s390: Reduce the size of an s390_insn from 48 bytes to 32 bytes by
- adding one level of indirection for CDAS and DFP binops
- rearranging and tweaking the variant for helper calls
- using seperate insns kinds for signed and unsigned multiplication
  and division.
Add an assert to make sure the size stays at 32 bytes.

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

12 years agos390: Fix a silly mistake causing an infinite loop.
Florian Krohm [Sat, 22 Dec 2012 14:50:41 +0000 (14:50 +0000)] 
s390: Fix a silly mistake causing an infinite loop.
Spotted by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years agos390: Generalise S390_INSN_GADD which only worked on the guest
Florian Krohm [Sat, 22 Dec 2012 02:28:25 +0000 (02:28 +0000)] 
s390: Generalise S390_INSN_GADD which only worked on the guest
state to S390_INSN_MADD which works for any memory location
addressable with base reg + 20-bit displacement.

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

12 years agos390: Fix an assert.
Florian Krohm [Sat, 22 Dec 2012 02:09:40 +0000 (02:09 +0000)] 
s390: Fix an assert.

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

12 years agos390: Rename s390_conv_t to s390_bfp_conv_t. Purely mechanical.
Florian Krohm [Fri, 21 Dec 2012 21:43:00 +0000 (21:43 +0000)] 
s390: Rename s390_conv_t to s390_bfp_conv_t. Purely mechanical.

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

12 years agos390: Distinguish between conversion to/from IRCmpFxxResult and
Florian Krohm [Fri, 21 Dec 2012 21:05:17 +0000 (21:05 +0000)] 
s390: Distinguish between conversion to/from IRCmpFxxResult and
IRCmpDxxResult, even though the encodings are currently the same.
Rename convert_s390_fpcc_to_vex to convert_s390_to_vex_bfpcc.
Add convert_s390_to_vex_dfpcc and convert_vex_dfpcc_to_s390.

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

12 years agoDefine IRCmpD64Result and IRCmpD128Result.
Florian Krohm [Fri, 21 Dec 2012 20:24:24 +0000 (20:24 +0000)] 
Define IRCmpD64Result and IRCmpD128Result.

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

12 years agos390: Add support for storing DFP values (32/64 bit).
Florian Krohm [Fri, 21 Dec 2012 18:55:03 +0000 (18:55 +0000)] 
s390: Add support for storing DFP values (32/64 bit).

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

12 years agoAdd support for these DFP insns:
Florian Krohm [Fri, 21 Dec 2012 17:32:12 +0000 (17:32 +0000)] 
Add support for these DFP insns:
AXTRA, CDTR, CXTR, DXTRA, LDETR, LXDTR, LDXTR, LEDTR, LTXTR, MXTRA, SXTRA
This is part of fixing BZ #307113.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com) with some minor
mods.

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

12 years agoRemove redundant code snippet.
Florian Krohm [Fri, 21 Dec 2012 04:40:28 +0000 (04:40 +0000)] 
Remove redundant code snippet.

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

12 years agoFix typos. Should really use __func__ instead.
Florian Krohm [Thu, 20 Dec 2012 19:44:18 +0000 (19:44 +0000)] 
Fix typos. Should really use __func__ instead.

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

12 years agos390: Fix IR generation for DDTR and MDTR. These insns do not modify
Florian Krohm [Thu, 20 Dec 2012 16:58:52 +0000 (16:58 +0000)] 
s390: Fix IR generation for DDTR and MDTR. These insns do not modify
the condition code.
Spotted and fixed by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years agos390: Fix disassembly for ADTRA, DDTRA, MDTRA, and SDTRA.
Florian Krohm [Thu, 20 Dec 2012 14:44:42 +0000 (14:44 +0000)] 
s390: Fix disassembly for ADTRA, DDTRA, MDTRA, and SDTRA.
Spotted by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).

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

12 years agos390: Add thunk layout documentation for S390_CC_OP_DFP_RESULT_64.
Florian Krohm [Thu, 20 Dec 2012 14:31:19 +0000 (14:31 +0000)] 
s390: Add thunk layout documentation for S390_CC_OP_DFP_RESULT_64.

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

12 years agoHook up a couple of ARM (encoded) load/store cases to the new guarded
Julian Seward [Wed, 19 Dec 2012 15:38:25 +0000 (15:38 +0000)] 
Hook up a couple of ARM (encoded) load/store cases to the new guarded
load/store IR stuff.  I think these are the last I am going to do, for
now.

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

12 years agoConstant folder: enable Sub32(x,0) ==> x.
Julian Seward [Wed, 19 Dec 2012 15:28:43 +0000 (15:28 +0000)] 
Constant folder: enable Sub32(x,0) ==> x.

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

12 years agoIop_GetMSBs8x16: remove a copy-n-paste error introduced in r2590.
Julian Seward [Wed, 19 Dec 2012 08:39:11 +0000 (08:39 +0000)] 
Iop_GetMSBs8x16: remove a copy-n-paste error introduced in r2590.

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

12 years agoFix typeOfPrimop for Iop_D32toD64 and Iop_D64toD32.
Florian Krohm [Wed, 19 Dec 2012 04:19:54 +0000 (04:19 +0000)] 
Fix typeOfPrimop for Iop_D32toD64 and Iop_D64toD32.
Spotted and fixed by Maran (maranp@linux.vnet.ibm.com).

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

12 years agoARM back end: handle IRDefaults in dirty helper calls.
Julian Seward [Mon, 17 Dec 2012 21:55:21 +0000 (21:55 +0000)] 
ARM back end: handle IRDefaults in dirty helper calls.

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

12 years agoIR: add the ability to specify the call-didn't-happen ("default")
Julian Seward [Mon, 17 Dec 2012 21:54:10 +0000 (21:54 +0000)] 
IR: add the ability to specify the call-didn't-happen ("default")
return value for conditional dirty helper calls returning values.  The
default value can be either all-zeroes or all-ones.

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

12 years agoRemove a bit of debug printing.
Julian Seward [Mon, 17 Dec 2012 21:51:59 +0000 (21:51 +0000)] 
Remove a bit of debug printing.

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

12 years agoFix an assert in s390 disassembly. Eliminate a few magic array
Florian Krohm [Sun, 16 Dec 2012 22:49:05 +0000 (22:49 +0000)] 
Fix an assert in s390 disassembly. Eliminate a few magic array
width constants and use S390_MAX_MNEMONIC_LEN instead.
New function "mnemonic" to construct a mnemonic string padded with
blanks for alignment.

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

12 years agoTeach vprintf_wrk about '*' as format width, in which case the width
Florian Krohm [Sun, 16 Dec 2012 22:44:32 +0000 (22:44 +0000)] 
Teach vprintf_wrk about '*' as format width, in which case the width
is given in an argument.

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

12 years agoImplement 128-bit PMOVMSKB using a single new primop (Iop_GetMSBs8x16)
Julian Seward [Thu, 13 Dec 2012 18:29:56 +0000 (18:29 +0000)] 
Implement 128-bit PMOVMSKB using a single new primop (Iop_GetMSBs8x16)
rather than chopping it up into two 64-bit pieces in the front end.

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

12 years agoChange a bunch more Thumb load/store events to use IR guarded loads/stores.
Julian Seward [Wed, 12 Dec 2012 18:30:12 +0000 (18:30 +0000)] 
Change a bunch more Thumb load/store events to use IR guarded loads/stores.

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

12 years agoSupport the UMAAL instruction. (n-i-bz). Based on a patch from
Julian Seward [Wed, 12 Dec 2012 00:16:41 +0000 (00:16 +0000)] 
Support the UMAAL instruction.  (n-i-bz).  Based on a patch from
Torbjorn Granlund, tg@gmplib.org.

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

12 years agoGeneralise S390_INSN_GZERO which only worked on the guest
Florian Krohm [Tue, 11 Dec 2012 04:09:43 +0000 (04:09 +0000)] 
Generalise S390_INSN_GZERO which only worked on the guest
state to S390_INSN_MZERO which works for any memory location
addressable with base reg + 12-bit displacement.

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

12 years agoEliminate some lameness when writing out hwcaps.
Florian Krohm [Sun, 9 Dec 2012 17:53:45 +0000 (17:53 +0000)] 
Eliminate some lameness when writing out hwcaps.

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

12 years agoMove definition of facility bits to libvex_s390x_common.h so we
Florian Krohm [Sun, 9 Dec 2012 17:26:32 +0000 (17:26 +0000)] 
Move definition of facility bits to libvex_s390x_common.h so we
can use them in m_machine.c. Rename LSCOND facility to LSC.

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

12 years agoUse VEX types.
Florian Krohm [Sun, 9 Dec 2012 02:06:29 +0000 (02:06 +0000)] 
Use VEX types.

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

12 years agoComplete the decoder. All published opcodes are now handled.
Florian Krohm [Fri, 7 Dec 2012 04:42:53 +0000 (04:42 +0000)] 
Complete the decoder. All published opcodes are now handled.

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

12 years agoMake diagnostics for SIGILL more controllable (VEX part).
Julian Seward [Thu, 6 Dec 2012 18:08:04 +0000 (18:08 +0000)] 
Make diagnostics for SIGILL more controllable (VEX part).
Fixes #309425.  (Mark Wielaard, mjw@redhat.com)

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

12 years agoRe-enable XADD Gb,Eb. Fixes #307106. (Jakub Jelinek, jakub@redhat.com)
Julian Seward [Thu, 6 Dec 2012 17:29:10 +0000 (17:29 +0000)] 
Re-enable XADD Gb,Eb.  Fixes #307106.  (Jakub Jelinek, jakub@redhat.com)

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

12 years agoRecognise insns for zEC12 in the decoder.
Florian Krohm [Wed, 5 Dec 2012 04:23:42 +0000 (04:23 +0000)] 
Recognise insns for zEC12 in the decoder.
There is no IR generation for these insns yet.

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

12 years agoIn the past, the implementation of STFLE returned the facilities of the host
Florian Krohm [Tue, 4 Dec 2012 04:45:32 +0000 (04:45 +0000)] 
In the past, the implementation of STFLE returned the facilities of the host
machine. This was not consistent in the following sense: Suppose the host
has a facility F installed and this facility implies the availability of an
insn X. Suppose further, that insn X is not supported in valgrind.
An application progrm that tests the availability of insn X by checking
for its associated facility F will fail under valgrind when using X because
valgrind will SIGILL. Not so good.

This patch changes the STFLE behaviour to adjust the facilities of the
virtual machine according to what the set of insns that is actually
supported. It's an approximation, because for some facilities we only
support a subset of the insns enabled by that facility.

Fixes BZ 310931.

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

12 years agoUse "load on condition" insns, if availably, to implement
Florian Krohm [Mon, 3 Dec 2012 13:32:05 +0000 (13:32 +0000)] 
Use "load on condition" insns, if availably, to implement
S390_INSN_COND_MOVE.

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

12 years agoRefactor the code based on s390_irgen_LAA.
Florian Krohm [Sun, 2 Dec 2012 21:31:15 +0000 (21:31 +0000)] 
Refactor the code based on s390_irgen_LAA.
New functions: s390_irgen_load_and_add32/64 and
s390_irgen_load_and_bitwise32/64.

Part of fixing BZ #306035.

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

12 years agoFix implementation of LAA for atomic update.
Florian Krohm [Sun, 2 Dec 2012 20:58:17 +0000 (20:58 +0000)] 
Fix implementation of LAA for atomic update.
Patch by Divya Vyas (divyvyas@linux.vnet.ibm.com).
Part of fixing BZ #306035.

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

12 years agoFix typo.
Florian Krohm [Sat, 1 Dec 2012 21:29:07 +0000 (21:29 +0000)] 
Fix typo.

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

12 years ago* make ARM word and unsigned byte load/stores use LoadG/StoreG
Julian Seward [Mon, 26 Nov 2012 13:47:31 +0000 (13:47 +0000)] 
* make ARM word and unsigned byte load/stores use LoadG/StoreG
* correctness fix for default cases in already-done cases

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

12 years agoMake a couple more load/store cases use IRLoadG/IRStoreG. Also add
Julian Seward [Mon, 26 Nov 2012 10:44:19 +0000 (10:44 +0000)] 
Make a couple more load/store cases use IRLoadG/IRStoreG.  Also add
debug printing to find out which load/store cases are most used in
practice.

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

12 years agoInitial front changes for ARM, to generate direct IR for at least some
Julian Seward [Sun, 25 Nov 2012 15:26:48 +0000 (15:26 +0000)] 
Initial front changes for ARM, to generate direct IR for at least some
conditional loads and stores.  Very incomplete -- most load-store
cases still use the old scheme.

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

12 years agoARM back end changes, to support code generation for IR guarded loads
Julian Seward [Sun, 25 Nov 2012 15:17:42 +0000 (15:17 +0000)] 
ARM back end changes, to support code generation for IR guarded loads
and stores.

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

12 years agoAdd IR level definitions and associated iropt hackery, to support
Julian Seward [Sun, 25 Nov 2012 15:14:44 +0000 (15:14 +0000)] 
Add IR level definitions and associated iropt hackery, to support
direct representation of conditional (guarded) loads and stores in IR.

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