1528 Commits

Author SHA1 Message Date
Paul Floyd
49fe0dc74a Anticipate testcase problems with GCC 12
There will be a lot more to come.

On amd64 Linux
In faultstatus was seeing the division by zero and emitting a ud2 opcode.
In wrap3 a pair of mutually recursive functions were being inlined.
When forced not to be inlined GCC merged them into a single function.
It cannot see that the client requests have diffeent behaviour.
2021-11-23 23:37:02 +01:00
Paul Floyd
83dda2b71a Bug 444925 fexecve syscall wrapper not properly implemented
Implement fexecve and a few testcases on FreeBSD.
2021-11-14 22:06:14 +01:00
Julian Seward
0d38ca5dd6 Bug 444399 - disInstr(arm64): unhandled instruction 0xC87F2D89 (LD{,A}XP and ST{,L}XP). FOLLOWUP FIX.
This is an attempt to un-break 'make dist', as broken by the main commit for
this bug, which was 530df882b8f60ecacaf2b9b8a719f7ea1c1d1650.
2021-11-12 13:08:45 +01:00
Julian Seward
530df882b8 Bug 444399 - disInstr(arm64): unhandled instruction 0xC87F2D89 (LD{,A}XP and ST{,L}XP).
This is unfortunately a big and complex patch, to implement LD{,A}XP and
ST{,L}XP.  These were omitted from the original AArch64 v8.0 implementation
for unknown reasons.

(Background) the patch is made significantly more complex because for AArch64
we actually have two implementations of the underlying
Load-Linked/Store-Conditional (LL/SC) machinery: a "primary" implementation,
which translates LL/SC more or less directly into IR and re-emits them at the
back end, and a "fallback" implementation that implements LL/SC "manually", by
taking advantage of the fact that V serialises thread execution, so we can
"implement" LL/SC by simulating a reservation using fields LLSC_* in the guest
state, and invalidating the reservation at every thread switch.

(Background) the fallback scheme is needed because the primary scheme is in
violation of the ARMv8 semantics in that it can (easily) introduce extra
memory references between the LL and SC, hence on some hardware causing the
reservation to always fail and so the simulated program to wind up looping
forever.

For these instructions, big picture:

* for the primary implementation, we take advantage of the fact that
  IRStmt_LLSC allows I128 bit transactions to be represented.  Hence we bundle
  up the two 64-bit data elements into an I128 (or vice versa) and present a
  single I128-typed IRStmt_LLSC in the IR.  In the backend, those are
  re-emitted as LDXP/STXP respectively.  For LL/SC on 32-bit register pairs,
  that bundling produces a single 64-bit item, and so the existing LL/SC
  backend machinery handles it.  The effect is that a doubleword 32-bit LL/SC
  in the front end translates into a single 64-bit LL/SC in the back end.
  Overall, though, the implementation is straightforward.

* for the fallback implementation, it is necessary to extend the guest state
  field `guest_LLSC_DATA` to represent a 128-bit transaction, by splitting it
  into _DATA_LO64 and DATA_HI64.  Then, the implementation is an exact
  analogue of the fallback implementation for single-word LL/SC.  It takes
  advantage of the fact that the backend already supports 128-bit CAS, as
  fixed in bug 445354.  As with the primary implementation, doubleword 32-bit
  LL/SC is bundled into a single 64-bit transaction.

Detailed changes:

* new arm64 guest state fields LLSC_DATA_LO64/LLSC_DATA_LO64 to replace
  guest_LLSC_DATA

* (ridealong fix) arm64 front end: a fix to a minor and harmless decoding bug
  for the single-word LDX/STX case.

* arm64 front end: IR generation for LD{,A}XP/ST{,L}XP: tedious and
  longwinded, but per comments above, an exact(ish) analogue of the singleword
  case

* arm64 backend: new insns ARM64Instr_LdrEXP / ARM64Instr_StrEXP to wrap up 2
  x 64 exclusive loads/stores.  Per comments above, there's no need to handle
  the 2 x 32 case.

* arm64 isel: translate I128-typed IRStmt_LLSC into the above two insns

* arm64 isel: some auxiliary bits and pieces needed to handle I128 values;
  this is standard doubleword isel stuff

* arm64 isel: (ridealong fix): Ist_CAS: check for endianness of the CAS!

* arm64 isel: (ridealong) a couple of formatting fixes

* IR infrastructure: add support for I128 constants, done the same as V128
  constants

