1405 Commits

Author SHA1 Message Date
Mark Wielaard
a0d97e88ec Bug 401822 Fix asm constraints for ppc64 jm-vmx jm-insns.c test.
The mfvscr and vor instructions in jm-insns.c had a "=vr" constraint.
This should have been an "=v" constraint. This resolved assembler
warnings and the testcase failing on ppc64le with gcc 8.2 and
binutils 2.30.
2018-12-06 20:52:36 +01:00
Vadim Barkov
86bd889458 Bug 385411 s390x: Tests and internals for z13 vector FP support
Add test cases for the z13 vector FP support.  Bring s390-opcodes.csv
up-to-date, reflecting that the z13 vector instructions are now supported.
Also remove the non-support disclaimer for the vector facility from
README.s390.

The patch was contributed by Vadim Barkov, with some clean-up and minor
adjustments by Andreas Arnez.
2018-11-30 14:29:39 +01:00
Philippe Waroquiers
66b5a4e9c4 Fix 399301 - Use inlined frames in Massif XTree output.
Author: Nicholas Nethercote <nnethercote@mozilla.com>

Use inlined frames in Massif XTree output.

    This makes Massif's output much easier to follow.

    The commit also removes a -1 used on all Massif stack frame addresses.
    There was a big comment questioning the presence of that -1, and with it
    gone the addresses now match those produced by DHAT.
2018-10-27 20:28:59 +02:00
Andreas Arnez
0a1d523a87 s390x: Vector integer and string insn support -- tests
This adds test cases and some internal stuff to the z/Architecture vector
integer and string instruction support.

Contributed by Vadim Barkov <vbrkov@gmail.com>.
2018-09-26 19:31:02 +02:00
Andreas Arnez
20976f432d s390x: Implement conditional trap instructions
This implements various z/Architecture instructions that conditionally
yield a data exception ("trap").  The condition is either based on a
comparison being true ("compare and trap") or on a loaded value being
zero ("load and trap").  These instructions haven't been widely used in
the past, but may now be emitted by newer compilers.  Note that the
resulting signal for a data exception is SIGFPE, not SIGTRAP.  Thus this
patch also adds a new jump kind Ijk_SigFPE.
2018-09-24 16:06:19 +02:00
Mark Wielaard
4f5e6168e7 Add noinst_HEADERS = vector.h to none/tests/s390x/Makefile.am.
The vector.h file should end up in the dist tar.
2018-09-15 00:00:20 +02:00
Julian Seward
529436ff59 Bug 397089 - (TESTCASES FOR) Incorrect decoding of three-register vmovss/vmovsd opcode 11h.
Adds test cases, that check both the 10h and 11h decodings.  For some reason
the expected output diff is huge.  I don't know why.  It is the same as what
the hardware produces, though.
2018-09-14 13:23:19 +02:00
Petar Jovanovic
65cc712d0a mips: skip MSA tests for the secondary target
No need for MSA tests for the secondary target. This change removes
build warnings present with the secondary target.
2018-08-23 13:16:10 +00:00
Julian Seward
d44563c49e Bug 385412 - s390x: new non-vector z13 instructions not implemented
Apart from instructions with vector operands, Valgrind does not implement the
additional z/Architecture instructions introduced with z13.

These are:
- load and zero rightmost byte (LZRF, LZRG);
- load logical and zero rightmost byte (LLZRGF);
- load halfword high immediate on condition (LOCHHI);
- load halfword immediate on condition (LOCHI, LOCGHI);
- load high on condition (LOCFHR, LOCFH);
- store high on condition (STOCFH);
- perform pseudorandom number operation (PPNO), with the functions
  PPNO-Query and PPNO-SHA-512-DRNG;
- load count to block boundary (LCBB).

Patches from Vadim Barkov (vbrkov@gmail.com), with coordination, testing
and format cleanups from Andreas Arnez (arnez@linux.ibm.com).
2018-07-24 10:10:40 +02:00
Julian Seward
53cf5739b3 Fix the test VPCMPESTRM_0x45_128 so that it doesn't depend on random junk in RAX and RDX.
This test fails sporadically (eg, on Fedora 27 with gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5))
because the tested instruction uses RAX and RDX as input, but the test framework doesn't
set them :-/, so the outcome basically depends on whatever junk the compiler left in those
registers beforehand.  As a result of this, all previous uses of RAX in the test have
been changed to use RSI instead.  n-i-bz.
2018-07-23 14:52:19 +02:00
Carl Love
3df8d81f00 PPC32, update expected results for jm_vec_isa_2_07.c.
Add missing mtvsrwa, mtfprd, mtvrwa, mtvrd results.

