]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
8 years agomips: fix a typo in log
Petar Jovanovic [Fri, 19 May 2017 13:57:28 +0000 (13:57 +0000)] 
mips: fix a typo in log

Minor typo. Log "cfc1 " instead of "ctc1 " for Min_MfFCSR.

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

8 years agoMissing VEX commit for Valgrind SVN r16393.
Ivo Raisr [Thu, 18 May 2017 09:47:51 +0000 (09:47 +0000)] 
Missing VEX commit for Valgrind SVN r16393.
Follow up to VEX r3365 and BZ#360415.

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

8 years agoPPC64, ISA 3.0 fixes
Carl Love [Wed, 17 May 2017 20:09:46 +0000 (20:09 +0000)] 
PPC64, ISA 3.0 fixes

- Fix mffs instruction, FPSCR, C_FPCC field access is not
  working correctly.
- Fix xscmpexpdp again still had a bug.
- Remove duplicate tests from test_isa_3_0.c
- Comment out he tests for the new ISA 3.0B instructions.  There
  seem to be some issues between the simulator and early HW that
  need to be sorted out.

Bugzilla 379925

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

8 years agoPower PC ISA 3.0 fixes:
Carl Love [Tue, 16 May 2017 20:35:28 +0000 (20:35 +0000)] 
Power PC ISA 3.0 fixes:
  Fix for stxvx instruction.
  Add LE support for stxv instruction
  Fix for the xscmpexpdp instruction

Bugzilla: 379703

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

8 years agomips: rewrite parts of mips_dirtyhelper_rdhwr
Petar Jovanovic [Tue, 16 May 2017 15:21:35 +0000 (15:21 +0000)] 
mips: rewrite parts of mips_dirtyhelper_rdhwr

The idea behind this change is to be less dependent on build-flags, and
more dependent on runtime environment.
So, if the code is compiled for mips32r1, it should be able to execute
mips32r2 code if the platforms supports it.

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

8 years agoReduce the number of compiler warnings on MIPS platforms
Ivo Raisr [Tue, 16 May 2017 07:59:31 +0000 (07:59 +0000)] 
Reduce the number of compiler warnings on MIPS platforms
Partial fix for BZ#370028
Slightly modified patch by: Tamara Vlahovic <tamara.vlahovic@imgtec.com>

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

8 years agoarm64-linux: detect Cavium CPUs (implementer = 0x43) and enable the
Julian Seward [Tue, 16 May 2017 06:26:48 +0000 (06:26 +0000)] 
arm64-linux: detect Cavium CPUs (implementer = 0x43) and enable the
fallback LLSC implementation in that case.  Pertains to bug #369459.
(VEX side changes)

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

8 years agoFix decoding failure in X86 VEX frontend.
Ivo Raisr [Mon, 15 May 2017 08:15:22 +0000 (08:15 +0000)] 
Fix decoding failure in X86 VEX frontend.
Fixes BZ#379838.
Patch by: Julian Seward <jseward@acm.org>

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

8 years agoImplement PRFM (unscaled offset). Fixes #371503.
Julian Seward [Sun, 14 May 2017 14:30:26 +0000 (14:30 +0000)] 
Implement PRFM (unscaled offset).  Fixes #371503.

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

8 years agoImplement "mrs <reg>, cntfrq_el0". Fixes #368868.
Julian Seward [Sun, 14 May 2017 13:00:07 +0000 (13:00 +0000)] 
Implement "mrs <reg>, cntfrq_el0".  Fixes #368868.

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

8 years agoBug 367543 - bt/btc/btr/bts x86/x86_64 instructions are poorly-handled wrt flags.
Julian Seward [Sat, 13 May 2017 16:40:59 +0000 (16:40 +0000)] 
Bug 367543 - bt/btc/btr/bts x86/x86_64 instructions are poorly-handled wrt flags.
This fixes the flag handling to be like Skylake.

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

8 years agoEnable the PCMPxSTRx variant $0x10. Fixes #372188.
Julian Seward [Fri, 12 May 2017 14:09:36 +0000 (14:09 +0000)] 
Enable the PCMPxSTRx variant $0x10.  Fixes #372188.

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

8 years agoImplement ADCX and ADOX instructions. Modified version of a patch from
Julian Seward [Fri, 12 May 2017 13:32:02 +0000 (13:32 +0000)] 
Implement ADCX and ADOX instructions.  Modified version of a patch from
jacobly.alt@gmail.com.  Bug 360415.

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

8 years agoBug 371491 - handleAddrOverrides() is truncating the segment base address when ASO...
Julian Seward [Thu, 11 May 2017 14:28:10 +0000 (14:28 +0000)] 
Bug 371491 - handleAddrOverrides() is truncating the segment base address when ASO prefix is used.
Patch from Michael Daniels (mdaniels@blackberry.com).

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

8 years agoRemove TileGX/Linux port.
Ivo Raisr [Mon, 8 May 2017 17:21:36 +0000 (17:21 +0000)] 
Remove TileGX/Linux port.
Fixes BZ#379504.

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

8 years agomips: improve support for RDHWR instruction
Petar Jovanovic [Mon, 8 May 2017 15:32:25 +0000 (15:32 +0000)] 
mips: improve support for RDHWR instruction