* memcheck: handle shadow loads and stores for I128 values

* testcase: memcheck/tests/atomic_incs.c: on arm64, also test 128-bit atomic
  addition, to check we really have atomicity right

* testcase: new test none/tests/arm64/ldxp_stxp.c, tests operation but not
  atomicity.  (Smoke test).
2021-11-12 12:13:45 +01:00
Carl Love
3950c5d661 Valgrind Add powerpc R=1 tests
Contributed by Will Schmidt <will_schmidt@vnet.ibm.com>

This includes updates and adjustments as suggested by Carl.

Add tests that exercise PCRelative instructions.
These instructions are encoded with R==1, which indicate that
the memory accessed by the instruction is at a location
relative to the currently executing instruction.

These tests are built using -Wl,-text and -Wl,-bss
options to ensure the location of the target array is at a
location with a specific offset from the currently
executing instruction.

The write instructions are aimed at a large buffer in
the bss section; which is checked for updates at the
completion of each test.

In order to ensure consistent output across assorted
systems, the tests have been padded with ori, nop instructions
and align directives.

Detailed changes:
 * Makefile.am: Add test_isa_3_1_R1_RT and test_isa_3_1_R1_XT tests.
 * isa_3_1_helpers.h: Add identify_instruction_by_func_name() helper function
   to indicate if the test is for R==1.
   Add helpers to initialize and print changes to the pcrelative_write_target
   array.
   Add #define to help pad code with a series of eyecatcher ORI instructions.
     * test_isa_3_1_R1_RT.c: New test.
     * test_isa_3_1_R1_XT.c: New test.
     * test_isa_3_1_R1_XT.stdout.exp: New expected output.
     * test_isa_3_1_R1_XT.stdout.exp: New expected output.
     * test_isa_3_1_R1_RT.stderr.exp: New expected output.
     * test_isa_3_1_R1_RT.stderr.exp: New expected output.

     * test_isa_3_1_R1_RT.vgtest: New test handler.
     * test_isa_3_1_R1_XT.vgtest: New test handler.

     * test_isa_3_1_common.c: Add indicators (updates_byte,updates_halfword,
       updates_word) indicators to control the output from the R==1 tests.
       Add helper check for "_R1" to indicate if instruction is coded with R==1.
       Add init and print helpers for the pcrelative_write_target array.
2021-11-02 11:07:37 -05:00
Andreas Arnez
b77dbefe72 Bug 444242 - s390x: Sign-extend "relative long" offset in EXRL
In s390_irgen_EXRL, the offset is zero-extended instead of sign-extended,
typically causing Valgrind to crash when a negative offset occurs.

Fix this with a new helper function that calculates a "relative long"
address from a 32-bit offset.  Replace other calculations of "relative
long" addresses by invocations of this function as well.  And for
consistency, do the same with "relative" (short) addresses.
2021-10-28 15:08:20 +02:00
Paul Floyd
8c0f72667e Fix the ramaining easily fixable warnings with clang
There's one remaining
memalign2.c:29:9: warning: unused variable 'piece' [-Wunused-variable]
because of a block of #if FreeBSD for memalign that looks unnecessary

Otherwise all that is left is a few like

warning: unknown warning option '-Wno-alloc-size-larger-than'; did you mean '-Wno-frame-larger-than='? [-Wunknown-warning-option]

because there is no standard for compiler arguments.
2021-10-10 21:56:49 +02:00
Paul Floyd
03f1c090f6 Remove a couple more warnings
suffix rule with dependency generates a warning
https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
(bottom of page)

the other is a short initialized with an int literal that wraps to
a negative short value
2021-10-10 20:32:44 +02:00
Mark Wielaard
4015813336 Remove some warnings from tests
Various tests do things which we want to detect at runtime, like
ignoring the result of malloc or doing a deliberate impossibly large
allocation or operations that would result in overflowing or
truncated strings, that generate a warning from gcc.

In once case, mq_setattr called with new and old attrs overlapping,
this was explicitly fixed, in others -Wno-foobar was added to silence
the warning. This is safe even for older gcc, since a compiler will
ignore any -Wno-foobar they don't know about - since they do know they
won't warn for foobar.
2021-10-10 15:56:50 +02:00
Paul Floyd
53dd9bd255 FreeBSD support, patch 9
cachegrind callgrind dhat exp-bbv gdbserver_tests massif none mpi shared