Signed-off-by: Carl Love <carll@us.ibm.com>
2018-06-26 09:51:44 -05:00
Carl Love
1f69ed86e9 Fix ppc32 results for test_isa_2_06_part3.c.
The ppc32 results were not updated when the xvnegsp instruction support
was added.  Add the xvnegsp 32-bit results to
ppc/test_isa_2_06_part3.stdout.exp.

Signed-off-by: Carl Love <carll@us.ibm.com>
2018-06-26 09:46:26 -05:00
Carl Love
9c5d762904 PPC64, add support for the xvnegsp instruction. Add test case for the instruction.
https://bugs.kde.org/show_bug.cgi?id=395709

Signed-off-by: Carl Love <carll@us.ibm.com>
2018-06-21 17:27:40 -05:00
Mark Wielaard
c76123d32c none/tests/linux/membarrier.vgtest: Only execute if membarrier exists. 2018-06-16 23:25:48 +02:00
Mark Wielaard
7f4e06881c none/tests/linux/Makefile.am: Fix membarrier.st[d]err.exp typo. 2018-06-16 23:02:39 +02:00
Bart Van Assche
e9a82f3d75 Add a test program for the membarrier() system call
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-06-15 08:25:32 -07:00
Petar Jovanovic
58c1c98db4 mips64: update tests for N32 ABI
Fix n32/n64 types mismatch in none, memcheck and helgrind tests.

BZ issue - #345763.

Contributed by:
  Dimitrije Nikolic, Aleksandar Rikalo, Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Carl Love
1f08787cfa Fix 393017 - Add missing support for xsmaxcdp instruction, bug fixes for xsm
Missed the update to none/tests/ppc64/Makefile.am to remove the
expected output files test_isa_3_0_altivec.stdout.exp and
test_isa_3_0_other.stdout.exp.
2018-04-11 14:03:29 -05:00
Carl Love
d09b3b740c Fix 393017 - Add missing support for xsmaxcdp instruction, bug fixes for xsmincdp, lxssp, stxssp and stxvl instructions.
Add support for instruction xsmaxcdp in VEX/priv/guest_ppc_toIR.c.

Fixes in file VEX/priv/guest_ppc_toIR.c for xsmaxcdp, xsmincdp, lxssp,
stxssp and stxvl instructions.

Fix compiler issues with optimization option -O2 for test
none/tests/ppc64/test_isa_3_0.c.

Add test case test_xsmaxcdpi to test file none/tests/ppc64/test_isa_3_0.c.

Fixes to test none/tests/ppc64/test_isa_3_0.c for compiling inline functions
with optimization -O0.  Assembly instruction fixes, test argument array size
fixes, max loop index fixes. Condition code register fixes to fix control
flow issues when compiled with optimization.

Update expected results for test_isa_3_0_altivec.stdout.exp-LE and
test_isa_3_0_other.stdout.exp-LE.
2018-04-11 13:06:42 -05:00
Philippe Waroquiers
54145019b0 n-i-bz Fix possible stack trashing by semctl syscall wrapping
The modified test none/tests/sem crashes with a SEGV when valgrind is compiled
with lto on various amd64 platforms (debian/gcc 6.3, RHEL7/gcc 6.4,
Ubuntu/gcc 7.2)

The problem is that the vki_semid_ds buf is not what is expected by the kernel:
the kernel expects a bigger structure vki_semid64_ds (at least on
these platforms).
Getting the sem_nsems seems to work by chance, as sem_nsems is at
the same offset in both vki_semid_ds and vki_semid64_ds.
However, e.g. the ctime was not set properly after syscall return,
and 2 words after sem_nsems were set to 0 by the kernel, causing
the SEGV, as a spilled register became 0.

Fix consists in using the 64 bit version for __NR_semctl.
Tested on debian/amd64 and s390x.
2018-04-01 14:31:40 +02:00
Philippe Waroquiers
ab773096df Fix 338252 - building valgrind with -flto (link time optimisation) fails
* Addition of a new configure option --enable-lto=yes or --enable-lto=no
  Default value is --enable-lto=no, as the build is significantly slower,
  so is not appropriate for valgrind development : this should be used
  only on buildbots and/or by packagers.