Add support for reading CPUNum, CC and CCRes registers using RDHWR.
This is a fix for KDE #379473.

Patch by Aleksandar Rikalo.

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

8 years agomips: reduce compile warnings
Petar Jovanovic [Fri, 5 May 2017 14:15:48 +0000 (14:15 +0000)] 
mips: reduce compile warnings

Tune the code so it does not trigger any compile warnings.

argregs and tmpregs arrays have been enlarged to have 8 elements on mips32,
since that way we get rid of several false warnings:

 warning: array index 5 is past the end of the array
 (which contains 4 elements) [-Warray-bounds]

Also removing three "vassert(tmp >= 0);" as these asserts are not valid,
since tmp is an unsigned value. With the change, we get rid of:

 warning: comparison of unsigned expression >= 0 is always true
 [-Wtautological-compare]

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

8 years agoUpdate copyright end year to 2017 in preparation for 3.13 release.
Ivo Raisr [Thu, 4 May 2017 15:10:00 +0000 (15:10 +0000)] 
Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz

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

8 years agoPPC64 ISA 3.0B, add support for the additional instructions: addex, mffscdrn,
Carl Love [Wed, 3 May 2017 17:24:55 +0000 (17:24 +0000)] 
PPC64 ISA 3.0B, add support for the additional instructions: addex, mffscdrn,
mffscdrni, mffsce, mffscrn, mffscrni, mffsl. vmsumudm.

Additionally, the OV32 and CA32 bits were introduced in ISA 3.0 but
Valgrind add support for setting these bits for ISA 3.0.  The OV32 and CA32
bits must now be set on a number of pre ISA 3.0 instructions.  So now the
instructions produce different results in the XER register.  Thus we need pre
and post ISA 3.0 expect files.  Command line options were added to thee
pre ISA test cases so instructions that didn't change could be run with one
set of command line args.  The instructions that have different XER results
are run using a different set of command line args.  The tests were split into
two, one for instructions that didn't change on for instructions that do
change under ISA 3.0.  We then create ISA3.0 expect files only for the tests
that run differently.  By doing this we minimized the size of the expect files
needed.

Valgrind bugzilla 378931

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

8 years agomips: remove unnecessary code
Petar Jovanovic [Wed, 3 May 2017 14:34:02 +0000 (14:34 +0000)] 
mips: remove unnecessary code

After r16309, abiinfo->guest__use_fallback_LLSC is already set for Cavium,
and hence it is not necessary to check archinfo->hwcaps in VEX.

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

8 years agomips: add missing assembler directive to ASM_VOLATILE_UNARY64
Petar Jovanovic [Tue, 25 Apr 2017 17:28:01 +0000 (17:28 +0000)] 
mips: add missing assembler directive to ASM_VOLATILE_UNARY64

Clang is picky and notices we have not explicitly set up fp64 mode.
This fixes issue with Clang build.

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

8 years agomips: remove unnecessary code from FCSR_fp32 dirty helper
Petar Jovanovic [Tue, 25 Apr 2017 16:37:16 +0000 (16:37 +0000)] 
mips: remove unnecessary code from FCSR_fp32 dirty helper

These cases should never happen. Removing the code.

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

8 years agomips: limit cvt.s.l instruction translation to fp_mode64
Petar Jovanovic [Tue, 25 Apr 2017 14:40:54 +0000 (14:40 +0000)] 
mips: limit cvt.s.l instruction translation to fp_mode64

The documentation says:
"For CVT.S.L, the result of this instruction is UNPREDICTABLE if the
processor is executing in the FR=0 32-bit FPU register model; it is
predictable if executing on a 64-bit FPU in the FR=1 mode, but not with
FR=0, and not on a 32-bit FPU."

Hence the fix.

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

8 years agowiden_z_16_to_64, widen_z_8_to_64: generate less stupid code.
Julian Seward [Mon, 24 Apr 2017 10:57:05 +0000 (10:57 +0000)] 
widen_z_16_to_64, widen_z_8_to_64: generate less stupid code.

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

8 years agoBug 369459 - valgrind on arm64 violates the ARMv8 spec (ldxr/stxr)
Julian Seward [Mon, 24 Apr 2017 09:23:43 +0000 (09:23 +0000)] 
Bug 369459 - valgrind on arm64 violates the ARMv8 spec (ldxr/stxr)

This implements a fallback LL/SC implementation as described in bug 344524.

The fallback implementation is not enabled by default, and there is no
auto-detection for when it should be used.  To use it, run with the
flag --sim-hints=fallback-llsc.  This commit also allows the existing
MIPS fallback implementation to be enabled with that flag.

VEX side changes:

* priv/main_main.c, pub/libvex.h

  Adds new field guest__use_fallback_LLSC to VexAbiInfo

* pub/libvex_guest_arm64.h priv/guest_arm64_toIR.c

  add front end support, new guest state fields
  guest_LLSC_{SIZE,ADDR,DATA}, also documentation of the scheme

* priv/guest_mips_toIR.c

  allow manual selection of fallback implementation via
  --sim-hints=fallback-llsc

* priv/host_arm64_defs.c priv/host_arm64_defs.h priv/host_arm64_isel.c

  Add support for generating CAS on arm64, as needed by the front end changes

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