Mostly these are just updates (and new testcases) under new/tests
The other directories have just #ifdef changes
2021-10-07 22:41:22 +02:00
Mark Wielaard
f22758d6da Fix make distcheck by removing references to uncommitted files
Some files for the freebsd port have not yet committed, but were
already referenced in the Makefiles. Remove those references for
now to make distcheck happy.

	* coregrind/Makefile.am (valgrind_SOURCES): Remove
	launcher-freebsd.c
	* drd/tests/Makefile.am (check_PROGRAMS): Remove
	thread_name_freebsd.
	* none/tests/Makefile.am (SUBDIRS): Remove freebsd.
	(DIST_SUBDIRS): Likewise.
	* none/tests/freebsd/filter_stderr: Removed.
2021-10-07 13:43:19 +02:00
Paul Floyd
e2583c02a5 FreeBSD support, patch 2
Files in the root directory
Several Makefile.am files that have dependencies on FreeBSD autoconf
variables. Included a few new filter files to act as placeholders
to create new freebsd subdirectories.

Updated NEWS with the FreeBSD bugzilla items plus a couple of other
items fixed indirectly.
2021-10-07 08:18:47 +02:00
Andreas Arnez
bc78771b8b s390x: Add missing "cc" clobbers in test case inline asms
Some inline assemblies in various s390x test cases miss specifying the
condition code "cc" in the clobber list.  Although this has not actually
been seen to cause wrong code generation, it certainly might, so fix this.
2021-10-04 14:50:46 +02:00
Andreas Arnez
ebfbc95417 s390x: Fix compile warnings in test cases
Some GCC versions emit the following warnings for some s390x-specific test
cases:

   warning: listing the stack pointer register '15' in a clobber list is
   deprecated

   warning: this 'else' clause does not
   guard... [-Wmisleading-indentation] ...this statement, but...

Fix these.

Most of inline assemblies declaring r15 as clobbered do not actually
change its value.  Only in stmg_wrap() it becomes necessary to save and
restore r15.
2021-10-04 14:50:26 +02:00
Mark Wielaard
9f6b917af2 Add shell.stderr.exp-dash4 to none/tests/scripts/Makefile.am EXTRA_DIST 2021-10-02 10:29:44 +02:00
Mark Wielaard
ae3c1b9190 Add none/tests/scripts/shell.stderr.exp-dash4 for dash 0.5.11
dash 0.5.11 produces slightly different error messagess.
The new exp file is similar to shell.stderr.exp-dash3 but
with the extra (second) "shell: " output removed.
2021-10-01 22:27:57 +02:00
Carl Love
bcbfa9e900 fix compiler print format warnings in test_isa_3_0.c
GCC fixed the compiler warnings long long types.  Add explicit
casts so gcc will not generate compile warnings.
2021-09-30 18:12:33 -05:00
Carl Love
ef411515d9 Fix compiler warnings for subnormal_test.c
GCC fixed the compiler warnings long long types.  Add explicit
casts so gcc will not generate compile warnings.
2021-09-30 18:11:35 -05:00
Carl Love
9c22ad0024 Fixes for the lxvx and stxvx instructions
The lxvx and stxvx tests are moved into their own separate
tests.  Add the expec files for the new test.

Update the expected results for the altivec test.
2021-09-30 18:11:24 -05:00
Carl Love
f1d6dec601 Fix tests for mfspr
Split out the mfspr tests into a separate test using command line option
"-M".  The value in the LR and CTR registers changed.  It appears the
changes are due to changes in the test program jm-insns.c.  Splinting
these instructions out will help to minimize the size of future updates
when the test program changes.
2021-09-30 18:08:54 -05:00
Carl Love
a9f41e0c0b fix sraw, srawi, srad, sradi instructions
For ISA 3.0 and beyond, the instructions also write the XER register.

Split the instructions out to a new command line option so we can create
an ISA 2.07 expect file, ISA 3.0 LE and ISA 3.0 BE expect file. The new
command line option is "-s" to just run just these four instructions.
2021-09-30 17:53:39 -05:00
Carl Love
a3c3f5394a New test for the ISA 3.0 mcrxrx instruction.
Add new test.
2021-09-30 17:49:39 -05:00
Carl Love
7d2cec7f24 Fixes for mcrxr instruction
Add .machine directives to ensure the mcrxr instruction is assembled
for power 6.  The instruction is not supported on later platforms.
2021-09-30 17:32:25 -05:00
Carl Love
518a2d59ac Fix dfp tests.
Due to changes between the compiler and linker, we need to add .machine
arguments to configure file to properly detect the availability of the
dfp instructions.