* Some files containins asm functions have to be compiled without lto:
    coregrind/m_libcsetjmp.c
    coregrind/m_main.c
  If these are compiled with lto, that gives undefined symbols at link time.
  The files to compile without lto are
    coregrind/m_libcsetjmp.c
    coregrind/m_main.c

  To compile these files with other options, a noinst target lib is defined.
  The objects of this library are then added to the libcoregrind.

* memcheck/mc_main.c : move the handwritten asm helpers to mc_main_asm.c.
  This avoids undefined symbols on some toolchains. Due to this,
  the preprocessor symbols that activate the fast or asm memcheck helpers
  are moved to mc_include.h
  Platforms with handwritten helpers will also have the memcheck primary
  map defined non static.

* In VEX, auxprogs/genoffsets.c also has to be compiled without lto,
  as the asm produced by the compiler is post-processed to produce
  pub/libvex_guest_offsets.h. lto not producing asm means the generation
  fails if we used -flto to compile this file.

* all the various Makefile*am are modified to use LTO_CFLAGS for
  (most) targets. LTO_CFLAGS is empty when --enable-lto=no,
  otherwise is set to the flags needed for gcc.
  If --enable-lto=no, LTO_AR and LTO_RANLIB are the standard AR and RANLIB,
  otherwise they are the lto capable versions (gcc-ar and gcc-ranlib).

* This has been tested on:
    debian 9.4/gcc 6.3.0/amd64+x86
    rhel 7.4/gcc 6.4.0/amd64
    ubuntu 17.10/gcc 7.2.0/amd64+x86
    fedora26/gcc 7.3.1/s390x

  No regressions on the above.
2018-03-18 13:53:38 +01:00
Carl Love
839b244af2 PPC64, Fix tests for mtvsrwa and mtfprd.
Fix the register constraints for the vtvsrwa and mtfprd instructions
in test_isa_2_07_part2.c.  Update the expected output in
none/tests/jm_vec_isa_2_07.stdout.exp.
2018-03-01 13:57:47 -06:00
Carl Love
9afb136f59 PPC64, Missing tests for mtvsrwa, mtvrwa, mtvrd, and mtfprd.
Add the missing tests to none/tests/ppc64/test_isa_2_07_part1.c.  Update the
expected output file with the new test outputs.
2018-02-27 18:39:33 -06:00
Carl Love
03c9736086 Bug 391164: constraint bug in tests/ppc64/test_isa_2_07_part1.c for mtfprwa
Fix destination register constraint in assembly code in function
test_mtfprwa in file none/tests/ppc64/test_isa_2_07_part1.c.  Constraint
changed from "=ws" to "=d".
2018-02-27 12:41:43 -06:00
Julian Seward
5e8c986b20 amd64: implement PCMPxSTRx case 0x41. This is generated by recent MSVCs. n-i-bz. 2018-02-06 15:19:24 +01:00
Petar Jovanovic
9fc2bfba5c mips: add tests for mips32/mips64 R6
This set of tests covers MIPS r6 specific instructions:

  none/tests/mips32/MIPS32r6int
  none/tests/mips32/branch_pc
  none/tests/mips32/branches_r6
  none/tests/mips32/fp_r6
  none/tests/mips32/pc_instructions_r6

  none/tests/mips64/MIPS64r6int
  none/tests/mips64/branch_pc
  none/tests/mips64/branches_r6
  none/tests/mips64/fp_r6
  none/tests/mips64/pc_instructions_r6
  none/tests/mips64/r6_instructions

The following tests had to be changed to be applicaple for Rev6:

  none/tests/libvex_test.c

  none/tests/mips32/LoadStore
  none/tests/mips32/LoadStore1
  none/tests/mips32/MIPS32int
  none/tests/mips32/MoveIns
  none/tests/mips32/branches
  none/tests/mips32/change_fp_mode
  none/tests/mips32/mips32_dsp
  none/tests/mips32/vfp

  none/tests/mips64/arithmetic_instruction
  none/tests/mips64/branches
  none/tests/mips64/fpu_arithmetic
  none/tests/mips64/fpu_load_store
  none/tests/mips64/load_store
  none/tests/mips64/load_store_multiple
  none/tests/mips64/move_instructions

The following tests are not applicable for Rev6:

  none/tests/mips32/fpu_branches
  none/tests/mips32/unaligned_load_store

  none/tests/mips64/branch_and_jump_instructions
  none/tests/mips64/change_fp_mode
  none/tests/mips64/fpu_branches
  none/tests/mips64/load_store_unaligned
  none/tests/mips64/unaligned_load
  none/tests/mips64/unaligned_load_store.