8 years agofix early initialization of s390_host_hwcaps in LibVEX_FrontEnd
Petar Jovanovic [Wed, 12 Apr 2017 17:51:45 +0000 (17:51 +0000)] 
fix early initialization of s390_host_hwcaps in LibVEX_FrontEnd

This is a follow-up to r3341 and r3344. r3341 split LibVEX_Translate into
LibVEX_FrontEnd and LibVEX_BackEnd. s390_host_hwcaps needs to be initialized
early when arch_host is VexArchS390X.

This also fixes none/tests/libvexmultiarch_test on MIPS64 BE platforms.

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

8 years agomips: update code for Dis_Resteer for mode64
Petar Jovanovic [Tue, 11 Apr 2017 17:06:02 +0000 (17:06 +0000)] 
mips: update code for Dis_Resteer for mode64

Even though Dis_Resteer is currently unused, the code for mode64 should
be different.
Nicely spotted by Florian K.

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

8 years agoMark VPMULHRSW ymm3/m256, ymm2, ymm1 as a "verbose instruction". This
Julian Seward [Tue, 11 Apr 2017 16:34:53 +0000 (16:34 +0000)] 
Mark VPMULHRSW ymm3/m256, ymm2, ymm1 as a "verbose instruction".  This
pertains to failures documented at https://bugs.kde.org/show_bug.cgi?id=375839
comments 10 to 18.

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

8 years agoInitialize s390_host_hwcaps early in LibVEX_FrontEnd.
Mark Wielaard [Tue, 4 Apr 2017 12:02:14 +0000 (12:02 +0000)] 
Initialize s390_host_hwcaps early in LibVEX_FrontEnd.

VEX svn r3341 split LibVEX_Translate into LibVEX_FrontEnd and
LibVEX_BackEnd. The s390_host_hwcaps (KLUDGE) needs to be initialized
early in LibVEX_FrontEnd.

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

8 years agomips64: sign-extend results from dirty helper
Petar Jovanovic [Mon, 3 Apr 2017 14:30:13 +0000 (14:30 +0000)] 
mips64: sign-extend results from dirty helper

Values returned from the dirty helper may not be sign-extended, so let's
make sure the values get passed as sign-extended for Ity_I32, Ity_I16, and
Ity_I8 cases.
At the same time, we can remove now redundant sign-extensions introduced in
VEX r3304.

This fixes memcheck/test/bug340392 on some MIPS64 boards.

Patch by Aleksandar Rikalo.

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

8 years agoSplit LibVEX_Translate into front- and back-end parts. Also, removes use
Julian Seward [Mon, 3 Apr 2017 13:24:05 +0000 (13:24 +0000)] 
Split LibVEX_Translate into front- and back-end parts.  Also, removes use
of __typeof__ when built with MSVC.  A combination of parts of two patches
from Andrew Dutcher <andrewrdutcher@gmail.com>.

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

8 years agox86 guest: switch descriptor table registers to ULong type so they will take up
Julian Seward [Mon, 3 Apr 2017 10:19:13 +0000 (10:19 +0000)] 
x86 guest: switch descriptor table registers to ULong type so they will take up
consistent amount of space (VEX side).  Andrew Dutcher <andrewrdutcher@gmail.com>.

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

8 years agoAdd a mechanism for hinting to the core disassembler loop, that the
Julian Seward [Wed, 29 Mar 2017 16:13:35 +0000 (16:13 +0000)] 
Add a mechanism for hinting to the core disassembler loop, that the
just-disassembled instruction is very verbose.  This allows dynamic changes to
the maximum number of guest instructions allowed in the current IRSB.
Fixes #375839.

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

8 years agoImplement the most important cases for amd64 direct-reload optimisation:
Julian Seward [Tue, 28 Mar 2017 14:57:17 +0000 (14:57 +0000)] 
Implement the most important cases for amd64 direct-reload optimisation:

   cmpq $imm32, %vreg  ->  cmpq $imm32, (stack-slot-of-vreg)
   orq %vreg, %reg     ->  orq (stack-slot-of-vreg), %reg

This is in support of "Bug 375839 - Temporary storage exhausted, when long
sequence of vfmadd231ps instructions to be executed", and reduces code size by
around 3% in that case.

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

8 years agoRewrite dis_FMA so it generates not-quite-so-terrible code. It's still terrible
Julian Seward [Mon, 27 Mar 2017 18:32:10 +0000 (18:32 +0000)] 
Rewrite dis_FMA so it generates not-quite-so-terrible code.  It's still terrible
(breaks vectors into scalars) but this rewrite does it in a way which makes it
interact better with put-to-get forwarding.  It also removes all the
Iop_Reinterp casting involved.  For long sequences of FMA instructions this
reduces the amount of memcheck-generated code to about 75% of what it was
before.  Improves the situation for
  Bug 375839 - Temporary storage exhusted , when long sequence of vfmadd231ps instructions to be executed
but isn't a convincing fix.

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

8 years agoUse consistently chase1() in MSVC specific transformation hacks.
Ivo Raisr [Fri, 24 Mar 2017 13:46:15 +0000 (13:46 +0000)] 
Use consistently chase1() in MSVC specific transformation hacks.
This code is experimental and not used by default but should be self-consistent.
n-i-bz

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