Add print statement if HAS_DFP is not enabled to make it
easier to determine when HAS_DFP is not enabled.
2021-09-30 17:30:13 -05:00
Carl Love
475916cbd3 Add .machine directives for the darn instruction 2021-09-30 17:30:09 -05:00
Carl Love
e23c2a2291 Fixes to add .machine directives for assembly instructions 2021-09-30 17:30:05 -05:00
Tulio Magno Quites Machado Filho
a63e9c28b5 powerpc: Add .machine directives for scv, copy, paste, cpabort instructions
GCC is no longer passing the "-many" flag to the assembler.  So, the
inline assembly instructions statements need to use the .machine directives
for the specific platform.

(gcc commit e154242724b084380e3221df7c08fcdbd8460674 ; "[RS6000] Don't
pass -many to the assembler".

Hardware sync instruction (hwsync) added after the copy, paste and cpabort
instructions to improve the reliability of the test.
2021-09-30 17:30:01 -05:00
carl love
a9b5f6cfeb Configure,makefile and test case fixes for older powerpc targets.
Assorted changes to fix up compile issues as seen during regression
testing of VG on hardware back as far as Power 6 (ISA 2.05).
2021-09-30 17:29:54 -05:00
Carl Love
093bef43d6 Remove deprecated regression tests for mftgpr and mffgpr.
The mftgpr and mffgpr instructions are deprecated.  Added comments in
VEX/priv/guest_ppc_toIR.c for the instructions stating the instructions
are deprecated.  Valgrind support can be removed if the opcodes get reused
in the future.  For now, leaving the functional support in Valgrind
for the instructions.

Removed the regression test power6_mf_gpr.c, expect files and vgtest file
from none/tests/ppc64.
2021-09-13 11:05:47 -05:00
Carl Love
81032a82f7 Cleanup of none/tests/ppc64/Makefile.am
Fixing indentation and move the jm_insns_CFLAGS next to the other CFLAGS
definitions.

No functional changes.
2021-09-10 16:20:10 -05:00
Carl Love
9aaeafa70c Update the expected output for test_isa_3_1_VRT.
The inputs into the vinsdlx,vinsdrx instructions changed as a result of
the impossible constraint issue fix.  This patch updates the expected
results.

https://bugs.kde.org/show_bug.cgi?id=441534
2021-09-07 13:39:13 -05:00
Carl Love
733aba8482 Fix impossible constraint issue in P10 testcase.
This reworks the modulo operation as seen in
valgrind/none/tests/ppc64/test_isa_3_1_common.c:
  initialize_source_registers().

Due to a GCC issue (PR101882), we will try to avoid a modulo operation with
both input and outputs set to a hard register. In this case, we can apply
the modulo operation to the args[] array value used to initialize the ra
value.

https://bugs.kde.org/show_bug.cgi?id=440906
2021-09-07 13:35:45 -05:00
Andreas Arnez
62b7052ab5 s390x: Vec-enh-2, test cases
Add test cases for verifying the new/enhanced instructions in the
vector-enhancements facility 2.  For "vector string search" VSTRS add a
memcheck test case.
2021-09-01 14:44:16 +02:00
Andreas Arnez
02b7bed505 s390x: Misc-insn-3, test case
Add a test case for the new instructions in the miscellaneous instruction
extensions facitility 3.
2021-09-01 14:44:16 +02:00
Assad Hashmi
393732dda1 Bug 438630 Adds zero variants of arm64 v8.2 FP compare instructions.
This patch adds half-precision floating-point support for the following:
FCMEQ <Hd>, <Hn>, #0.0
FCMEQ <Vd>.<T>, <Vn>.<T>, #0.0
FCMGE <Hd>, <Hn>, #0.0
FCMGE <Vd>.<T>, <Vn>.<T>, #0.0
FCMGT <Hd>, <Hn>, #0.0
FCMGT <Vd>.<T>, <Vn>.<T>, #0.0
FCMLE <Hd>, <Hn>, #0.0
FCMLE <Vd>.<T>, <Vn>.<T>, #0.0
FCMLT <Hd>, <Hn>, #0.0
FCMLT <Vd>.<T>, <Vn>.<T>, #0.0

Fixes https://bugs.kde.org/show_bug.cgi?id=438630
2021-06-29 10:49:28 -04:00
Assad Hashmi
c5331315d7 Bug 438038 Adds arm64 v8.2 FP compare & conditional compare instructions.
This patch adds half-precision floating-point support for the following:
FCCMP <Hn>, <Hm>, #<nzcv>, <cond>
FCCMPE <Hn>, <Hm>, #<nzcv>, <cond>
FCMEQ <Hd>, <Hn>, <Hm>
FCMEQ <Vd>.<T>, <Vn>.<T>, <Vm>.<T>
FCMGE <Hd>, <Hn>, <Hm>
FCMGE <Vd>.<T>, <Vn>.<T>, <Vm>.<T>
FCMGT <Hd>, <Hn>, <Hm>
FCMGT <Vd>.<T>, <Vn>.<T>, <Vm>.<T>

Fixes https://bugs.kde.org/show_bug.cgi?id=438038
2021-06-29 10:10:54 -04:00
Assad Hashmi
f048559cb0 Bug 436873 Added arm64 v8.2 vector FABD, FACGE, FACGT and FADD
This patch adds FP half-precision support for the following:
FADD <Vd>.<T>, <Vn>.<T>, <Vm>.<T>
FABD <Vd>.<T>, <Vn>.<T>, <Vm>.<T>
FACGT <Vd>.<T>, <Vn>.<T>, <Vm>.<T>
FACGE <Vd>.<T>, <Vn>.<T>, <Vm>.<T>

Fixes https://bugs.kde.org/show_bug.cgi?id=436873
2021-06-08 12:02:06 -04:00
Assad Hashmi
3ac8615140 Bug 436411 Added arm64 v8.2 scalar FABD, FACGE, FACGT and FADD
This patch adds FP half-precision support for the following:
FADD <Hd>, <Hn>, <Hm>
FABD <Hd>, <Hn>, <Hm>
FACGT <Hd>, <Hn>, <Hm>
FACGE <Hd>, <Hn>, <Hm>

Fixes https://bugs.kde.org/show_bug.cgi?id=436411
2021-06-08 06:20:58 -04:00
Carl Love
fa4d21af44 PPC64: Add support for copy, cpabort, paste instructions 2021-06-03 10:35:36 -05:00
Carl Love
8f69756a22 PPC64: add support for the vectored system call instruction scv. 2021-05-04 15:34:43 -05:00
Carl Love
8afb49abe0 PPC64: Add support for the darn instruction 2021-05-04 10:38:48 -05:00
root
c589b65293 Reduced precision Missing Integer based outer tests 2021-03-31 10:31:27 -05:00
root
c8fa838be4 Reduced Precision bfloat16 outer product tests 2021-03-31 10:31:16 -05:00
Carl Love
4bcc6c8a97 VSX Permute Control Vector Generate Operation tests. 2021-03-30 10:38:45 -05:00
Mark Wielaard
8616808ab3 Add isa_3_1_register_defines.h to Makefile.am noinst_HEADERS
Make sure isa_3_1_register_defines.h ends up in the dist tarball.
2021-03-17 17:57:03 +01:00
Carl Love
3c31707cd3 VSX Mask Manipulation operation tests. 2021-03-04 12:57:16 -06:00
Bart Van Assche
ae15c01f72 none/tests/ifunc.c: Fix a compiler warning
Fix the following compiler warning:

ifunc.c:9:15: warning: 'ifunc' resolver for 'test' should return 'void (*)(int)' [-Wattribute-alias=]
    9 | static void (*resolve_test(void))(void)
      |               ^~~~~~~~~~~~
2021-02-27 20:40:50 -08:00
Carl Love
6daaeb0ff4 PPC64: 128-bit Binary Integer Operations, part tests. 2021-02-25 11:57:40 -06:00
Carl Love
b4eff82004 PPC, modsw and modsd instruction fix 2021-02-12 11:01:31 -06:00
Mark Wielaard
c9781cc97e PR140939 --track-fds reports leakage of stdout/in/err and doesn't respect -q
Make --track-fds=yes not report on file descriptors 0, 1, and 2 (stdin,
stdout, and stderr) by default. Add a new option --track-fds=all that does
report on the std file descriptors still being open. Update testsuite and
documentation.

Original patch by Peter Kelly <pmk@cs.adelaide.edu.au>
Updated by Daniel Fahlgren <daniel@fahlgren.se>

https://bugs.kde.org/show_bug.cgi?id=140939
2021-02-10 19:37:08 +01:00