Contributed by:
  Tamara Vlahovic, Aleksandar Rikalo and Aleksandra Karadzic.

Related BZ issue - #387410.
2018-02-01 18:37:28 +01:00
Ivo Raisr
bd077baa71 Add a simple progress-reporting facility.
Fixes BZ#384633.
Patch by: Julian Seward <jseward@acm.org>
2018-01-20 19:56:02 +00:00
Mark Wielaard
ea1c229392 Remove all extra -std=c99 flags from Makefiles.
Configure now makes sure we build everything in c99 mode already.
No need to have extra special cases in the Makefiles.
2018-01-19 13:52:29 +01:00
Julian Seward
cceed053ce Bug 79362 - Debug info is lost for .so files when they are dlclose'd. Majorly reworked by Philippe Waroquiers. 2018-01-11 19:40:12 +01:00
Julian Seward
f1a49eeb42 Bug 385408 - s390x: z13 vector "support" instructions not implemented. Patch from Vadim Barkov (vbrkov@gmail.com).
(from bug 385408 comment 0):
Valgrind currently lacks support for the z/Architecture vector "support"
instructions introduced with z13.  These are documented in the
z/Architecture Principles of Operation, Eleventh Edition (March, 2015),
chapter 21: "Vector Overview and Support Instructions".
2018-01-11 18:20:27 +01:00
Ivo Raisr
c46053cc38 Optionally exit on the first error with --exit-on-first-error=<yes|no>.
Fixes BZ#385939.
Slightly modified patch by: Fauchet Gauthier <gauthier.fauchet@free.fr>
2017-11-04 14:31:22 +01:00
Petar Jovanovic
95038d380d mips: finetune tests that print FCSR
Bits 18 (NAN2008) and 19 (ABS2008) in FCSR are preset by hardware and can
differ between platforms. Hence, we should clear these bits before printing
FCSR value in order to have the same output on different platforms.

This fixes several failures (tests modified by this change) that occur on
MIPS P5600 board. The P5600 is a core that implements MIPS32 Release 5 arch.
2017-11-03 19:11:36 +01:00
Petar Jovanovic
0e1fa562e9 mips: MSA tests
This set of tests covers the whole MSA instruction set:

  none/tests/mips32/msa_arithmetic
  none/tests/mips32/msa_comparison
  none/tests/mips32/msa_data_transfer
  none/tests/mips32/msa_fpu
  none/tests/mips32/msa_logical_and_shift
  none/tests/mips32/msa_shuffle

  none/tests/mips64/msa_arithmetic         (symlink to mips32)
  none/tests/mips64/msa_comparison         (symlink to mips32)
  none/tests/mips64/msa_data_transfer
  none/tests/mips64/msa_fpu                (symlink to mips32)
  none/tests/mips64/msa_logical_and_shift  (symlink to mips32)
  none/tests/mips64/msa_shuffle            (symlink to mips32)

Contributed by:
  Tamara Vlahovic, Aleksandar Rikalo and Aleksandra Karadzic.

Related BZ issue - #382563.
2017-10-27 16:27:25 +02:00
Mark Wielaard
476b52d62d Bug #385912. Remove explicit NULL check from none/tests/rlimit_nofile.
glibc doesn't guarantee anything about setrlimit with a NULL limit argument.
It could just crash (if it needs to adjust the limit) or might silently
succeed (as newer glibc do). Just remove the extra check.

See also the "setrlimit change to prlimit change in behavior" thread:
https://sourceware.org/ml/libc-alpha/2017-10/threads.html#00830
2017-10-20 14:55:06 +02:00
Carl Love
5398a9f9cb PPC64, Add support for xscmpeqdp, xscmpgtdp, xscmpgedp, xsmincdp instructions.
These are Power 9 instructions.

Add test cases for the new instructions to test_isa_3_0.c

Bugzilla 385183.
2017-10-04 10:24:36 -05:00
Philippe Waroquiers
4adbae3559 Add a .exp file for the dash version in Debian 9
Add shell.stderr.exp-dash3, which differs from shell.stderr.exp-dash2 with:

6c6
< ./shell_binaryfile: 4: ./shell_binaryfile: Syntax error: ")" unexpected
---
> ./shell: 19: ./shell: ./shell_binaryfile: Exec format error