8 years agoFix type of t_inc to correct IRTemp.
Ivo Raisr [Tue, 14 Mar 2017 00:47:45 +0000 (00:47 +0000)] 
Fix type of t_inc to correct IRTemp.
No functional change.
n-i-bz

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

8 years agoThe mask64 value, in file VEX/priv/guest_ppc_toIR.c is missing the
Carl Love [Mon, 13 Mar 2017 20:10:40 +0000 (20:10 +0000)] 
The mask64 value, in file VEX/priv/guest_ppc_toIR.c is missing the
HWCAPS bit for ISA3.0.

bugzilla 377478

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

8 years agomips: emulate LL/SC w/ guest_LLaddr and guest_LLdata
Petar Jovanovic [Mon, 13 Mar 2017 17:50:25 +0000 (17:50 +0000)] 
mips: emulate LL/SC w/ guest_LLaddr and guest_LLdata

Improve LL/SC emulation with introduction of LLaddr and LLdata in the
guest state. LLaddr gets invalidated when the threads switch.

More info at KDE #344524. This patch should fix the issue.

Currently, this is effective for Cavium boards only.

Patch by Maran Pakkirisamy.

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

8 years agoPowerPC: Fix incorrect register pair check for lxv, stxv, stxsd, stxssp, lxsd,
Carl Love [Fri, 10 Mar 2017 20:07:09 +0000 (20:07 +0000)] 
PowerPC:  Fix incorrect register pair check for lxv, stxv, stxsd, stxssp, lxsd,
lxssp instructions

The lfdpx, stdpx, lfdp and stfdp instructions work on a register pair.  The
register pair test must only be applied to these instructions in the
dis_fp_pair() function.

bugzilla 377427

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

8 years agoMinor refactoring for assignedOnce_Stmt().
Ivo Raisr [Wed, 1 Mar 2017 18:44:21 +0000 (18:44 +0000)] 
Minor refactoring for assignedOnce_Stmt().
No functional change.
n-i-bz

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

8 years agoFix incorrect variable type (IRTemp->IRType)
Ivo Raisr [Mon, 27 Feb 2017 10:16:50 +0000 (10:16 +0000)] 
Fix incorrect variable type (IRTemp->IRType)
n-i-bz

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

8 years agoPush some spec rules for amd64 that have been sitting around for a while:
Julian Seward [Tue, 21 Feb 2017 15:08:28 +0000 (15:08 +0000)] 
Push some spec rules for amd64 that have been sitting around for a while:

  amd64g_calculate_condition:
    S and NS after SUBW
    Z and NZ after SHRQ
    NZ after SHRL (Z after SHRL was already present)

  amd64g_calculate_rflags_c:
    C after ADDQ
    C after ADDL

At least the first 5 reduce the Memcheck noise level from running
optimised code compiled by Clang.

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

8 years agomips64: do correct 32-bit comparison for Iop_CmpNE32
Petar Jovanovic [Mon, 13 Feb 2017 16:15:24 +0000 (16:15 +0000)] 
mips64: do correct 32-bit comparison for Iop_CmpNE32

Make sure that we take into account 32-bit size of values in comparison
on MIPS64-platforms. This is done either by sign extending these values
before comparison or sign extending xored values (depending on what
comparison we do). This should avoid false-positives like the one
reported in BZ #341481.

Patch based on code provided by Crestez Dan Leonard and Tamara Vlahovic.

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

8 years agoAdd comment about HINT instructions.
Tom Hughes [Sat, 11 Feb 2017 10:46:57 +0000 (10:46 +0000)] 
Add comment about HINT instructions.

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

8 years agoHandle unknown HINT instructions on aarch64 by ignoring them. BZ#376279.
Tom Hughes [Sat, 11 Feb 2017 10:44:29 +0000 (10:44 +0000)] 
Handle unknown HINT instructions on aarch64 by ignoring them. BZ#376279.

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

8 years agoFix non-mips build breakage from VEX r3300
Tom Hughes [Sat, 11 Feb 2017 10:40:48 +0000 (10:40 +0000)] 
Fix non-mips build breakage from VEX r3300

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

8 years agomips: rewrite mips_irgen_load_and_add32|64 and code around it
Petar Jovanovic [Fri, 10 Feb 2017 17:58:40 +0000 (17:58 +0000)] 
mips: rewrite mips_irgen_load_and_add32|64 and code around it

Make sure that mips_irgen_load_and_add32 gets both expected value and
new value, so the function code makes more sense and does load/store in
a atomic way.

Minor renaming and code style issues added too.

Patch by Tamara Vlahovic.

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

8 years agox86: Recognize the SS segment prefix on x86. Bug 344139 comment 4.
Julian Seward [Fri, 20 Jan 2017 10:01:42 +0000 (10:01 +0000)] 
x86: Recognize the SS segment prefix on x86.  Bug 344139 comment 4.
Patch from Sebastian Lackner, sebastian@fds-team.de.

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

8 years agoSmall comment fix: point at the correct file name
Philippe Waroquiers [Fri, 20 Jan 2017 09:59:05 +0000 (09:59 +0000)] 
Small comment fix: point at the correct file name

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

8 years agoImplement:
Julian Seward [Wed, 18 Jan 2017 15:02:55 +0000 (15:02 +0000)] 
Implement:
  VCVT{A,N,P,M}{.F32 d_d, .F32 q_q}
  VRINT{A,N,P,M,X,Z}{.F32 d_d, .F32 q_q}

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

8 years agoImplement V{MAX,MIN}NM{.F32 d_d_d, .F32 q_q_q}.
Julian Seward [Mon, 16 Jan 2017 07:15:04 +0000 (07:15 +0000)] 
Implement V{MAX,MIN}NM{.F32 d_d_d, .F32 q_q_q}.

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

8 years agodis_neon_data_3same: don't silently accept invalid instructions. Instead,
Julian Seward [Mon, 16 Jan 2017 05:14:24 +0000 (05:14 +0000)] 
dis_neon_data_3same: don't silently accept invalid instructions.  Instead,
"return False" for any instruction not accepted by this function.  Also,
add a few switch default backstops.

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

8 years agoImplement VRINTX.F64.F64 d_d, VRINTX.F32.F32 s_s.
Julian Seward [Sun, 15 Jan 2017 18:25:18 +0000 (18:25 +0000)] 
Implement VRINTX.F64.F64 d_d, VRINTX.F32.F32 s_s.

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

8 years agoImplement
Julian Seward [Fri, 13 Jan 2017 17:58:57 +0000 (17:58 +0000)] 
Implement
  V{MIN,MAX}NM.F64 Dd, Dn, Dm
  V{MIN,MAX}NM.F32 Sd, Sn, Sm

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

8 years agoImplement:
Julian Seward [Fri, 13 Jan 2017 12:51:29 +0000 (12:51 +0000)] 
Implement:
  VRINT{Z,R}.F64.F64 d_d, VRINT{Z,R}.F32.F32 s_s
  VCVT{A,N,P,M}{.S32,.U32}{.F64,.F32}

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

8 years agoImplement VRINT{A,N,P,M}.F64 d_d, VRINT{A,N,P,M}.F32 s_s.
Julian Seward [Thu, 12 Jan 2017 14:37:58 +0000 (14:37 +0000)] 
Implement VRINT{A,N,P,M}.F64 d_d, VRINT{A,N,P,M}.F32 s_s.

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

8 years agoImplement ARMv8 VSEL<c>.F64 d_d_d, VSEL<c>.F32 s_s_s.
Julian Seward [Thu, 12 Jan 2017 11:21:08 +0000 (11:21 +0000)] 
Implement ARMv8 VSEL<c>.F64 d_d_d, VSEL<c>.F32 s_s_s.

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

8 years agoFix assertion failure in decode_V8_instruction. Fixes #372794.
Julian Seward [Tue, 10 Jan 2017 16:05:14 +0000 (16:05 +0000)] 
Fix assertion failure in decode_V8_instruction.  Fixes #372794.

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

8 years agoconst IRExpr arguments for matchIRExpr()
Ivo Raisr [Fri, 23 Dec 2016 12:38:57 +0000 (12:38 +0000)] 
const IRExpr arguments for matchIRExpr()
Fixes BZ#373938

Gist of the changes is really just:
- Bool matchIRExpr ( MatchInfo* mi, IRExpr* p, IRExpr* e );
+ Bool matchIRExpr ( MatchInfo* mi, const IRExpr* p, const IRExpr* e );

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

8 years agoRename BBPTR to GSPTR as it denotes guest state pointer only
Ivo Raisr [Fri, 16 Dec 2016 21:20:30 +0000 (21:20 +0000)] 
Rename BBPTR to GSPTR as it denotes guest state pointer only
Fixes BZ#373555.

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

8 years agomips: small changes in VexGuestMIPS{32|64}State structs
Petar Jovanovic [Wed, 7 Dec 2016 16:19:26 +0000 (16:19 +0000)] 
mips: small changes in VexGuestMIPS{32|64}State structs

Move host_EvC_FAILADDR and host_EvC_COUNTER fields to the top of the
structure, similar to other architectures.

This fixes

none/tests/libvexmultiarch_test          (stderr)

on some MIPS platforms, as it avoids internal X86/AMD code generator
asserts.

Minor stylish changes included too.

Patch by Aleksandra Karadzic.

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

8 years agoFix xxsel parsing error, update.
Carl Love [Mon, 7 Nov 2016 19:58:19 +0000 (19:58 +0000)] 
Fix xxsel parsing error, update.

Commit 3284 listed Bugzilla 148000 which is incorrect.

Tweeked comments so the file VEX/priv/guest_ppc_toIR.c can be committed again.

The correct bugzilla is 372185.

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

8 years agoFix xxsel parsing error.
Carl Love [Mon, 7 Nov 2016 19:41:30 +0000 (19:41 +0000)] 
Fix xxsel parsing error.

The xxsel instruction uses part of the standard opc2 field to specify
a additional operand or other values.  A subset of the field is used for
the actual opcode.  The masking and array lookup was getting confused by
bits in the the additional operand field.  The arrays were split so only
the opcodes that should be found for a given mask is in the array.  This
also speeds up the search as you are not searching through values that
cannot match.  The small groups of opcodes for a couple of the masks are
now done in a case statement as that is probably faster then doing an array
look up.