(so the newer dash gives a clearer msg)
2017-09-27 18:29:58 +02:00
Petar Jovanovic
e4f2fdfa4b mips: finetune none/tests/(mips32|64)/test_math test
Compiler may optimize out call to cbrt. Change test to prevent that.
Otherwise, the test does not exercise a desired codepath for cbrt, and it
prints precalculated value.
2017-09-15 18:29:29 +02:00
Tom Hughes
4c8c3af18a Fix eflags handling in amd64 instruction tests
In 64 bit mode there's no way to just save eflags so we save the
whole of rflags but we were doing so to a 32 bit variable!

Replace that with proper rflags support that knows it is dealing
with the full 64 bit flags word in 64 bit mode.
2017-08-30 19:26:37 +01:00
Ivo Raisr
efa1e5ef8d VEX register allocator version 3.
Implements a new version of VEX register allocator which
keeps the main state per virtual registers, as opposed
to real registers in v2. This results in a simpler and
cleaner design and much simpler implementation.
It has been observed that the new allocator executes 20-30%
faster than the previous one but could produce slightly worse
spilling decisions. Overall performance improvement when running
the Valgrind performance regression test suite has been observed
in terms of a few percent.

The new register allocator (v3) is now the default one.
The old register allocator (v2) is still kept around and can be
activated with command line option '--vex-regalloc-version=2'.

Fixes BZ#381553.
2017-08-28 12:40:17 +02:00
Petar Jovanovic
b343cc638a mips32: finetune vfp test to avoid compiler warnings
This patch removes two compiler warnings from the test:

vfp.c: In function 'handler':
vfp.c:260:4: warning: implicit declaration of function 'exit'
[-Wimplicit-function-declaration]
    exit(0);
    ^
vfp.c:260:4: warning: incompatible implicit declaration of built-in
function 'exit'
vfp.c: At top level:
vfp.c:258:13: warning: 'handler' defined but not used [-Wunused-function]
 static void handler(int sig)
             ^
2017-08-17 20:08:17 +02:00
Mark Wielaard
9160ea1ad5 ppc64 doesn't compile test_isa_2_06_partx.c without VSX support
The #ifdef HAS_VSX guard is wrongly placed. It makes the standard
include headers not be used. Causing a build failure. Fix by moving
the #ifdef HAS_VSX after the standard includes.

https://bugs.kde.org/show_bug.cgi?id=381272

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16450
2017-06-16 09:33:35 +00:00
Ivo Raisr
9ae62b13c5 Connect also 32-bit cet_nops tests.
Pertains to BZ#379525.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16423
2017-05-31 12:36:26 +00:00
Ivo Raisr
268a4e7f17 Connect cet_nops test cases with other OSes:
- with fs prefix for Solaris
- with gs prefix for OS X (Darwin)
Pertains to BZ#379525.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16422
2017-05-31 11:22:06 +00:00
Ivo Raisr
f6cef80eaf Split test cases from none/tests/amd64/cet_nops
into three different files with regards to using
fs prefix, gs prefix or no fs/gs prefix.
Pertains to BZ#379525.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16421
2017-05-31 06:19:50 +00:00
Julian Seward
12dc16730d Add test cases for x86 CET nops. Pertains to #379525.
Test case from tatyana.a.mineeva@intel.com.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16415
2017-05-24 14:29:41 +00:00
Ivo Raisr
f8a8e3de4d Fix expected output of brk tests after r16407.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16410
2017-05-23 21:22:31 +00:00
Ivo Raisr
074e6ce5b9 Fix expected output of none/tests/cmdline{1,2}.
Follow up to r16406.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16409
2017-05-23 09:13:31 +00:00
Philippe Waroquiers
f2ede90cbb Compile fb_test_amd64 only if adx instructions can be compiled
Note: this just unbreaks the build on avx + non_adx capable systems
(such as gcc farm gcc20).

adx capable system should probably be better handled:
  * ./tests/x86_amd64_features cannot check for adx flag
    (so fb_test_amd64 is run if compiled and system is avx capable, which
     might give problems if gcc/as can compile the test, but the cpu
     cannot execute adx instructions)
  * on an adx capable system, a native run of cpuid tells it is adx capable
    but under valgrind, cpuid reports the valgrind synthetic cpu is not adx
    capable.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16401
2017-05-20 14:59:54 +00:00
Petar Jovanovic
e1daabf714 mips32: fix wrong register use
Fix wrong register use in none/tests/mips32/MoveIns.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16399
2017-05-19 13:25:41 +00:00
Carl Love
13cfe17203 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, VEX commit 3375


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16396
2017-05-17 20:11:32 +00:00