Bugzilla 148000

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

8 years agoAllow early writeback of SP base register in "strd rD, [sp, #-16]" so
Julian Seward [Wed, 19 Oct 2016 16:57:11 +0000 (16:57 +0000)] 
Allow early writeback of SP base register in "strd rD, [sp, #-16]" so
as to avoid Memcheck complaining about writes below SP.  Previously
this was allowed only for the #-8 case.  n-i-bz.

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

8 years agoCVTPI2PS: Only switch to MMX mode if the source is a MMX register.
Julian Seward [Wed, 19 Oct 2016 16:01:01 +0000 (16:01 +0000)] 
CVTPI2PS: Only switch to MMX mode if the source is a MMX register.
(for both x86 and amd64 front ends)
Fixes #357059.

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

8 years agoAccept redundant REX prefixes for {minsd,maxsd} m128, xmm. Fixes #357932.
Julian Seward [Wed, 19 Oct 2016 15:37:54 +0000 (15:37 +0000)] 
Accept redundant REX prefixes for {minsd,maxsd} m128, xmm.  Fixes #357932.
Patch from axel.carl.mueller@gmail.com.

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

8 years agoFix two cases of PPCAvFpOp vs PPCFpOp enum confusion, as spotted
Julian Seward [Wed, 19 Oct 2016 07:41:35 +0000 (07:41 +0000)] 
Fix two cases of PPCAvFpOp vs PPCFpOp enum confusion, as spotted
by Clang-3.8.

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

8 years agoFix incorrect register-number constraint check for LDAEX{,B,H,D}
Julian Seward [Wed, 19 Oct 2016 07:39:22 +0000 (07:39 +0000)] 
Fix incorrect register-number constraint check for LDAEX{,B,H,D}
introduced in r3248.  Spotted by Clang-3.8.

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

8 years ago Fix PPC BE in 32-bit mode.
Carl Love [Tue, 18 Oct 2016 15:52:09 +0000 (15:52 +0000)] 
 Fix PPC BE in 32-bit mode.

The 64-bit compares are not supported in 32-bit mode.  Change the 64-bit
compares to 32-bit compares when doing byte compares.  Add routine for
doing V128 GT compare using 32-bit compares.

The clean caller support was missing for 32-bit mode

Update the expected output file jm_vec_isa_2_07.stdout.exp

Bugzilla 371128

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

8 years agomips64: fix error introduced by r3262
Petar Jovanovic [Thu, 13 Oct 2016 13:53:50 +0000 (13:53 +0000)] 
mips64: fix error introduced by r3262

There was a typo in r3262 that caused a regression in the following two
tests:

none/tests/mips64/load_store_unaligned   (stdout)
none/tests/mips64/load_store_unaligned   (stderr)

This change fixes it.

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

8 years agomips: fix incorrect implementation of luxc1/suxc1 instructions
Petar Jovanovic [Wed, 12 Oct 2016 15:25:45 +0000 (15:25 +0000)] 
mips: fix incorrect implementation of luxc1/suxc1 instructions

Support correct execution of luxc1 and suxc1 instructions on MIPS32
and MIPS64 platforms with the respect for FPU mode.

Patch by Aleksandra Karadzic.

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

8 years agomips: allow VEX to be compiled for soft-float
Petar Jovanovic [Wed, 12 Oct 2016 15:02:10 +0000 (15:02 +0000)] 
mips: allow VEX to be compiled for soft-float

Force "hardfloat" mode for inline assembly that uses FPU instructions,
but pop original mode at the end of the assembly.

This should allow Valgrind to be compiled as a soft-float binary, but
that executable should be used for soft-float systems only.

Related issue - BZ#351282.

Patch by Aleksandar Rikalo.

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

8 years agoISA 3.0 BE fixes for various new instructions
Carl Love [Fri, 7 Oct 2016 22:53:52 +0000 (22:53 +0000)] 
ISA 3.0 BE fixes for various new instructions

This is an additional commit to fix issues found with the
new Power ISA 3.0 instructions for BE mode.  The instructions
fixed in this patch include: lxvl, lxvx, lxvwsx, lxvh8x, lxvh16x,
stxvx, stxvh8x, stxvh16x, lxsibzx, lxsihzx, xscvqpdp, xscvqpdp0,
xvcvsphp.

Bugzilla 369175

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

8 years agos390: support RISBLG/RISBHG, MVCIN, LDE/LDER
Christian Borntraeger [Fri, 7 Oct 2016 07:07:10 +0000 (07:07 +0000)] 
s390: support RISBLG/RISBHG, MVCIN, LDE/LDER

patch by Andreas Arnez

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

8 years agomips: remove support for mfc0/dmfc0
Petar Jovanovic [Thu, 6 Oct 2016 13:54:12 +0000 (13:54 +0000)] 
mips: remove support for mfc0/dmfc0

Remove support for mfc0/dmfc0, as these instructions are privileged
instructions and Valgrind cannot execute these.

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

8 years agoRelax the overly-restrictive implementation of
Julian Seward [Thu, 6 Oct 2016 05:25:58 +0000 (05:25 +0000)] 
Relax the overly-restrictive implementation of

  (T3) SUB{S}.W Rd, Rn, Rm, {shift}

in the case where Rn=SP, to allow |shift| values of 0,1,2,3
instead of just 0.  Fixes #354274.  Patch from dimitry@google.com.

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

8 years agomips64: support for fp32 mode
Petar Jovanovic [Tue, 4 Oct 2016 14:27:18 +0000 (14:27 +0000)] 
mips64: support for fp32 mode

Support for FP32 emulation on MIPS64 platforms
(including prctl(GET/SET_FP_MODE) syscalls).

Patch by Aleksandar Rikalo.

Implements the remaining parts for BZ #366079.

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

8 years agoFix rounding mode check and instruction stxvl
Carl Love [Mon, 3 Oct 2016 15:30:46 +0000 (15:30 +0000)] 
Fix rounding mode check and instruction stxvl

In BE mode, the function FPU_rounding_mode_isOdd() has the assert
  vassert(mode->Iex.Const.con->Ico.U8 == 0x8);
The value was set using mkU32 but in BE mode the U8 maps to the upper
bits in the memory location not the lower bits.  The comparison was
fixed by changing the .U8 to .U32 to be consistent with how the field
was set.

The stxvl instruction called the 64-bit NOT not the 128-bit NOT when
calculating the store_val.

The stxvx instruction the temp word values were initialized I32 not I64.
Not sure why this wasn't caught on LE.

bugzilla  369175

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

8 years agoFix for clean helpers on BE
Carl Love [Mon, 3 Oct 2016 15:27:31 +0000 (15:27 +0000)] 
Fix for clean helpers on BE

This patch adds the missing fnptr_to_fnentry() wrapper call for the
clean helpers introduced in the ISA 3.0 support.

bugzilla  369175

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

8 years agoImplement AMD FMA4 instructions. Bug #369000.
Mark Wielaard [Mon, 19 Sep 2016 12:41:19 +0000 (12:41 +0000)] 
Implement AMD FMA4 instructions. Bug #369000.

Original patch by p4plus2@gmail.com.

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

8 years agoImplement arm32 v8 insns: LDAEX{,B,H,D}, STLEX{,B,H,D}
Julian Seward [Thu, 1 Sep 2016 13:08:10 +0000 (13:08 +0000)] 
Implement arm32 v8 insns: LDAEX{,B,H,D}, STLEX{,B,H,D}
(load-acquire exclusive, store-release exclusive)

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

8 years agoImplement ARMv8 insns: LDA, LDAB, LDAH, STL, STLB, STLH.
Julian Seward [Sun, 28 Aug 2016 16:16:27 +0000 (16:16 +0000)] 
Implement ARMv8 insns: LDA, LDAB, LDAH, STL, STLB, STLH.

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

8 years agoAdd a dummy initialisation and a dummy path to avoid warnings with gcc -Og.
Julian Seward [Fri, 19 Aug 2016 11:47:59 +0000 (11:47 +0000)] 
Add a dummy initialisation and a dummy path to avoid warnings with gcc -Og.
Neither are actually necessary, but gcc's flow analysis at -Og is weaker than
at -O or above and so it produces false warnings here.   No functional change.

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

8 years agoPower PC Add support for ISA 3.0, part 5, fix
Carl Love [Wed, 17 Aug 2016 00:28:33 +0000 (00:28 +0000)] 
Power PC Add support for ISA 3.0, part 5, fix

Fix for  the xscvdphp instruction added in vex commit 3244.

Bugzilla 364948

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

8 years agoPower PC Add support for ISA 3.0, part 5
Carl Love [Mon, 15 Aug 2016 21:53:20 +0000 (21:53 +0000)] 
Power PC Add support for ISA 3.0, part 5

Added support for the
cnttz, cnttz., cnttzd, cnttzd., vctzb, vctzh, vctzw,
vctzd, xscvhpdp, xscvdphp, xvcvhpsp, xvcvsphpv,
xsrqpi, xsrqpix, xsrqpxp, xsaddqp, xsaddqpo, xsmulqp,
xsmulqpo, xsmaddqp, xsmaddqpo, xsmsubqp, xsmsubqpo,
xsnmaddqp, xsnmaddqpo, xsnmsubqp, xsnmsubqpo, xssubqp,
xssubqpo, xsdivqp, xsdivqpo, xssqrtqp, xssqrtqpo,
xscvqpuwz, xscvudqp, xscvqpswz, xscvsdqp, xscvqpudz,
xscvqpdp, xscvqpdpo, xscvdpqp, xscvqpsdz, vmul10cuq,
vmul10ecuq, vmul10uq, vmul10euq, bcdctsq, bcdcfsq
instructions.

Most of these instructions required adding a new Iop as they could not
be emulated with existing Iops.  In some cases, some of the above instrctions
could be emulated using another instruction from the above list.

Most of the instructions add support for 128-bit instructions.  There are a
number of helper functions that check a values for zero, infinity, NaN, etc.
for various sizes.  The new 128-bit instructions require a new version of these
existing functions for a 128-bit operand.  Rather then adding another size
specific version of these functions, the existing size specific functions were
replaced with a single function that takes the size of operand to be operated
on.  There are some additional helper functions that are added to support
the size independent version of these functions.

Note this is the last of the 5 patches required to complete the ISA 3.0
support.

Bugzilla 364948

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

8 years agomips32: extend the current fp-mode code to support fpxx features
Petar Jovanovic [Wed, 10 Aug 2016 14:33:21 +0000 (14:33 +0000)] 
mips32: extend the current fp-mode code to support fpxx features

Part of the changes to support FPXX mode for MIPS32.

Patch by Aleksandar Rikalo <Aleksandar.Rikalo@imgtec.com>

Related issue BZ #366079.

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

8 years agoImplement VMULL.P64.
Julian Seward [Sun, 7 Aug 2016 23:33:48 +0000 (23:33 +0000)] 
Implement VMULL.P64.

dis_neon_data_3diff: don't mistakenly recognise VMULL.P64 as a plain
VMUL due to inadequate checking for the VMULL.P64 case.

Fix ARM decoding of SHA1SU1, SHA256SU0, SHA1H introduced in r3241.

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

8 years agoImplement SHA1C, SHA1M, SHA1P, SHA1SU0, SHA256H2, SHA256H, SHA256SU1,
Julian Seward [Sun, 7 Aug 2016 16:42:37 +0000 (16:42 +0000)] 
Implement SHA1C, SHA1M, SHA1P, SHA1SU0, SHA256H2, SHA256H, SHA256SU1,
SHA1H, SHA1SU1, SHA256SU0.

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

9 years agoFix UBSAN reported complaints about left shifts of signed values
Julian Seward [Sat, 6 Aug 2016 13:04:32 +0000 (13:04 +0000)] 
Fix UBSAN reported complaints about left shifts of signed values
in the arm32 front and back ends.

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

9 years agoReduce the number of IR sanity checks from 4 per block to 2 per block.
Julian Seward [Fri, 5 Aug 2016 15:02:48 +0000 (15:02 +0000)] 
Reduce the number of IR sanity checks from 4 per block to 2 per block.
Also relax assertion checking in the register allocator.

Together with valgrind r15927 this reduces per-block JITting cost by 10%-15%.

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

9 years agoFix two invalid signed left shifts picked up by ubsan.
Julian Seward [Fri, 5 Aug 2016 10:34:15 +0000 (10:34 +0000)] 
Fix two invalid signed left shifts picked up by ubsan.

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

9 years agoImplement CRC32{B,H,W,X} and CRC32C{B,H,W,X}. Fixes #366344.
Julian Seward [Thu, 4 Aug 2016 09:13:11 +0000 (09:13 +0000)] 
Implement CRC32{B,H,W,X} and CRC32C{B,H,W,X}.  Fixes #366344.

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

9 years ago* Add infrastructure for decoding (32-bit) ARMv8 instructions.
Julian Seward [Wed, 3 Aug 2016 11:55:33 +0000 (11:55 +0000)] 
* Add infrastructure for decoding (32-bit) ARMv8 instructions.

* Use this to implement AESE, AESD, AESMC, AESIMC.

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

9 years agoarm32 backend stuff needed to support IR artefacts resulting from
Julian Seward [Wed, 3 Aug 2016 11:53:11 +0000 (11:53 +0000)] 
arm32 backend stuff needed to support IR artefacts resulting from
guest support of 32-bit V8 crypto instructions:

* add new pseudo-instruction ARMin_VXferQ, to move values between
  two D regs and a Q reg, in either direction.  Use this to implement
  Iop_64HLtoV128 much more efficiently than before, and to implement
  Iop_V128HIto64 and Iop_V128to64.

* Generate code for helper calls in which have four or more
  (32-bit) word-sized arguments and a V128 return value.
  These require passing arguments on the stack.

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

9 years agoAdd infrastructure for detection of 32-bit ARMv8 capable CPUs (VEX side).
Julian Seward [Wed, 3 Aug 2016 11:41:24 +0000 (11:41 +0000)] 
Add infrastructure for detection of 32-bit ARMv8 capable CPUs (VEX side).

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

9 years agodis_neon_data_3same: for the case A==12, don't silently produce invalid IR
Julian Seward [Thu, 28 Jul 2016 08:23:37 +0000 (08:23 +0000)] 
dis_neon_data_3same: for the case A==12, don't silently produce invalid IR
which then causes the sanity checker to abort the run.  Instead synthesise
a SIGILL in the normal way.

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

9 years agoImplement PMULL 1q,1d,1d and PMULL2 1q,2d,2d. n-i-bz.
Julian Seward [Sun, 24 Jul 2016 18:58:21 +0000 (18:58 +0000)] 
Implement PMULL 1q,1d,1d and PMULL2 1q,2d,2d.  n-i-bz.

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

9 years agoFix grammatically nonsensical comments. No functional change.
Julian Seward [Sun, 24 Jul 2016 16:56:22 +0000 (16:56 +0000)] 
Fix grammatically nonsensical comments.  No functional change.

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

9 years agoEnable PCMPxSTRx cases 0x62 and 0x72, and reformat the associated
Julian Seward [Sun, 24 Jul 2016 11:40:07 +0000 (11:40 +0000)] 
Enable PCMPxSTRx cases 0x62 and 0x72, and reformat the associated
switch statements a bit more consistently.  Fixes #353384 and #353727.

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