You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(83) |
Oct
(89) |
Nov
(97) |
Dec
(30) |
| 2024 |
Jan
(25) |
Feb
(73) |
Mar
(76) |
Apr
(122) |
May
(46) |
Jun
(44) |
Jul
(27) |
Aug
(30) |
Sep
(33) |
Oct
(67) |
Nov
(91) |
Dec
(70) |
| 2025 |
Jan
(44) |
Feb
(36) |
Mar
(85) |
Apr
(100) |
May
(138) |
Jun
(55) |
Jul
(107) |
Aug
(96) |
Sep
(151) |
Oct
(99) |
Nov
|
Dec
|
|
From: Florian K. <fk...@so...> - 2025-09-30 20:15:56
|
https://sourceware.org/cgit/valgrind/commit/?id=97831bbbc208f3c574095770aff9b19e5a2c6aae commit 97831bbbc208f3c574095770aff9b19e5a2c6aae Author: Florian Krohm <fl...@ei...> Date: Tue Sep 30 20:14:24 2025 +0000 riscv64: Fix IR generation for shift operations (BZ 509157) For SLL, SRL, and SRA the shift amount is 6 bits wide - not 8 bits. For SLLW, SRLW, and SRAW the shift amount is 5 bits wide - not 8 bits. Patch for IR generation by Christoph Jung (chr...@go...). Also clarify semantics of bitwise shift operators in libvex_ir.h Fixes https://bugs.kde.org/show_bug.cgi?id=509157 Diff: --- VEX/priv/guest_riscv64_toIR.c | 13 +++++++++---- VEX/pub/libvex_ir.h | 12 ++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c index 59297acd15..c90444ef1d 100644 --- a/VEX/priv/guest_riscv64_toIR.c +++ b/VEX/priv/guest_riscv64_toIR.c @@ -1550,7 +1550,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, break; case 0b001: expr = binop(Iop_Shl64, getIReg64(rs1), - unop(Iop_64to8, getIReg64(rs2))); + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00111111), + getIReg64(rs2)))); break; case 0b010: expr = unop(Iop_1Uto64, @@ -1565,7 +1566,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, break; case 0b101: expr = binop(is_base ? Iop_Shr64 : Iop_Sar64, getIReg64(rs1), - unop(Iop_64to8, getIReg64(rs2))); + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00111111), + getIReg64(rs2)))); break; case 0b110: expr = binop(Iop_Or64, getIReg64(rs1), getIReg64(rs2)); @@ -1719,7 +1721,9 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, if (rd != 0) putIReg32( irsb, rd, - binop(Iop_Shl32, getIReg32(rs1), unop(Iop_64to8, getIReg64(rs2)))); + binop(Iop_Shl32, getIReg32(rs1), + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00011111), + getIReg64(rs2))))); DIP("sllw %s, %s, %s\n", nameIReg(rd), nameIReg(rs1), nameIReg(rs2)); return True; } @@ -1734,7 +1738,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, if (rd != 0) putIReg32(irsb, rd, binop(is_log ? Iop_Shr32 : Iop_Sar32, getIReg32(rs1), - unop(Iop_64to8, getIReg64(rs2)))); + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00011111), + getIReg64(rs2))))); DIP("%s %s, %s, %s\n", is_log ? "srlw" : "sraw", nameIReg(rd), nameIReg(rs1), nameIReg(rs2)); return True; diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 8c68fab441..7cb9c6b0f8 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -434,6 +434,18 @@ typedef Iop_Or8, Iop_Or16, Iop_Or32, Iop_Or64, Iop_And8, Iop_And16, Iop_And32, Iop_And64, Iop_Xor8, Iop_Xor16, Iop_Xor32, Iop_Xor64, + /* Bitwise shift ops + Semantics as per C standard: + If the value of the right operand is negative or is greater + than or equal to the width of the left operand, the behaviour is + undefined. + For Shl: The result of E1 << E2 is E1 left-shifted E2 bit positions. + Vacated bits are filled with zeroes. + For Shr: The result of E1 >> E2 is E1 right-shifted E2 bit positions. + Vacated bits are filled with zeroes. + For Sar: The result of E1 >> E2 is E1 right-shifted E2 bit positions. + Vacated bits are filled with the most significant bit of E1 prior + to shifting. */ Iop_Shl8, Iop_Shl16, Iop_Shl32, Iop_Shl64, Iop_Shr8, Iop_Shr16, Iop_Shr32, Iop_Shr64, Iop_Sar8, Iop_Sar16, Iop_Sar32, Iop_Sar64, |
|
From: Cyril H. <ch...@su...> - 2025-09-30 12:18:03
|
Good news everyone,
the Linux Test Project test suite stable release for *September 2025* has been
released.
Since the last release 221 patches by 25 authors were merged.
Patch review is what most of the projects struggle with and LTP is no
different. If you can spare some effort helping with the patch review is more
than welcomed.
NOTABLE CHANGES
===============
* New tests
- CVE-2025-21756 regression test for fcdd2242c023 ('vsock: Keep the binding until socket destruction')
- CVE-2025-38236 regression test for 32ca245464e1 ('af_unix: Don't leave consecutive consumed OOB skbs')
- file_attr[01-04] tests for file_getattr() and file_setattr() syscalls
- clock_settime04 Tests that changing the CLOCK_REALTIME clock has no effect
on a relative/absolute clock_nanosleep()
- statmount09 that verifies that statmount() is correctly reading the mount
ID for the current namespace
- listxattr04 regression test for 8b0ba61df5a1 ('fs/xattr.c: fix simple_xattr_list to always include security.* xattrs')
- ioctl_pidfd[01-06] tests for PIDFD_GET_INFO ioctl() and PIDFD_INFO_EXIT flag
- mount08 regression test for d80b065bb172 ('proc: restrict overmounting of ephemeral entities')
- unshare05 tests that unshare(CLONE_NEWPID) assign pid 1 to the first child
- ioctl10 test for PROCMAP_QUERY ioctl()
- landlock02 test for landlock ABI v6
- landlock09 test for unix socket landlock sandboxing
- landlock10 test for signal sandboxing
- epoll_pwait06 regression test for d9ec73301099 ('fs/eventpoll: fix endless busy loop after timeout has expired')
- lsm_get_self_attr[01-03] tests for lst_get_self_attr() syscall
- lsm_list_modules[01-02] tests for lsm_list_modules() syscall
- lsm_set_self_attr01 test for lsm_set_self_attr() syscall
* Increased coverage
- open13 now checks that more operations are failing with EBADF on O_PATH fd
and also verifies that dup() preserves O_PATH flag
* Rewritten and updated tests
- open posix aio_cancel_7-1 was rewritten to trigger the tested condition reliably
- mmap22 now uses mincore() to test MAP_DROPPABLE flag
- open posix pthread_rwlock_rdlock now use PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
on glibc to force POSIX mandated behavior
- ioctl_loop01 and ioctl09 tests now use loop device instead of the backing
úfile for partitioning
- sched_football thread synchronization at the start was rewritten to make sure
threads are started in the right order
* Removed tests
- eject command test
- kdump testsuite which was unmaintained for nearly two decades
* General smaller improvements
- LTP kernel modules can now be build separately with 'make modules'
- The new shell test library now support setup() and cleanup() functions
- The concept of min_runtime was added to the test library, now tests that run
for longer time can define min_runtime in order to make sure that the test
actually runs for a reasonable runtime when test runtime is scaled down.
For details see:
81ba405dfbd9 ('tst_test: Add min_runtime to control lower bound of scaled runtime')
- Test library now properly translates MS_RDONLY flag for FUSE based mounts
- The test metadata parser now correctly handles designed initializers
Details in:
375286fb9361 ('metaparse: Map arrays with designated initializers to JSON objects')
- New LTP_QUIET environment variable was introduced, if set TINFO, TDEBUG and
TCONF messages are suppresed. This can be combined with the previously
introduced LTP_REPRODUCIBLE_OUTPUT to create shorter logs that are easier to
compare between runs.
* Kirk and ltx has been fixed and now works well together
This marks a milestone in new LTP test runner development as we are nearing
the vision we had for years. The ltx, which is minimalistic daemon that
communicates over byte oriented connection, can be started on the system
under test and kirk can connect to ltx from a machine that drives the testing
and run tests in parallel using ltx.
The documentation is sparse at the moment and kirk qemu SUT does not start
ltx automatically. However if you want to feel adventurous and try ltx in a
qemu virtual machine with communication over virtio with these steps:
Manually start qemu virtual machine on a host:
mkfifo ltx-io.in
mkfifo ltx-io.out
qemu- ... -chardev pipe,id=ltx-io,path=ltx-io -device virtserialport,chardev=ltx-io,name=ltx-io
Start ltx inside of the guest:
/opt/ltp/ltx -s /dev/virtio-ports/ltx-io
And on a host use kirk to talk to ltx via the virtio serial:
./kirk --run-suite syscalls --sut ltx:infile=ltx-io.in:outfile=ltx-io.out
Parallel run can be started by passing number of workers (-w N) to kirk.
Similarily you can run ltx and kirk over real serial null modem between two
machines.
Next step that is already in queue is separation of communication channel and
SUT definition in kirk. That will allow us to select different ways how kirk
connects to SUT e.g. qemu while the SUT module will handle the power e.g.
reboot. Hopefully that will happen in the next release and we will be
finally removing the old and deprecated runltp next year.
* Testers guide to the Linux Test Project was added into documentation:
https://linux-test-project.readthedocs.io/en/latest/users/testers_guide.html
* Documentation was written for test macros:
https://linux-test-project.readthedocs.io/en/latest/developers/api_c_tests.html#test-macros
* 52 testcases were converted to the new test library
+ The usual amount of fixes and cleanups
DOWNLOAD AND LINKS
==================
The latest version of the test-suite contains 3000+ tests for the Linux
and can be downloaded at:
https://github.com/linux-test-project/ltp/releases/tag/20250930
The project pages as well as GIT repository are hosted on GitHub:
https://github.com/linux-test-project/ltp
If you ever wondered how to write a LTP testcase, don't miss our developer
documentation at:
https://linux-test-project.readthedocs.io/en/latest/developers/test_case_tutorial.html
And our library API documentation at:
https://linux-test-project.readthedocs.io/en/latest/developers/api_c_tests.html
Patches, new tests, bugs, comments or questions should go to to our mailing
list at lt...@li....
CREDITS
=======
Many thanks to the people contributing to this release:
git shortlog -s -e -n 20250530..
50 Andrea Cervesato <and...@su...>
50 Petr Vorel <pv...@su...>
33 Ricardo B. Marlière <rb...@su...>
16 Cyril Hrubis <ch...@su...>
15 Li Wang <li...@re...>
14 Martin Doucha <md...@su...>
13 Wei Gao <we...@su...>
5 Avinesh Kumar <ak...@su...>
4 Tiezhu Yang <yan...@lo...>
3 Florian Schmaus <flo...@co...>
2 Amir Goldstein <ami...@gm...>
2 Jack Morgan <jm...@na...>
2 Martin Cermak <mc...@re...>
1 Ben Copeland <ben...@li...>
1 Charles Shi <sc...@gm...>
1 Jan Kara <ja...@su...>
1 Jan Polensky <ja...@li...>
1 Jan Stancek <jst...@re...>
1 Liheng Chen <791...@qq...>
1 Mark Wielaard <ma...@kl...>
1 Mike Tipton via ltp <lt...@li...>
1 Tengda Wu <st...@gm...>
1 Xiao Yang <ice...@gm...>
1 lufei <lu...@un...>
1 yang.zhang <zha...@ky...>
And also thanks to patch reviewers:
git log 20250530.. | grep -Ei '(reviewed|acked)-by:' | sed 's/.*by: //' | sort | uniq -c | sort -n -r
97 Cyril Hrubis <ch...@su...>
54 Petr Vorel <pv...@su...>
48 Li Wang <li...@re...>
38 Andrea Cervesato <and...@su...>
11 Avinesh Kumar <ak...@su...>
10 Wei Gao <we...@su...>
4 Ricardo B. Marlière <rb...@su...>
3 Jan Stancek <jst...@re...>
2 Mimi Zohar <zo...@li...>
1 Pedro Falcato <pfa...@su...>
1 Martin Doucha <md...@su...>
1 Jan Kara <ja...@su...>
--
Cyril Hrubis
ch...@su...
|
|
From: <min...@wi...> - 2025-09-30 09:57:38
|
From: Mingli Yu <min...@wi...> Though the valgrind testing is extended to produce automake-style log into test-suite-overall.log [1], it's better also print the test result to the stdout. [1] https://sourceware.org/git/?p=valgrind.git;a=commitdiff;h=61e44a4aef8775b925a7a91f403ebd7f4f6670a4 Signed-off-by: Mingli Yu <min...@wi...> --- tests/vg_regtest.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in index 945b4c161..2f5f3f678 100644 --- a/tests/vg_regtest.in +++ b/tests/vg_regtest.in @@ -720,6 +720,7 @@ sub test_one_dir($$) close(TSDIRLOG); my $result = do_one_test($full_dir, $f); print TSLOG scalar localtime, " result: $result $full_dir/$f.log\n"; + print "$result: $full_dir/$f\n"; $num_results{$result} ++; if ($result ne "PASS") { # transcribe .log file into the overall log. @@ -823,6 +824,7 @@ while (1) { # we will exit after one loop, unless looptillfail my $result = do_one_test($dir, $file); print TSLOG scalar localtime, " result: $result $dir/$file.log\n"; + print "$result: $dir/$file\n"; $num_results{$result} ++; if ($result ne "PASS") { # transcribe .log file into the overall log. -- 2.34.1 |
|
From: Florian K. <fk...@so...> - 2025-09-29 22:35:53
|
https://sourceware.org/cgit/valgrind/commit/?id=a984b14036fce483f98ece084c4d54370749fd26 commit a984b14036fce483f98ece084c4d54370749fd26 Author: Florian Krohm <fl...@ei...> Date: Mon Sep 29 22:35:10 2025 +0000 s390: Cleanup none/tests/s390x/Makefile.am Diff: --- none/tests/s390x/Makefile.am | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index e0ca00d5ba..22b8128bba 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -32,7 +32,8 @@ check_PROGRAMS = $(INSN_TESTS) \ allexec \ op00 -noinst_HEADERS = vector.h +noinst_HEADERS = add.h and.h div.h dfp_utils.h insert.h mul.h opcodes.h \ + or.h rounding.h sub.h svc.h table.h test.h vector.h xor.h EXTRA_DIST = \ $(addsuffix .stderr.exp,$(INSN_TESTS)) \ @@ -49,20 +50,9 @@ EXTRA_DIST = \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ op00.stderr.exp op00.vgtest \ - test.h opcodes.h add.h and.h div.h insert.h dfp_utils.h \ - mul.h or.h sub.h xor.h table.h svc.h rounding.h \ - dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \ - dfp-2.stderr.exp dfp-2.stdout.exp dfp-2.vgtest \ - dfp-3.stderr.exp dfp-3.stdout.exp dfp-3.vgtest \ - dfp-4.stderr.exp dfp-4.stdout.exp dfp-4.vgtest \ - dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest \ - dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \ - dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \ dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \ dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \ - srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \ - stfle.stdout.exp-z16 \ - pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest + stfle.stdout.exp-z16 AM_CFLAGS += @FLAG_M64@ AM_CXXFLAGS += @FLAG_M64@ |
|
From: Florian K. <fk...@so...> - 2025-09-29 21:37:23
|
https://sourceware.org/cgit/valgrind/commit/?id=d60982b80c6a7ae7a731305e3087345de4c1a023 commit d60982b80c6a7ae7a731305e3087345de4c1a023 Author: Florian Krohm <fl...@ei...> Date: Mon Sep 29 21:34:56 2025 +0000 s390: Add testcases for unhandled IEEE exceptions. Fixes BZ 306098 New emulation warnings: EmWarn_S390X_XxC_not_zero and EmWarn_S390X_XiC_not_zero New testcases bfp-XxC, dfp-XxC, and dfp-XiC. New testcase driver emwarn-gen.pl to get around valgrind's restriction on the number of emulation warnings. Fixes https://bugs.kde.org/show_bug.cgi?id=306098 Diff: --- NEWS | 1 + VEX/priv/guest_s390_toIR.c | 250 ++++++++++++++++++++++-------------- VEX/priv/main_main.c | 10 +- VEX/pub/libvex_emnote.h | 18 ++- none/tests/s390x/Makefile.am | 5 +- none/tests/s390x/bfp-XxC.post.exp | 234 +++++++++++++++++++++++++++++++++ none/tests/s390x/bfp-XxC.stderr.exp | 2 + none/tests/s390x/bfp-XxC.vgtest | 3 + none/tests/s390x/dfp-XiC.post.exp | 36 ++++++ none/tests/s390x/dfp-XiC.stderr.exp | 2 + none/tests/s390x/dfp-XiC.vgtest | 3 + none/tests/s390x/dfp-XxC.post.exp | 146 +++++++++++++++++++++ none/tests/s390x/dfp-XxC.stderr.exp | 2 + none/tests/s390x/dfp-XxC.vgtest | 3 + none/tests/s390x/emwarn-gen.pl | 179 ++++++++++++++++++++++++++ 15 files changed, 794 insertions(+), 100 deletions(-) diff --git a/NEWS b/NEWS index 1d2a6ea653..d7367ba054 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +306098 s390x: Alternate opcode form for convert to/from fixed and friends 309100 s390x: Testcases for extended BFP 309554 Wrap syscall remap_file_pages (216) 331311 Valgrind shows open files in /proc/self/fd that don't work for the process diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 1f18fee662..aad1a0dbb5 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -778,7 +778,7 @@ static void s390_print(HChar *text, IRExpr *value) { IRDirty *d; - + d = unsafeIRDirty_0_N(0 /* regparms */, "s390_do_print", &s390_do_print, mkIRExprVec_2(mkU64((ULong)text), value)); stmt(IRStmt_Dirty(d)); @@ -11458,13 +11458,14 @@ s390_irgen_ADB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CEFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cefbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I32); @@ -11477,10 +11478,11 @@ s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDFBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CDFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cdfbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11491,13 +11493,14 @@ s390_irgen_CDFBRA(UChar m3, } static const HChar * -s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CEGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cegbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I64); @@ -11510,13 +11513,14 @@ s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cdgbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I64); @@ -11529,13 +11533,14 @@ s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CELFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("celfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11547,13 +11552,14 @@ s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLFBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CDLFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cdlfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11564,13 +11570,14 @@ s390_irgen_CDLFBR(UChar m3, } static const HChar * -s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CELGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("celgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -11582,13 +11589,14 @@ s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDLGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cdlgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -11601,13 +11609,14 @@ s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFEBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfebr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); @@ -11623,13 +11632,14 @@ s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFDBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfdbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); @@ -11645,13 +11655,14 @@ s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGEBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgebr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); @@ -11667,13 +11678,14 @@ s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGDBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgdbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); @@ -11689,10 +11701,11 @@ s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); @@ -11708,10 +11721,11 @@ s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfdbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); @@ -11727,10 +11741,11 @@ s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); @@ -11746,10 +11761,11 @@ s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgdbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); @@ -11903,13 +11919,14 @@ s390_irgen_LDEB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_LEDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("ledbra", is_valid_rounding_mode(m3)); IRTemp op = newTemp(Ity_F64); @@ -12162,11 +12179,13 @@ s390_irgen_CXTR(UChar r1, UChar r2) static const HChar * s390_irgen_CDFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12177,12 +12196,14 @@ s390_irgen_CDFTR(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CXFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { s390_insn_assert("cxftr", is_valid_fpr_pair(r1)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -12193,8 +12214,7 @@ s390_irgen_CXFTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDGTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12205,6 +12225,8 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); assign(op2, get_gpr_dw0(r2)); put_dpr_dw0(r1, binop(Iop_I64StoD64, mkexpr(encode_dfp_rounding_mode(m3)), @@ -12215,12 +12237,14 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { s390_insn_assert("cxgtra", is_valid_fpr_pair(r1)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -12235,7 +12259,7 @@ s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12243,6 +12267,8 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12254,7 +12280,7 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12263,6 +12289,8 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlftr", is_valid_fpr_pair(r1)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -12274,8 +12302,7 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDLGTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12283,6 +12310,8 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -12296,7 +12325,7 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12305,6 +12334,8 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlgtr", is_valid_fpr_pair(r1)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -12316,8 +12347,7 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12325,6 +12355,8 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12340,8 +12372,7 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12350,6 +12381,8 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cfxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); @@ -12367,8 +12400,7 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGDTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12376,6 +12408,8 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12388,8 +12422,7 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGXTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12398,6 +12431,8 @@ s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cgxtra", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12456,8 +12491,7 @@ s390_irgen_CEXTR(UChar r1, UChar r2) } static const HChar * -s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12465,6 +12499,8 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12480,8 +12516,7 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12490,6 +12525,8 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); @@ -12507,8 +12544,7 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12516,6 +12552,8 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12531,8 +12569,7 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12541,6 +12578,8 @@ s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I64); @@ -12701,11 +12740,13 @@ s390_irgen_IEXTR(UChar r3, UChar r1, UChar r2) } static const HChar * -s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_LDETR(UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); IRTemp op = newTemp(Ity_D32); assign(op, get_dpr_w0(r2)); @@ -12715,11 +12756,13 @@ s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_LXDTR(UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); s390_insn_assert("lxdtr", is_valid_fpr_pair(r1)); IRTemp op = newTemp(Ity_D64); @@ -12731,8 +12774,7 @@ s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LDXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12746,6 +12788,10 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_D64); assign(result, binop(Iop_D128toD64, mkexpr(encode_dfp_rounding_mode(m3)), @@ -12756,8 +12802,7 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12768,6 +12813,10 @@ s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); assign(op, get_dpr_dw0(r2)); @@ -14855,11 +14904,12 @@ s390_irgen_KDB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CXFBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cxfbra", is_valid_fpr_pair(r1)); s390_insn_assert("cxfbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -14870,14 +14920,15 @@ s390_irgen_CXFBRA(UChar m3, } static const HChar * -s390_irgen_CXLFBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXLFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlfbr", is_valid_fpr_pair(r1)); s390_insn_assert("cxlfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -14889,11 +14940,12 @@ s390_irgen_CXLFBR(UChar m3, static const HChar * -s390_irgen_CXGBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cxgbra", is_valid_fpr_pair(r1)); s390_insn_assert("cxgbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -14904,14 +14956,15 @@ s390_irgen_CXGBRA(UChar m3, } static const HChar * -s390_irgen_CXLGBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXLGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlgbr", is_valid_fpr_pair(r1)); s390_insn_assert("cxlgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -14922,11 +14975,12 @@ s390_irgen_CXLGBR(UChar m3, } static const HChar * -s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfxbra", is_valid_fpr_pair(r2)); s390_insn_assert("cfxbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); @@ -14942,14 +14996,15 @@ s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFXBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfxbr", is_valid_fpr_pair(r2)); s390_insn_assert("clfxbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); @@ -14966,11 +15021,12 @@ s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * -s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgxbra", is_valid_fpr_pair(r2)); s390_insn_assert("cgxbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); @@ -14986,14 +15042,15 @@ s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGXBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGXBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgxbr", is_valid_fpr_pair(r2)); s390_insn_assert("clgxbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); @@ -15112,10 +15169,11 @@ s390_irgen_LXEB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fiebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F32); @@ -15127,10 +15185,11 @@ s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fidbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F64); @@ -15142,12 +15201,13 @@ s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_FIXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fixbra", is_valid_fpr_pair(r1)); s390_insn_assert("fixbra", is_valid_fpr_pair(r2)); s390_insn_assert("fixbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F128); @@ -15237,13 +15297,14 @@ s390_irgen_LPXBR(UChar r1, UChar r2) } static const HChar * -s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LDXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("ldxbra", is_valid_fpr_pair(r1)); s390_insn_assert("ldxbra", is_valid_fpr_pair(r2)); s390_insn_assert("ldxbra", is_valid_rounding_mode(m3)); @@ -15258,13 +15319,14 @@ s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_LEXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("lexbra", is_valid_fpr_pair(r1)); s390_insn_assert("lexbra", is_valid_fpr_pair(r2)); s390_insn_assert("lexbra", is_valid_rounding_mode(m3)); @@ -16088,7 +16150,7 @@ s390_irgen_TRE(UChar r1,UChar r2) /* Load character from source string and compare with test byte */ assign(op, load(Ity_I8, mkexpr(src_addr))); - + s390_cc_set_val(1); next_insn_if(binop(Iop_CmpEQ8, mkexpr(op), mkexpr(test_byte))); diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index db78238ae2..85da551d56 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -719,7 +719,7 @@ IRSB* LibVEX_FrontEnd ( /*MOD*/ VexTranslateArgs* vta, vta->guest_extents, &vta->archinfo_host, guest_word_type, host_word_type); - + if (vex_traceflags & VEX_TRACE_INST) { vex_printf("\n------------------------" " After instrumentation " @@ -1541,6 +1541,14 @@ const HChar* LibVEX_EmNote_string ( VexEmNote ew ) " feature requires the floating point extension facility\n" " which is not available on this host. Continuing using\n" " the rounding mode from FPC. Results may differ!"; + case EmWarn_S390X_XxC_not_zero: + return "Encountered an insn with the IEEE-inexact-exception control\n" + " (XxC) bit set to 1. This is not supported. Continuing anyway.\n" + " IEEE-inexact exceptions will not be suppressed."; + case EmWarn_S390X_XiC_not_zero: + return "Encountered an insn with the IEEE-invalid-operation-exception\n" + " control (XiC) bit set to 1. This is not supported. Continuing anyway.\n" + " IEEE-invalid-operation exceptions will not be suppressed."; case EmFail_S390X_stfle: return "Instruction stfle is not supported on this host"; case EmFail_S390X_stckf: diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index be17a8922f..bd998a1c0e 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -37,7 +37,7 @@ #include "libvex_basictypes.h" /* VEX can sometimes generate code which returns to the dispatcher - with the guest state pointer set to VEX_TRC_JMP_EMWARN or + with the guest state pointer set to VEX_TRC_JMP_EMWARN or VEX_TRC_JMP_EMFAIL. This means that VEX is trying to tell Valgrind something noteworthy about emulation progress. For example, that Valgrind is doing imprecise emulation in some sense. The guest's pseudo-register @@ -67,16 +67,16 @@ typedef /* unmasking SSE FP exceptions is not supported */ EmWarn_X86_sseExns, - + /* setting mxcsr.fz is not supported */ EmWarn_X86_fz, - + /* setting mxcsr.daz is not supported */ EmWarn_X86_daz, /* settings to %eflags.ac (alignment check) are noted but ignored */ EmWarn_X86_acFlag, - + /* unmasking PPC32/64 FP exceptions is not supported */ EmWarn_PPCexns, @@ -89,6 +89,16 @@ typedef facility is not available on this host */ EmWarn_S390X_fpext_rounding, + /* Various BFP insns have an M4 field containing the + IEEE-inexact-exception (XxC) control bit. That bit cannot me modelled + in VEX and is expected to be zero. */ + EmWarn_S390X_XxC_not_zero, + + /* Various DFP insns have an M4 field containing the + IEEE-invalid-operation (XiC) control bit. That bit cannot me modelled + in VEX and is expected to be zero. */ + EmWarn_S390X_XiC_not_zero, + /* stfle insn is not supported on this host */ EmFail_S390X_stfle, diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 66254c3bbf..e0ca00d5ba 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl +dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl emwarn-gen.pl INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ and or xor insert div srst fold_And16 flogr sub_EI add_EI \ @@ -44,6 +44,7 @@ EXTRA_DIST = \ bfp-load.vgtest bfp-load.stdout.exp bfp-load.stderr.exp \ bfp-tdc.vgtest bfp-tdc.stdout.exp bfp-tdc.stderr.exp \ bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \ + bfp-XxC.vgtest bfp-XxC.stderr.exp bfp-XxC.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ @@ -57,6 +58,8 @@ EXTRA_DIST = \ dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest \ dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \ dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \ + dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \ + dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \ srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \ stfle.stdout.exp-z16 \ pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest diff --git a/none/tests/s390x/bfp-XxC.post.exp b/none/tests/s390x/bfp-XxC.post.exp new file mode 100644 index 0000000000..4e63c6b4e6 --- /dev/null +++ b/none/tests/s390x/bfp-XxC.post.exp @@ -0,0 +1,234 @@ + +============================================================ +BFP CONVERT FROM FIXED +============================================================ +Testing: cefbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdfbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxfbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cegbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdgbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxgbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT FROM LOGICAL +============================================================ +Testing: celfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: celgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT TO FIXED +============================================================ +Testing: cfebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfdbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgdbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT TO LOGICAL +============================================================ +Testing: clfebr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfdbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfxbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgebr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgdbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgxbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP LOAD FP INTEGER +============================================================ +Testing: fiebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: fidbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: fixbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP LOAD ROUNDED +============================================================ +Testing: ledbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: lexbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/bfp-XxC.stderr.exp b/none/tests/s390x/bfp-XxC.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/s390x/bfp-XxC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/bfp-XxC.vgtest b/none/tests/s390x/bfp-XxC.vgtest new file mode 100644 index 0000000000..af289c94ad --- /dev/null +++ b/none/tests/s390x/bfp-XxC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext +prog: /bin/true +post: ./emwarn-gen.pl --bfp-XxC diff --git a/none/tests/s390x/dfp-XiC.post.exp b/none/tests/s390x/dfp-XiC.post.exp new file mode 100644 index 0000000000..e51ad83302 --- /dev/null +++ b/none/tests/s390x/dfp-XiC.post.exp @@ -0,0 +1,36 @@ + +============================================================ +DFP LOAD LENGTHENED +============================================================ +Testing: ldetr 0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + +Testing: lxdtr 0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP LOAD ROUNDED +============================================================ +Testing: ledtr 0,0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxtr 0,0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/dfp-XiC.stderr.exp b/none/tests/s390x/dfp-XiC.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/s390x/dfp-XiC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/dfp-XiC.vgtest b/none/tests/s390x/dfp-XiC.vgtest new file mode 100644 index 0000000000..bea81fbee8 --- /dev/null +++ b/none/tests/s390x/dfp-XiC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp +prog: /bin/true +post: ./emwarn-gen.pl --dfp-XiC diff --git a/none/tests/s390x/dfp-XxC.post.exp b/none/tests/s390x/dfp-XxC.post.exp new file mode 100644 index 0000000000..a3af320116 --- /dev/null +++ b/none/tests/s390x/dfp-XxC.post.exp @@ -0,0 +1,146 @@ + +============================================================ +DFP CONVERT FROM FIXED +============================================================ +Testing: cdgtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxgtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT FROM LOGICAL +============================================================ +Testing: cdlgtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlgtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT TO FIXED +============================================================ +Testing: cgdtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgxtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT TO LOGICAL +============================================================ +Testing: clgdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP LOAD ROUNDED +============================================================ +Testing: ledtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/dfp-XxC.stderr.exp b/none/tests/s390x/dfp-XxC.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/s390x/dfp-XxC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/dfp-XxC.vgtest b/none/tests/s390x/dfp-XxC.vgtest new file mode 100644 index 0000000000..681c300a12 --- /dev/null +++ b/none/tests/s390x/dfp-XxC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp +prog: /bin/true +post: ./emwarn-gen.pl --dfp-XxC diff --git a/none/tests/s390x/emwarn-gen.pl b/none/tests/s390x/emwarn-gen.pl new file mode 100755 index 0000000000..7a142d795a --- /dev/null +++ b/none/tests/s390x/emwarn-gen.pl @@ -0,0 +1,179 @@ +#!/usr/bin/env perl + +#-------------------------------------------------------------------- +# Create testcases for checking BFP/DFP emulation warnings +# +# This machinery is to circumwent valgrind's limitation of at most +# 3 emulation warnings per emulation kind. +#-------------------------------------------------------------------- + +use strict; +use warnings; +use Cwd 'abs_path'; +use Getopt::Long; + +my $rootdir = get_rootdir(); +my $runone = "$rootdir/auxprogs/s390-runone"; +my $valgrind = "$rootdir/coregrind/valgrind"; +my $valargs = "-q --tool=none --show-emwarns=yes"; + +&main; + +sub main +{ + GetOptions("bfp-XxC" => sub { test_bfp_XxC(); }, + "dfp-XiC" => sub { test_dfp_XiC(); }, + "dfp-XxC" => sub { test_dfp_XxC(); }, + ) or exit 1; + exit 0; +} + +sub test_bfp_XxC +{ + header("BFP CONVERT FROM FIXED"); + run_insn_test("cefbra 0,0,0,4"); + run_insn_test("cdfbra 0,0,0,4"); + run_insn_test("cxfbra 0,0,0,4"); + run_insn_test("cegbra 0,0,0,4"); + run_insn_test("cdgbra 0,0,0,4"); + run_insn_test("cxgbra 0,0,0,4"); + + header("BFP CONVERT FROM LOGICAL"); + run_insn_test("celfbr 0,0,0,4"); + run_insn_test("cdlfbr 0,0,0,4"); + run_insn_test("cxlfbr 0,0,0,4"); + run_insn_test("celgbr 0,0,0,4"); + run_insn_test("cdlgbr 0,0,0,4"); + run_insn_test("cxlgbr 0,0,0,4"); + + header("BFP CONVERT TO FIXED"); + run_insn_test("cfebra 0,0,0,4"); + run_insn_test("cfdbra 0,0,0,4"); + run_insn_test("cfxbra 0,0,0,4"); + run_insn_test("cgebra 0,0,0,4"); + run_insn_test("cgdbra 0,0,0,4"); + run_insn_test("cgxbra 0,0,0,4"); + + header("BFP CONVERT TO LOGICAL"); + run_insn_test("clfebr 0,0,0,4"); + run_insn_test("clfdbr 0,0,0,4"); + run_insn_test("clfxbr 0,0,0,4"); + run_insn_test("clgebr 0,0,0,4"); + run_insn_test("clgdbr 0,0,0,4"); + run_insn_test("clgxbr 0,0,0,4"); + + header("BFP LOAD FP INTEGER"); + run_insn_test("fiebra 0,0,0,4"); + run_insn_test("fidbra 0,0,0,4"); + run_insn_test("fixbra 0,0,0,4"); + + header("BFP LOAD ROUNDED"); + run_insn_test("ledbra 0,0,0,4"); + run_insn_test("ldxbra 0,0,0,4"); + run_insn_test("lexbra 0,0,0,4"); +} + +sub test_dfp_XxC +{ + header("DFP CONVERT FROM FIXED"); + run_insn_test("cdgtra 0,0,0,4"); + run_insn_test("cxgtra 0,0,0,4"); + run_insn_test("cdftr 0,0,0,4"); + run_insn_test("cxftr 0,0,0,4"); + + header("DFP CONVERT FROM LOGICAL"); + run_insn_test("cdlgtr 0,0,0,4"); + run_insn_test("cxlgtr 0,0,0,4"); + run_insn_test("cdlftr 0,0,0,4"); + run_insn_test("cxlftr 0,0,0,4"); + + header("DFP CONVERT TO FIXED"); + run_insn_test("cgdtra 0,0,0,4"); + run_insn_test("cgxtra 0,0,0,4"); + run_insn_test("cfdtr 0,0,0,4"); + run_insn_test("cfxtr 0,0,0,4"); + + header("DFP CONVERT TO LOGICAL"); + run_insn_test("clgdtr 0,0,0,4"); + run_insn_test("clgxtr 0,0,0,4"); + run_insn_test("clfdtr 0,0,0,4"); + run_insn_test("clfxtr 0,0,0,4"); + + header("DFP LOAD ROUNDED"); + run_insn_test("ledtr 0,0,0,4"); + run_insn_test("ldxtr 0,0,0,4"); +} + +sub test_dfp_XiC +{ + header("DFP LOAD LENGTHENED"); + run_insn_test("ldetr 0,0,8"); + run_insn_test("lx... [truncated message content] |
|
From: Andreas A. <ar...@so...> - 2025-09-29 14:11:40
|
https://sourceware.org/cgit/valgrind/commit/?id=69e975e759c81a7790eb1f0e58881cef64c560c6 commit 69e975e759c81a7790eb1f0e58881cef64c560c6 Author: Andreas Arnez <ar...@li...> Date: Mon Sep 29 16:11:04 2025 +0200 s390x: Fix inline assembly for STFLE The inline assembly for emitting the STFLE instruction changes GPR 0, but fails to mention it in the clobber list. Depending on the compiler's mood, this may result in wrong code. A simple fix would be to just add "0" to the clobber list, but for readability it also helps to move the inline assembly to a separate function. So do that. In that function, use an "asm" variable for GPR 0 instead of moving the value back and forth between registers. Diff: --- coregrind/m_extension/extension-s390x.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index 98b825d9b5..a0c2913d47 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -902,6 +902,20 @@ static UWord do_extension_DFLTCC(ThreadState* tst, ULong variant) /*--- STFLE (store facility list extended) ---*/ /*---------------------------------------------------------------*/ +static int do_STFLE_insn(void* addr, ULong nwords, ULong* gpr0) +{ + register ULong reg0 asm("0") = *gpr0; + Int cc; + + asm(".insn s,0xb2b00000,%[out]\n" /* stfle */ + "ipm %[cc]\n" + : [out] "=Q"(*(ULong(*)[nwords])addr), [r0] "+d"(reg0), [cc] "=d"(cc) + : + : "cc"); + *gpr0 = reg0; + return cc >> 28; +} + static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant) { Int cc = 0; @@ -972,15 +986,8 @@ static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant) /* 195: unassigned */ | S390_SETBITS(196, 197)), }; - asm("lgr 0,%[r0]\n" - ".insn s,0xb2b00000,%[out]\n" /* stfle */ - "lgr %[r0],0\n" - "ipm %[cc]\n" - "srl %[cc],28\n" - : [out] "=Q"(*(ULong(*)[last_dw + 1])(void*)addr), [r0] "+d"(gpr0), - [cc] "=d"(cc) - : - : "cc"); + + cc = do_STFLE_insn((void*)addr, last_dw + 1, &gpr0); WRITE_GPR(tst, 0, gpr0); if (last_dw > (gpr0 & 0xff)) |
|
From: Martin C. <mc...@re...> - 2025-09-29 10:52:26
|
Thank-you Cyril. Looks perfect. Martin On Mon 2025-09-29 12:46 , Cyril Hrubis wrote: > Hi! > > I'm attaching updated patch. Hope it does address your comments. > > Please check. > > I dared to add your Signed-off-by: (I hope you do not mind) and merged, > thanks. > > Ah, and also removed the TWARN from the patch description since we does > not skip TWARN in this patch revision. > > -- > Cyril Hrubis > ch...@su... > |
|
From: Cyril H. <ch...@su...> - 2025-09-29 10:45:38
|
Hi! > I'm attaching updated patch. Hope it does address your comments. > Please check. I dared to add your Signed-off-by: (I hope you do not mind) and merged, thanks. Ah, and also removed the TWARN from the patch description since we does not skip TWARN in this patch revision. -- Cyril Hrubis ch...@su... |
|
From: Florian K. <fk...@so...> - 2025-09-28 13:18:04
|
https://sourceware.org/cgit/valgrind/commit/?id=78aa1064d8d7d46ebfb5ce488ff3355ce0db16cd commit 78aa1064d8d7d46ebfb5ce488ff3355ce0db16cd Author: Florian Krohm <fl...@ei...> Date: Sun Sep 28 13:17:28 2025 +0000 Add BZ 309100 Diff: --- NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 147f4f56f5..1d2a6ea653 100644 --- a/NEWS +++ b/NEWS @@ -67,8 +67,9 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. -331311 Valgrind shows open files in /proc/self/fd that don't work for the process +309100 s390x: Testcases for extended BFP 309554 Wrap syscall remap_file_pages (216) +331311 Valgrind shows open files in /proc/self/fd that don't work for the process 338803 Handling of dwz debug alt files or cross-CU is broken 369030 Wrap linux syscall: 171 (setdomainname) 388526 Inconsistent severity in message text: "WARNING: Serious error" @@ -139,8 +140,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns -509572 s390x: Overhaul BFP testsuite 509566 Wrap amd64-linux syscall: 442 (mount_setattr) +509572 s390x: Overhaul BFP testsuite 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) 509642 Add missing ppc64-linux syswraps |
|
From: Florian K. <fk...@so...> - 2025-09-26 22:02:45
|
https://sourceware.org/cgit/valgrind/commit/?id=b5b7e0238af259848996cf79b763600e2b76a14a commit b5b7e0238af259848996cf79b763600e2b76a14a Author: Florian Krohm <fl...@ei...> Date: Fri Sep 26 22:01:46 2025 +0000 Fix file permissions. The following files do not need to be executable: - configure.ac - Makefile*am - *.in The following files lack execute permission: - tests/platform_test - tests/vg_regtest - perf/vg_perf So from now on you can just run tests/vg_regtest and perf/vg_perf without the perl prefix. Docs changed accordingly. Diff: --- Makefile.all.am | 0 README_DEVELOPERS | 44 +++++++++++----------- cachegrind/cg_annotate.in | 0 cachegrind/cg_diff.in | 0 cachegrind/cg_merge.in | 0 configure.ac | 6 ++- coregrind/link_tool_exe_freebsd.in | 0 coregrind/vgstack.in | 0 drd/scripts/download-and-build-splash2.in | 0 drd/tests/Makefile.am | 0 drd/tests/filter_error_count.in | 0 drd/tests/filter_error_summary.in | 0 drd/tests/filter_stderr.in | 0 .../filter_stderr_and_thread_no_and_offset.in | 0 drd/tests/filter_thread_no.in | 0 drd/tests/filter_xml_and_thread_no.in | 0 gdbserver_tests/Makefile.am | 0 gdbserver_tests/README_DEVELOPERS | 4 +- gdbserver_tests/filter_gdb.in | 0 gdbserver_tests/filter_memcheck_monitor.in | 0 gdbserver_tests/filter_stderr.in | 0 gdbserver_tests/filter_vgdb.in | 0 helgrind/tests/Makefile.am | 0 helgrind/tests/filter_stderr.in | 0 massif/ms_print.in | 0 memcheck/tests/filter_dw4.in | 0 memcheck/tests/filter_overlaperror.in | 0 memcheck/tests/filter_stderr.in | 0 memcheck/tests/filter_supp.in | 0 memcheck/tests/x86/filter_pushfpopf.in | 0 tests/filter_discards.in | 0 tests/filter_stderr_basic.in | 0 tests/platform_test | 0 tests/vg_regtest.in | 2 +- 34 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Makefile.all.am b/Makefile.all.am old mode 100755 new mode 100644 diff --git a/README_DEVELOPERS b/README_DEVELOPERS index fc5a801295..22e229bd49 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -53,15 +53,15 @@ To build and run all the regression tests, run "make [--quiet] regtest". To run a subset of the regression tests, execute: - perl tests/vg_regtest <name> + tests/vg_regtest <name> where <name> is a directory (all tests within will be run) or a single .vgtest test file, or the name of a program which has a like-named .vgtest file. Eg: - perl tests/vg_regtest memcheck - perl tests/vg_regtest memcheck/tests/badfree.vgtest - perl tests/vg_regtest memcheck/tests/badfree + tests/vg_regtest memcheck + tests/vg_regtest memcheck/tests/badfree.vgtest + tests/vg_regtest memcheck/tests/badfree The details of each vgtest run are logged to individual "vgtest.log" files. These are listed, and non-passing tests detailed, in the @@ -114,22 +114,22 @@ To build and run all the performance tests, run "make [--quiet] perf". To run a subset of the performance suite, execute: - perl perf/vg_perf <name> + perf/vg_perf <name> where <name> is a directory (all tests within will be run) or a single .vgperf test file, or the name of a program which has a like-named .vgperf file. Eg: - perl perf/vg_perf perf/ - perl perf/vg_perf perf/bz2.vgperf - perl perf/vg_perf perf/bz2 + perf/vg_perf perf/ + perf/vg_perf perf/bz2.vgperf + perf/vg_perf perf/bz2 To compare multiple versions of Valgrind, use the --vg= option multiple times. For example, if you have two Valgrinds next to each other, one in trunk1/ and one in trunk2/, from within either trunk1/ or trunk2/ do this to compare them on all the performance tests: - perl perf/vg_perf --vg=../trunk1 --vg=../trunk2 perf/ + perf/vg_perf --vg=../trunk1 --vg=../trunk2 perf/ Writing regression tests ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -183,7 +183,7 @@ See tests/vg_regtest for a full description of all possible vgtest directives. The easiest way to generate the expected files is to run the test. Create empty files with touch (otherwise the test won't run) then run the test from the -top directory using perl and vg_regtest script (as in the "Running the +top directory using vg_regtest script (as in the "Running the regression tests" section. Then copy "tool/tests/newtest.stderr.out" to "tool/tests/newtest.stderr.exp". It is better to generate the .stdout.exp file directly from the testcase. You can do that by redirecting stdout to @@ -402,16 +402,16 @@ When using self-hosting with an outer Callgrind tool, use '--pop-on-jump' (B) Regression tests in an outer/inner setup: To run all the regression tests with an outer memcheck, do : - perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ - --all + tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ + --all To run a specific regression tests with an outer memcheck, do: - perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ - none/tests/args.vgtest + tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ + none/tests/args.vgtest To run regression tests with another outer tool: - perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ - --outer-tool=helgrind --all + tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ + --outer-tool=helgrind --all --outer-args allows to give specific arguments to the outer tool, replacing the default one provided by vg_regtest. @@ -470,20 +470,20 @@ the guest stacktrace that did the allocation. (C) Performance tests in an outer/inner setup: To run all the performance tests with an outer cachegrind, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf To run a specific perf test (e.g. bz2) in this setup, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf/bz2 + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf/bz2 To run all the performance tests with an outer callgrind, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ - --outer-tool=callgrind perf + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ + --outer-tool=callgrind perf Note: --outer-valgrind must be a "make install"-ed valgrind. Do *not* use vg-in-place. To compare the performance of multiple Valgrind versions, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ --outer-tool=callgrind \ --vg=../inner_xxxx --vg=../inner_yyyy perf (where inner_xxxx and inner_yyyy are the toplevel directories of @@ -498,7 +498,7 @@ output files will be created for each test: (where tt is the two letters abbreviation for the inner tool(s) run). For example, the command - perl perf/vg_perf \ + perf/vg_perf \ --outer-valgrind=../outer_trunk/install/bin/valgrind \ --outer-tool=callgrind \ --vg=../inner_tchain --vg=../inner_trunk perf/many-loss-records diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in old mode 100755 new mode 100644 diff --git a/cachegrind/cg_diff.in b/cachegrind/cg_diff.in old mode 100755 new mode 100644 diff --git a/cachegrind/cg_merge.in b/cachegrind/cg_merge.in old mode 100755 new mode 100644 diff --git a/configure.ac b/configure.ac old mode 100755 new mode 100644 index 1e7d506557..1a7ea34d1b --- a/configure.ac +++ b/configure.ac @@ -5752,9 +5752,7 @@ AC_CONFIG_FILES([ docs/Makefile docs/xml/vg-entities.xml tests/Makefile - tests/vg_regtest perf/Makefile - perf/vg_perf gdbserver_tests/Makefile gdbserver_tests/solaris/Makefile include/Makefile @@ -5860,6 +5858,10 @@ AC_CONFIG_FILES([tests/filter_stderr_basic], [chmod +x tests/filter_stderr_basic]) AC_CONFIG_FILES([tests/filter_discards], [chmod +x tests/filter_discards]) +AC_CONFIG_FILES([tests/vg_regtest], + [chmod +x tests/vg_regtest]) +AC_CONFIG_FILES([perf/vg_perf], + [chmod +x perf/vg_perf]) AC_CONFIG_FILES([memcheck/tests/filter_stderr], [chmod +x memcheck/tests/filter_stderr]) AC_CONFIG_FILES([memcheck/tests/filter_dw4], diff --git a/coregrind/link_tool_exe_freebsd.in b/coregrind/link_tool_exe_freebsd.in old mode 100755 new mode 100644 diff --git a/coregrind/vgstack.in b/coregrind/vgstack.in old mode 100755 new mode 100644 diff --git a/drd/scripts/download-and-build-splash2.in b/drd/scripts/download-and-build-splash2.in old mode 100755 new mode 100644 diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am old mode 100755 new mode 100644 diff --git a/drd/tests/filter_error_count.in b/drd/tests/filter_error_count.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_error_summary.in b/drd/tests/filter_error_summary.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_stderr.in b/drd/tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_stderr_and_thread_no_and_offset.in b/drd/tests/filter_stderr_and_thread_no_and_offset.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_thread_no.in b/drd/tests/filter_thread_no.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_xml_and_thread_no.in b/drd/tests/filter_xml_and_thread_no.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/Makefile.am b/gdbserver_tests/Makefile.am old mode 100755 new mode 100644 diff --git a/gdbserver_tests/README_DEVELOPERS b/gdbserver_tests/README_DEVELOPERS index c570f3e531..250c14326b 100644 --- a/gdbserver_tests/README_DEVELOPERS +++ b/gdbserver_tests/README_DEVELOPERS @@ -15,7 +15,7 @@ or (to just run the gdbserver tests with another gdb): make check cd .. gdbserver_tests/make_local_links /path/to/another/gdb - perl tests/vg_regtest gdbserver_tests + tests/vg_regtest gdbserver_tests The minimum version to run the tests is gdb >= 6.5. Previous versions do not have the 'target remote |' command. It @@ -45,7 +45,7 @@ You are welcome to fix such bugs by enhancing filter_gdb. Alternatively, to report such problems, the best is to re-run the gdbserver tests the following way: - perl tests/vg_regtest --keep-unfiltered gdbserver_tests + tests/vg_regtest --keep-unfiltered gdbserver_tests Then file a bug in bugzilla, giving the following information: output of diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/filter_memcheck_monitor.in b/gdbserver_tests/filter_memcheck_monitor.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/filter_stderr.in b/gdbserver_tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/filter_vgdb.in b/gdbserver_tests/filter_vgdb.in old mode 100755 new mode 100644 diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am old mode 100755 new mode 100644 diff --git a/helgrind/tests/filter_stderr.in b/helgrind/tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/massif/ms_print.in b/massif/ms_print.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_dw4.in b/memcheck/tests/filter_dw4.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_overlaperror.in b/memcheck/tests/filter_overlaperror.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_stderr.in b/memcheck/tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_supp.in b/memcheck/tests/filter_supp.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/x86/filter_pushfpopf.in b/memcheck/tests/x86/filter_pushfpopf.in old mode 100755 new mode 100644 diff --git a/tests/filter_discards.in b/tests/filter_discards.in old mode 100755 new mode 100644 diff --git a/tests/filter_stderr_basic.in b/tests/filter_stderr_basic.in old mode 100755 new mode 100644 diff --git a/tests/platform_test b/tests/platform_test old mode 100644 new mode 100755 diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in old mode 100755 new mode 100644 index 3471322b0f..945b4c1617 --- a/tests/vg_regtest.in +++ b/tests/vg_regtest.in @@ -692,7 +692,7 @@ sub test_one_dir($$) if (256 == system("$tests_dir/tests/arch_test $dir")) { return; } if (256 == system("$tests_dir/tests/os_test $dir")) { return; } if ($dir =~ /(\w+)-(\w+)/ && - 256 == system("sh $tests_dir/tests/platform_test $1 $2")) { return; } + 256 == system("$tests_dir/tests/platform_test $1 $2")) { return; } if ($dir =~ "dSYM") { return; } chdir($dir) or die "Could not change into $dir\n"; |
|
From: Florian K. <fk...@so...> - 2025-09-26 21:51:45
|
https://sourceware.org/cgit/valgrind/commit/?id=1109ef57b23cf84be551cb9d25373a8169bedce4 commit 1109ef57b23cf84be551cb9d25373a8169bedce4 Author: Florian Krohm <fl...@ei...> Date: Fri Sep 26 21:50:39 2025 +0000 s390: Assorted BFP testsuite tweaks Rename rounding-1 to bfp-306054 because that was the corresponding BZ. Rename bfp-3 to bfp-muldiv as it is more expressive. Only compile testcases for 128-bit BFP if the compiler supports -mlong-double-128. Add -mlong-double-128 to the compile flags for the files that need it. This concludes fixing https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 4 ++-- NEWS | 1 + none/tests/s390x/Makefile.am | 18 ++++++++++++++++-- none/tests/s390x/bfp-3.vgtest | 1 - none/tests/s390x/{rounding-1.c => bfp-306054.c} | 0 .../s390x/{bfp-3.stderr.exp => bfp-306054.stderr.exp} | 0 .../{rounding-1.stdout.exp => bfp-306054.stdout.exp} | 0 none/tests/s390x/bfp-306054.vgtest | 1 + none/tests/s390x/{bfp-3.c => bfp-muldiv.c} | 0 .../{rounding-1.stderr.exp => bfp-muldiv.stderr.exp} | 0 .../s390x/{bfp-3.stdout.exp => bfp-muldiv.stdout.exp} | 0 none/tests/s390x/bfp-muldiv.vgtest | 1 + none/tests/s390x/rounding-1.vgtest | 1 - 13 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 53e2a0f83d..645f261bcd 100644 --- a/.gitignore +++ b/.gitignore @@ -2184,12 +2184,12 @@ /none/tests/s390x/ecag /none/tests/s390x/fpext_warn /none/tests/s390x/fpext_fail -/none/tests/s390x/rounding-1 +/none/tests/s390x/bfp-306054 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load /none/tests/s390x/bfp-fpc /none/tests/s390x/bfp-tdc -/none/tests/s390x/bfp-3 +/none/tests/s390x/bfp-muldiv /none/tests/s390x/bfp-compare /none/tests/s390x/bfp-convert /none/tests/s390x/comp-1 diff --git a/NEWS b/NEWS index d7f0cb3ba2..147f4f56f5 100644 --- a/NEWS +++ b/NEWS @@ -139,6 +139,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns +509572 s390x: Overhaul BFP testsuite 509566 Wrap amd64-linux syscall: 442 (mount_setattr) 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index abe71570fb..66254c3bbf 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,8 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \ - bfp-tdc bfp-load bfp-fpc bfp-convert rounding-1 bfp-arith \ - bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ + bfp-fpc bfp-306054 \ + bfp-muldiv comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ @@ -24,6 +24,10 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \ hfp +if HAS_MLONG_DOUBLE_128 +INSN_TESTS += bfp-arith bfp-compare bfp-convert bfp-load bfp-tdc +endif + check_PROGRAMS = $(INSN_TESTS) \ allexec \ op00 @@ -34,6 +38,11 @@ EXTRA_DIST = \ $(addsuffix .stderr.exp,$(INSN_TESTS)) \ $(addsuffix .stdout.exp,$(INSN_TESTS)) \ $(addsuffix .vgtest,$(INSN_TESTS)) \ + bfp-arith.vgtest bfp-arith.stdout.exp bfp-arith.stderr.exp \ + bfp-compare.vgtest bfp-compare.stdout.exp bfp-compare.stderr.exp \ + bfp-convert.vgtest bfp-convert.stdout.exp bfp-convert.stderr.exp \ + bfp-load.vgtest bfp-load.stdout.exp bfp-load.stderr.exp \ + bfp-tdc.vgtest bfp-tdc.stdout.exp bfp-tdc.stderr.exp \ bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ @@ -69,3 +78,8 @@ vector_integer_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4 vector_float_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4 vec2_CFLAGS = $(AM_CFLAGS) -march=z13 vec2_float_CFLAGS = $(AM_CFLAGS) -march=z13 +bfp_arith_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_compare_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_convert_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_load_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_tdc_CFLAGS = $(AM_CFLAGS) -mlong-double-128 diff --git a/none/tests/s390x/bfp-3.vgtest b/none/tests/s390x/bfp-3.vgtest deleted file mode 100644 index 8088d7d646..0000000000 --- a/none/tests/s390x/bfp-3.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-3 diff --git a/none/tests/s390x/rounding-1.c b/none/tests/s390x/bfp-306054.c similarity index 100% rename from none/tests/s390x/rounding-1.c rename to none/tests/s390x/bfp-306054.c diff --git a/none/tests/s390x/bfp-3.stderr.exp b/none/tests/s390x/bfp-306054.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-3.stderr.exp rename to none/tests/s390x/bfp-306054.stderr.exp diff --git a/none/tests/s390x/rounding-1.stdout.exp b/none/tests/s390x/bfp-306054.stdout.exp similarity index 100% rename from none/tests/s390x/rounding-1.stdout.exp rename to none/tests/s390x/bfp-306054.stdout.exp diff --git a/none/tests/s390x/bfp-306054.vgtest b/none/tests/s390x/bfp-306054.vgtest new file mode 100644 index 0000000000..3948f34274 --- /dev/null +++ b/none/tests/s390x/bfp-306054.vgtest @@ -0,0 +1 @@ +prog: bfp-306054 diff --git a/none/tests/s390x/bfp-3.c b/none/tests/s390x/bfp-muldiv.c similarity index 100% rename from none/tests/s390x/bfp-3.c rename to none/tests/s390x/bfp-muldiv.c diff --git a/none/tests/s390x/rounding-1.stderr.exp b/none/tests/s390x/bfp-muldiv.stderr.exp similarity index 100% rename from none/tests/s390x/rounding-1.stderr.exp rename to none/tests/s390x/bfp-muldiv.stderr.exp diff --git a/none/tests/s390x/bfp-3.stdout.exp b/none/tests/s390x/bfp-muldiv.stdout.exp similarity index 100% rename from none/tests/s390x/bfp-3.stdout.exp rename to none/tests/s390x/bfp-muldiv.stdout.exp diff --git a/none/tests/s390x/bfp-muldiv.vgtest b/none/tests/s390x/bfp-muldiv.vgtest new file mode 100644 index 0000000000..df1275fa7e --- /dev/null +++ b/none/tests/s390x/bfp-muldiv.vgtest @@ -0,0 +1 @@ +prog: bfp-muldiv diff --git a/none/tests/s390x/rounding-1.vgtest b/none/tests/s390x/rounding-1.vgtest deleted file mode 100644 index 4c1e45b2bc..0000000000 --- a/none/tests/s390x/rounding-1.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-1 |
|
From: Mark W. <ma...@so...> - 2025-09-24 22:36:15
|
https://sourceware.org/cgit/valgrind/commit/?id=b2c27072b05777fe8dc6d32791de1e4eff044ebb commit b2c27072b05777fe8dc6d32791de1e4eff044ebb Author: Mark Wielaard <ma...@kl...> Date: Wed Sep 24 23:16:29 2025 +0200 Deal with linux arches that don't have getdents, only getdents64 Not all linux arches have getdents, some newer arches (arm64 and riscv64) only implement getdents64. So only use the function filter_valgrind_fds_from_getdents_with_refill on linux with __NR_getdents. Also move the getdents_filter testcase under none/tests/linux and only use getdents64. Fixes: e8e4066c3a01 ("Filter Valgrind FDs from getdents syscalls") https://bugs.kde.org/show_bug.cgi?id=331311 Diff: --- coregrind/m_syswrap/syswrap-generic.c | 15 +++++++++++++++ none/tests/Makefile.am | 2 -- none/tests/linux/Makefile.am | 2 ++ none/tests/{ => linux}/getdents_filter.c | 15 +++++++++------ none/tests/{ => linux}/getdents_filter.stderr.exp | 0 none/tests/{ => linux}/getdents_filter.stdout.exp | 0 none/tests/{ => linux}/getdents_filter.vgtest | 0 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 33b58f5a5e..3786e9cd89 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4045,6 +4045,10 @@ static Bool should_keep_fd_entry(const HChar *name) return True; } +/* Make sure we really need the proc filtering using (32bit) getdents, + which not every linux arch implements. */ +#if defined(VGO_linux) && defined(__NR_getdents) + /* Filter and compact dirent entries */ static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) { @@ -4067,6 +4071,7 @@ static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) return new_size; } +#endif /* defined(VGO_linux) && defined(__NR_getdents) */ /* Filter and compact dirent64 entries */ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) @@ -4091,6 +4096,10 @@ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) return new_size; } +/* Make sure we really need the proc filtering using (32bit) getdents, + which not every linux arch implements. */ +#if defined(VGO_linux) && defined(__NR_getdents) + /* Filter out Valgrind's internal file descriptors from getdents results with refill capability. When entries are filtered out, attempts to read more entries to avoid empty results. Returns filtered size on success, or -1 if retry syscall failed. */ @@ -4119,6 +4128,7 @@ static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_di return new_size; } +#endif /* defined(VGO_linux) && defined(__NR_getdents) */ /* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability. Same logic as getdents version but for 64-bit dirent structures. @@ -4155,6 +4165,10 @@ POST(sys_getdents) if (RES > 0) { SizeT result_size = RES; + /* Make sure we really need the proc filtering using (32bit) getdents, + which not every linux arch implements. */ +#if defined(VGO_linux) && defined(__NR_getdents) + /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ if (is_proc_fd_directory(ARG1)) { SizeT filtered_size = filter_valgrind_fds_from_getdents_with_refill(ARG1, (struct vki_dirent *)ARG2, RES, ARG3, status); @@ -4166,6 +4180,7 @@ POST(sys_getdents) if (result_size != RES) SET_STATUS_Success(result_size); } +#endif /* defined(VGO_linux) && defined(__NR_getdents) */ POST_MEM_WRITE( ARG2, result_size ); } diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index ccdd85e53e..716ce000d3 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -172,7 +172,6 @@ EXTRA_DIST = \ floored.stderr.exp floored.stdout.exp floored.vgtest \ fork.stderr.exp fork.stdout.exp fork.vgtest \ fucomip.stderr.exp fucomip.vgtest \ - getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \ gxx304.stderr.exp gxx304.vgtest \ ifunc.stderr.exp ifunc.stdout.exp ifunc.vgtest \ ioctl_moans.stderr.exp ioctl_moans.vgtest \ @@ -292,7 +291,6 @@ check_PROGRAMS = \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ - getdents_filter \ ioctl_moans \ libvex_test \ libvexmultiarch_test \ diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am index 7bfcedc862..55426e2b26 100644 --- a/none/tests/linux/Makefile.am +++ b/none/tests/linux/Makefile.am @@ -10,6 +10,7 @@ EXTRA_DIST = \ bug498317.stderr.exp bug498317.supp bug498317.vgtest \ bug506910.stderr.exp bug506910.vgtest \ clonev.stdout.exp clonev.stderr.exp clonev.vgtest \ + getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \ membarrier.stderr.exp membarrier.vgtest \ mremap.stderr.exp mremap.stderr.exp-glibc27 mremap.stdout.exp \ mremap.vgtest \ @@ -28,6 +29,7 @@ check_PROGRAMS = \ brk-overflow2 \ bug498317 \ clonev \ + getdents_filter \ mremap \ mremap2 \ mremap3 \ diff --git a/none/tests/getdents_filter.c b/none/tests/linux/getdents_filter.c similarity index 92% rename from none/tests/getdents_filter.c rename to none/tests/linux/getdents_filter.c index d508cdde0f..361659f51d 100644 --- a/none/tests/getdents_filter.c +++ b/none/tests/linux/getdents_filter.c @@ -13,10 +13,11 @@ #include <sys/syscall.h> #include <sys/types.h> -struct linux_dirent { - unsigned long d_ino; - off_t d_off; +struct linux_dirent64 { + ino64_t d_ino; + off64_t d_off; unsigned short d_reclen; + unsigned char d_type; char d_name[]; }; @@ -67,7 +68,7 @@ static void test_retry_logic_with_small_buffer(void) int fd; char buf[SMALL_BUF_SIZE]; long nread; - struct linux_dirent *d; + struct linux_dirent64 *d; printf("retry_test_start\n"); @@ -83,7 +84,9 @@ static void test_retry_logic_with_small_buffer(void) * may return only Valgrind FDs, which will trigger the retry mechanism. */ for (;;) { - nread = syscall(SYS_getdents, fd, buf, SMALL_BUF_SIZE); + /* Note, using getdents64 since some linux arches don't implement + the 32bit getdents. */ + nread = syscall(SYS_getdents64, fd, buf, SMALL_BUF_SIZE); if (nread == -1) { printf("retry_test_error\n"); @@ -97,7 +100,7 @@ static void test_retry_logic_with_small_buffer(void) /* Print client FD entries found in this buffer (excluding . and ..) */ for (size_t bpos = 0; bpos < nread;) { - d = (struct linux_dirent *)(buf + bpos); + d = (struct linux_dirent64 *)(buf + bpos); if (strcmp(d->d_name, ".") != 0 && strcmp(d->d_name, "..") != 0) { char *endptr; long fd_num = strtol(d->d_name, &endptr, 10); diff --git a/none/tests/getdents_filter.stderr.exp b/none/tests/linux/getdents_filter.stderr.exp similarity index 100% rename from none/tests/getdents_filter.stderr.exp rename to none/tests/linux/getdents_filter.stderr.exp diff --git a/none/tests/getdents_filter.stdout.exp b/none/tests/linux/getdents_filter.stdout.exp similarity index 100% rename from none/tests/getdents_filter.stdout.exp rename to none/tests/linux/getdents_filter.stdout.exp diff --git a/none/tests/getdents_filter.vgtest b/none/tests/linux/getdents_filter.vgtest similarity index 100% rename from none/tests/getdents_filter.vgtest rename to none/tests/linux/getdents_filter.vgtest |
|
From: Florian K. <fk...@so...> - 2025-09-24 20:58:38
|
https://sourceware.org/cgit/valgrind/commit/?id=c574f5eb10d06b491512806354f8d15c3d3e020a commit c574f5eb10d06b491512806354f8d15c3d3e020a Author: Florian Krohm <fl...@ei...> Date: Wed Sep 24 20:54:22 2025 +0000 s390: Remove rounding-6 BFP testcase (convert to int) Should have been part of 18c5454874d. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 1 - none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/rounding-6.c | 159 ------------------------ none/tests/s390x/rounding-6.stderr.exp | 2 - none/tests/s390x/rounding-6.stdout.exp | 216 --------------------------------- none/tests/s390x/rounding-6.vgtest | 1 - 6 files changed, 1 insertion(+), 380 deletions(-) diff --git a/.gitignore b/.gitignore index b059789b86..53e2a0f83d 100644 --- a/.gitignore +++ b/.gitignore @@ -2185,7 +2185,6 @@ /none/tests/s390x/fpext_warn /none/tests/s390x/fpext_fail /none/tests/s390x/rounding-1 -/none/tests/s390x/rounding-6 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load /none/tests/s390x/bfp-fpc diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index afa61c94b8..abe71570fb 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -11,7 +11,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \ bfp-tdc bfp-load bfp-fpc bfp-convert rounding-1 bfp-arith \ bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ - ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ + ex clst mvc test_fork test_sig rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ spechelper-slr spechelper-slgr \ diff --git a/none/tests/s390x/rounding-6.c b/none/tests/s390x/rounding-6.c deleted file mode 100644 index e880876829..0000000000 --- a/none/tests/s390x/rounding-6.c +++ /dev/null @@ -1,159 +0,0 @@ -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include <stdint.h> -#include <inttypes.h> -#include "opcodes.h" -#include "rounding.h" - -/* Test "convert to fixed" with rounding mode given in insn (m3 field) - Covers all generally available rounding modes that can be mapped to - IRRoundingMode. As a consequence m3=1 which is "round to nearest with - ties away from 0" is not tested here. -*/ - -const char * -rtext(unsigned m3_round) -{ - switch (m3_round) { - case 0: return "[-> per fpc]"; - case 1: return "[-> nearest away]"; - case 3: return "[-> prepare short]"; // floating point extension fac needed - case 4: return "[-> nearest even]"; - case 5: return "[-> 0]"; - case 6: return "[-> +inf]"; - case 7: return "[-> -inf]"; - } - assert(0); -} - -#define convert_to_int(opcode,src_type,dst_type,dst_fmt,round,value) \ -do { \ - src_type src = value; \ - dst_type dst; \ - unsigned cc; \ - \ - __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ - "ipm %[cc]\n\t" \ - "srl %[cc],28\n\t" \ - : [dst] "=d"(dst), [cc] "=d"(cc) \ - : [src] "f"(src) \ - : "cc"); \ - \ - printf("%s %f\t-> %"dst_fmt"\tcc = %u %s\n", \ - opcode, src, dst, cc, rtext(round)); \ -} while (0) - -#define round_to_int(opcode,type,round,value) \ -do { \ - type src = value; \ - type dst; \ - \ - __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ - : [dst] "=f"(dst) \ - : [src] "f"(src)); \ - \ - printf("%s %.5f\t-> %g %s\n", \ - opcode, src, dst, rtext(round)); \ -} while (0) - - -#define cfebr(value, round) \ - convert_to_int("cfebr",float,int32_t,PRId32,round,value) -#define cfdbr(value, round) \ - convert_to_int("cfdbr",double,int32_t,PRId32,round,value) -#define cgebr(value, round) \ - convert_to_int("cgebr",float,int64_t,PRId64,round,value) -#define cgdbr(value, round) \ - convert_to_int("cgdbr",double,int64_t,PRId64,round,value) - -#define fiebr(value, round) \ - round_to_int("fiebr",float,round,value) -#define fidbr(value, round) \ - round_to_int("fidbr",double,round,value) - -void -set_rounding_mode(unsigned mode) -{ - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - - -int main(void) -{ - int j; - static const float fval[] = { - 1.25f, 1.5f, 2.5f, 1.75f, -1.25f, -1.5f, -2.5f, -1.75f, 0.0f, - }; - static const double dval[] = { - 1.25, 1.5, 2.5, 1.75, -1.25, -1.5, -2.5, -1.75, 0.0, - }; - - /* Note when testing M3_NEAR need to set the FPC rounding mode - to something else. FPC rounding mode is NEAR by default. - Setting the FPC rounding mode to != NEAR is the only way to make - sure the M3 field is not ignored. */ - - /* f32 -> i32 */ - for (j = 0; j < sizeof fval / sizeof fval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cfebr(fval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cfebr(fval[j], M3_BFP_ROUND_ZERO); - cfebr(fval[j], M3_BFP_ROUND_POSINF); - cfebr(fval[j], M3_BFP_ROUND_NEGINF); - } - - /* f32 -> i64 */ - for (j = 0; j < sizeof fval / sizeof fval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cgebr(fval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cgebr(fval[j], M3_BFP_ROUND_ZERO); - cgebr(fval[j], M3_BFP_ROUND_POSINF); - cgebr(fval[j], M3_BFP_ROUND_NEGINF); - } - - /* f64 -> i32 */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cfdbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cfdbr(dval[j], M3_BFP_ROUND_ZERO); - cfdbr(dval[j], M3_BFP_ROUND_POSINF); - cfdbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - /* f64 -> i64 */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cgdbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cgdbr(dval[j], M3_BFP_ROUND_ZERO); - cgdbr(dval[j], M3_BFP_ROUND_POSINF); - cgdbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - /* f32 -> f32, round to int */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - fiebr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - fiebr(dval[j], M3_BFP_ROUND_ZERO); - fiebr(dval[j], M3_BFP_ROUND_POSINF); - fiebr(dval[j], M3_BFP_ROUND_NEGINF); - } - - /* f64 -> f64, round to int */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - fidbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - fidbr(dval[j], M3_BFP_ROUND_ZERO); - fidbr(dval[j], M3_BFP_ROUND_POSINF); - fidbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - return 0; -} diff --git a/none/tests/s390x/rounding-6.stderr.exp b/none/tests/s390x/rounding-6.stderr.exp deleted file mode 100644 index 139597f9cb..0000000000 --- a/none/tests/s390x/rounding-6.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/rounding-6.stdout.exp b/none/tests/s390x/rounding-6.stdout.exp deleted file mode 100644 index f01a22973c..0000000000 --- a/none/tests/s390x/rounding-6.stdout.exp +++ /dev/null @@ -1,216 +0,0 @@ -cfebr 1.250000 -> 1 cc = 2 [-> nearest even] -cfebr 1.250000 -> 1 cc = 2 [-> 0] -cfebr 1.250000 -> 2 cc = 2 [-> +inf] -cfebr 1.250000 -> 1 cc = 2 [-> -inf] -cfebr 1.500000 -> 2 cc = 2 [-> nearest even] -cfebr 1.500000 -> 1 cc = 2 [-> 0] -cfebr 1.500000 -> 2 cc = 2 [-> +inf] -cfebr 1.500000 -> 1 cc = 2 [-> -inf] -cfebr 2.500000 -> 2 cc = 2 [-> nearest even] -cfebr 2.500000 -> 2 cc = 2 [-> 0] -cfebr 2.500000 -> 3 cc = 2 [-> +inf] -cfebr 2.500000 -> 2 cc = 2 [-> -inf] -cfebr 1.750000 -> 2 cc = 2 [-> nearest even] -cfebr 1.750000 -> 1 cc = 2 [-> 0] -cfebr 1.750000 -> 2 cc = 2 [-> +inf] -cfebr 1.750000 -> 1 cc = 2 [-> -inf] -cfebr -1.250000 -> -1 cc = 1 [-> nearest even] -cfebr -1.250000 -> -1 cc = 1 [-> 0] -cfebr -1.250000 -> -1 cc = 1 [-> +inf] -cfebr -1.250000 -> -2 cc = 1 [-> -inf] -cfebr -1.500000 -> -2 cc = 1 [-> nearest even] -cfebr -1.500000 -> -1 cc = 1 [-> 0] -cfebr -1.500000 -> -1 cc = 1 [-> +inf] -cfebr -1.500000 -> -2 cc = 1 [-> -inf] -cfebr -2.500000 -> -2 cc = 1 [-> nearest even] -cfebr -2.500000 -> -2 cc = 1 [-> 0] -cfebr -2.500000 -> -2 cc = 1 [-> +inf] -cfebr -2.500000 -> -3 cc = 1 [-> -inf] -cfebr -1.750000 -> -2 cc = 1 [-> nearest even] -cfebr -1.750000 -> -1 cc = 1 [-> 0] -cfebr -1.750000 -> -1 cc = 1 [-> +inf] -cfebr -1.750000 -> -2 cc = 1 [-> -inf] -cfebr 0.000000 -> 0 cc = 0 [-> nearest even] -cfebr 0.000000 -> 0 cc = 0 [-> 0] -cfebr 0.000000 -> 0 cc = 0 [-> +inf] -cfebr 0.000000 -> 0 cc = 0 [-> -inf] -cgebr 1.250000 -> 1 cc = 2 [-> nearest even] -cgebr 1.250000 -> 1 cc = 2 [-> 0] -cgebr 1.250000 -> 2 cc = 2 [-> +inf] -cgebr 1.250000 -> 1 cc = 2 [-> -inf] -cgebr 1.500000 -> 2 cc = 2 [-> nearest even] -cgebr 1.500000 -> 1 cc = 2 [-> 0] -cgebr 1.500000 -> 2 cc = 2 [-> +inf] -cgebr 1.500000 -> 1 cc = 2 [-> -inf] -cgebr 2.500000 -> 2 cc = 2 [-> nearest even] -cgebr 2.500000 -> 2 cc = 2 [-> 0] -cgebr 2.500000 -> 3 cc = 2 [-> +inf] -cgebr 2.500000 -> 2 cc = 2 [-> -inf] -cgebr 1.750000 -> 2 cc = 2 [-> nearest even] -cgebr 1.750000 -> 1 cc = 2 [-> 0] -cgebr 1.750000 -> 2 cc = 2 [-> +inf] -cgebr 1.750000 -> 1 cc = 2 [-> -inf] -cgebr -1.250000 -> -1 cc = 1 [-> nearest even] -cgebr -1.250000 -> -1 cc = 1 [-> 0] -cgebr -1.250000 -> -1 cc = 1 [-> +inf] -cgebr -1.250000 -> -2 cc = 1 [-> -inf] -cgebr -1.500000 -> -2 cc = 1 [-> nearest even] -cgebr -1.500000 -> -1 cc = 1 [-> 0] -cgebr -1.500000 -> -1 cc = 1 [-> +inf] -cgebr -1.500000 -> -2 cc = 1 [-> -inf] -cgebr -2.500000 -> -2 cc = 1 [-> nearest even] -cgebr -2.500000 -> -2 cc = 1 [-> 0] -cgebr -2.500000 -> -2 cc = 1 [-> +inf] -cgebr -2.500000 -> -3 cc = 1 [-> -inf] -cgebr -1.750000 -> -2 cc = 1 [-> nearest even] -cgebr -1.750000 -> -1 cc = 1 [-> 0] -cgebr -1.750000 -> -1 cc = 1 [-> +inf] -cgebr -1.750000 -> -2 cc = 1 [-> -inf] -cgebr 0.000000 -> 0 cc = 0 [-> nearest even] -cgebr 0.000000 -> 0 cc = 0 [-> 0] -cgebr 0.000000 -> 0 cc = 0 [-> +inf] -cgebr 0.000000 -> 0 cc = 0 [-> -inf] -cfdbr 1.250000 -> 1 cc = 2 [-> nearest even] -cfdbr 1.250000 -> 1 cc = 2 [-> 0] -cfdbr 1.250000 -> 2 cc = 2 [-> +inf] -cfdbr 1.250000 -> 1 cc = 2 [-> -inf] -cfdbr 1.500000 -> 2 cc = 2 [-> nearest even] -cfdbr 1.500000 -> 1 cc = 2 [-> 0] -cfdbr 1.500000 -> 2 cc = 2 [-> +inf] -cfdbr 1.500000 -> 1 cc = 2 [-> -inf] -cfdbr 2.500000 -> 2 cc = 2 [-> nearest even] -cfdbr 2.500000 -> 2 cc = 2 [-> 0] -cfdbr 2.500000 -> 3 cc = 2 [-> +inf] -cfdbr 2.500000 -> 2 cc = 2 [-> -inf] -cfdbr 1.750000 -> 2 cc = 2 [-> nearest even] -cfdbr 1.750000 -> 1 cc = 2 [-> 0] -cfdbr 1.750000 -> 2 cc = 2 [-> +inf] -cfdbr 1.750000 -> 1 cc = 2 [-> -inf] -cfdbr -1.250000 -> -1 cc = 1 [-> nearest even] -cfdbr -1.250000 -> -1 cc = 1 [-> 0] -cfdbr -1.250000 -> -1 cc = 1 [-> +inf] -cfdbr -1.250000 -> -2 cc = 1 [-> -inf] -cfdbr -1.500000 -> -2 cc = 1 [-> nearest even] -cfdbr -1.500000 -> -1 cc = 1 [-> 0] -cfdbr -1.500000 -> -1 cc = 1 [-> +inf] -cfdbr -1.500000 -> -2 cc = 1 [-> -inf] -cfdbr -2.500000 -> -2 cc = 1 [-> nearest even] -cfdbr -2.500000 -> -2 cc = 1 [-> 0] -cfdbr -2.500000 -> -2 cc = 1 [-> +inf] -cfdbr -2.500000 -> -3 cc = 1 [-> -inf] -cfdbr -1.750000 -> -2 cc = 1 [-> nearest even] -cfdbr -1.750000 -> -1 cc = 1 [-> 0] -cfdbr -1.750000 -> -1 cc = 1 [-> +inf] -cfdbr -1.750000 -> -2 cc = 1 [-> -inf] -cfdbr 0.000000 -> 0 cc = 0 [-> nearest even] -cfdbr 0.000000 -> 0 cc = 0 [-> 0] -cfdbr 0.000000 -> 0 cc = 0 [-> +inf] -cfdbr 0.000000 -> 0 cc = 0 [-> -inf] -cgdbr 1.250000 -> 1 cc = 2 [-> nearest even] -cgdbr 1.250000 -> 1 cc = 2 [-> 0] -cgdbr 1.250000 -> 2 cc = 2 [-> +inf] -cgdbr 1.250000 -> 1 cc = 2 [-> -inf] -cgdbr 1.500000 -> 2 cc = 2 [-> nearest even] -cgdbr 1.500000 -> 1 cc = 2 [-> 0] -cgdbr 1.500000 -> 2 cc = 2 [-> +inf] -cgdbr 1.500000 -> 1 cc = 2 [-> -inf] -cgdbr 2.500000 -> 2 cc = 2 [-> nearest even] -cgdbr 2.500000 -> 2 cc = 2 [-> 0] -cgdbr 2.500000 -> 3 cc = 2 [-> +inf] -cgdbr 2.500000 -> 2 cc = 2 [-> -inf] -cgdbr 1.750000 -> 2 cc = 2 [-> nearest even] -cgdbr 1.750000 -> 1 cc = 2 [-> 0] -cgdbr 1.750000 -> 2 cc = 2 [-> +inf] -cgdbr 1.750000 -> 1 cc = 2 [-> -inf] -cgdbr -1.250000 -> -1 cc = 1 [-> nearest even] -cgdbr -1.250000 -> -1 cc = 1 [-> 0] -cgdbr -1.250000 -> -1 cc = 1 [-> +inf] -cgdbr -1.250000 -> -2 cc = 1 [-> -inf] -cgdbr -1.500000 -> -2 cc = 1 [-> nearest even] -cgdbr -1.500000 -> -1 cc = 1 [-> 0] -cgdbr -1.500000 -> -1 cc = 1 [-> +inf] -cgdbr -1.500000 -> -2 cc = 1 [-> -inf] -cgdbr -2.500000 -> -2 cc = 1 [-> nearest even] -cgdbr -2.500000 -> -2 cc = 1 [-> 0] -cgdbr -2.500000 -> -2 cc = 1 [-> +inf] -cgdbr -2.500000 -> -3 cc = 1 [-> -inf] -cgdbr -1.750000 -> -2 cc = 1 [-> nearest even] -cgdbr -1.750000 -> -1 cc = 1 [-> 0] -cgdbr -1.750000 -> -1 cc = 1 [-> +inf] -cgdbr -1.750000 -> -2 cc = 1 [-> -inf] -cgdbr 0.000000 -> 0 cc = 0 [-> nearest even] -cgdbr 0.000000 -> 0 cc = 0 [-> 0] -cgdbr 0.000000 -> 0 cc = 0 [-> +inf] -cgdbr 0.000000 -> 0 cc = 0 [-> -inf] -fiebr 1.25000 -> 1 [-> nearest even] -fiebr 1.25000 -> 1 [-> 0] -fiebr 1.25000 -> 2 [-> +inf] -fiebr 1.25000 -> 1 [-> -inf] -fiebr 1.50000 -> 2 [-> nearest even] -fiebr 1.50000 -> 1 [-> 0] -fiebr 1.50000 -> 2 [-> +inf] -fiebr 1.50000 -> 1 [-> -inf] -fiebr 2.50000 -> 2 [-> nearest even] -fiebr 2.50000 -> 2 [-> 0] -fiebr 2.50000 -> 3 [-> +inf] -fiebr 2.50000 -> 2 [-> -inf] -fiebr 1.75000 -> 2 [-> nearest even] -fiebr 1.75000 -> 1 [-> 0] -fiebr 1.75000 -> 2 [-> +inf] -fiebr 1.75000 -> 1 [-> -inf] -fiebr -1.25000 -> -1 [-> nearest even] -fiebr -1.25000 -> -1 [-> 0] -fiebr -1.25000 -> -1 [-> +inf] -fiebr -1.25000 -> -2 [-> -inf] -fiebr -1.50000 -> -2 [-> nearest even] -fiebr -1.50000 -> -1 [-> 0] -fiebr -1.50000 -> -1 [-> +inf] -fiebr -1.50000 -> -2 [-> -inf] -fiebr -2.50000 -> -2 [-> nearest even] -fiebr -2.50000 -> -2 [-> 0] -fiebr -2.50000 -> -2 [-> +inf] -fiebr -2.50000 -> -3 [-> -inf] -fiebr -1.75000 -> -2 [-> nearest even] -fiebr -1.75000 -> -1 [-> 0] -fiebr -1.75000 -> -1 [-> +inf] -fiebr -1.75000 -> -2 [-> -inf] -fiebr 0.00000 -> 0 [-> nearest even] -fiebr 0.00000 -> 0 [-> 0] -fiebr 0.00000 -> 0 [-> +inf] -fiebr 0.00000 -> 0 [-> -inf] -fidbr 1.25000 -> 1 [-> nearest even] -fidbr 1.25000 -> 1 [-> 0] -fidbr 1.25000 -> 2 [-> +inf] -fidbr 1.25000 -> 1 [-> -inf] -fidbr 1.50000 -> 2 [-> nearest even] -fidbr 1.50000 -> 1 [-> 0] -fidbr 1.50000 -> 2 [-> +inf] -fidbr 1.50000 -> 1 [-> -inf] -fidbr 2.50000 -> 2 [-> nearest even] -fidbr 2.50000 -> 2 [-> 0] -fidbr 2.50000 -> 3 [-> +inf] -fidbr 2.50000 -> 2 [-> -inf] -fidbr 1.75000 -> 2 [-> nearest even] -fidbr 1.75000 -> 1 [-> 0] -fidbr 1.75000 -> 2 [-> +inf] -fidbr 1.75000 -> 1 [-> -inf] -fidbr -1.25000 -> -1 [-> nearest even] -fidbr -1.25000 -> -1 [-> 0] -fidbr -1.25000 -> -1 [-> +inf] -fidbr -1.25000 -> -2 [-> -inf] -fidbr -1.50000 -> -2 [-> nearest even] -fidbr -1.50000 -> -1 [-> 0] -fidbr -1.50000 -> -1 [-> +inf] -fidbr -1.50000 -> -2 [-> -inf] -fidbr -2.50000 -> -2 [-> nearest even] -fidbr -2.50000 -> -2 [-> 0] -fidbr -2.50000 -> -2 [-> +inf] -fidbr -2.50000 -> -3 [-> -inf] -fidbr -1.75000 -> -2 [-> nearest even] -fidbr -1.75000 -> -1 [-> 0] -fidbr -1.75000 -> -1 [-> +inf] -fidbr -1.75000 -> -2 [-> -inf] -fidbr 0.00000 -> 0 [-> nearest even] -fidbr 0.00000 -> 0 [-> 0] -fidbr 0.00000 -> 0 [-> +inf] -fidbr 0.00000 -> 0 [-> -inf] diff --git a/none/tests/s390x/rounding-6.vgtest b/none/tests/s390x/rounding-6.vgtest deleted file mode 100644 index 13baa314fc..0000000000 --- a/none/tests/s390x/rounding-6.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-6 |
|
From: Florian K. <fk...@so...> - 2025-09-24 20:28:28
|
https://sourceware.org/cgit/valgrind/commit/?id=18c5454874d9193fb422832523925406f1d32b80 commit 18c5454874d9193fb422832523925406f1d32b80 Author: Florian Krohm <fl...@ei...> Date: Wed Sep 24 20:27:30 2025 +0000 s390: Reorg and extend BFP "convert to/from fixed/logical" testcases Testing these insns was spread over 3 testcases: rounding-3, fpconv, and fpext. rounding-3 was testing "convert to fixed" with rounding per FPC. fpext was testing "convert to/from logical" with rounding per M3 field. fpconv was testing "convert to/from fixed" with rounding per M3 field. The new testcase bfp-convert replaces these 3. It removes the "convert from fixed/logical" testing because that is done in bfp-emit.pl. It consolidates end extends "convert to fixed/logical" testing from those files. Testing "convert to logical" has been commented out until the condition code weirdness for negative input values has been sorted. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 8 +- none/tests/s390x/Makefile.am | 8 +- none/tests/s390x/bfp-convert.c | 325 +++++++++ .../{fpconv.stderr.exp => bfp-convert.stderr.exp} | 0 none/tests/s390x/bfp-convert.stdout.exp | 740 +++++++++++++++++++++ none/tests/s390x/bfp-convert.vgtest | 2 + none/tests/s390x/fpconv.c | 119 ---- none/tests/s390x/fpconv.stdout.exp | 94 --- none/tests/s390x/fpconv.vgtest | 1 - none/tests/s390x/fpext.c | 149 ----- none/tests/s390x/fpext.stderr.exp | 2 - none/tests/s390x/fpext.stdout.exp | 672 ------------------- none/tests/s390x/fpext.vgtest | 2 - none/tests/s390x/fpext_fail.c | 6 + none/tests/s390x/fpext_fail.vgtest | 4 +- none/tests/s390x/rounding-3.c | 113 ---- none/tests/s390x/rounding-3.stderr.exp | 2 - none/tests/s390x/rounding-3.stdout.exp | 148 ----- none/tests/s390x/rounding-3.vgtest | 1 - 19 files changed, 1081 insertions(+), 1315 deletions(-) diff --git a/.gitignore b/.gitignore index de362ecc28..b059789b86 100644 --- a/.gitignore +++ b/.gitignore @@ -2182,18 +2182,17 @@ /none/tests/s390x/cu14_1 /none/tests/s390x/cu41 /none/tests/s390x/ecag -/none/tests/s390x/fpext /none/tests/s390x/fpext_warn -/none/tests/s390x/fpconv +/none/tests/s390x/fpext_fail /none/tests/s390x/rounding-1 -/none/tests/s390x/rounding-2 -/none/tests/s390x/rounding-3 +/none/tests/s390x/rounding-6 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load /none/tests/s390x/bfp-fpc /none/tests/s390x/bfp-tdc /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-compare +/none/tests/s390x/bfp-convert /none/tests/s390x/comp-1 /none/tests/s390x/comp-2 /none/tests/s390x/ex @@ -2218,7 +2217,6 @@ /none/tests/s390x/spechelper-slgr /none/tests/s390x/spechelper-or /none/tests/s390x/spechelper-tm -/none/tests/s390x/rounding-6 /none/tests/s390x/laa /none/tests/s390x/dfp-1 /none/tests/s390x/dfp-2 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 7d2d1f8c48..afa61c94b8 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -8,8 +8,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ op_exception stck stckf stcke stfle cksm mvcl clcl troo \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ - ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc bfp-load bfp-fpc rounding-1 rounding-3 bfp-arith \ + ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \ + bfp-tdc bfp-load bfp-fpc bfp-convert rounding-1 bfp-arith \ bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ @@ -22,7 +22,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ vector_float add-z14 sub-z14 mul-z14 bic \ misc3 vec2 vec2_float \ dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \ - fpext hfp + hfp check_PROGRAMS = $(INSN_TESTS) \ allexec \ @@ -39,8 +39,6 @@ EXTRA_DIST = \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ op00.stderr.exp op00.vgtest \ - fpext.vgtest fpext.stderr.exp fpext.stdout.exp \ - fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \ test.h opcodes.h add.h and.h div.h insert.h dfp_utils.h \ mul.h or.h sub.h xor.h table.h svc.h rounding.h \ dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \ diff --git a/none/tests/s390x/bfp-convert.c b/none/tests/s390x/bfp-convert.c new file mode 100644 index 0000000000..1d0502e41f --- /dev/null +++ b/none/tests/s390x/bfp-convert.c @@ -0,0 +1,325 @@ +/* Test "convert to fixed" and "convert to logical" insns. + + We already know via bfp-emit.pl: + + Testing: cfebr %r0,0,%f1 + Frontend: cfebr %r0,0,%f1 + Assembly: cfebr %r5,0,%f7 + + Testing: celfbr %f0,0,%r1,0 + Frontend: celfbr %f0,0,%r1,0 + Assembly: celfbr %f7,0,%r4,0 + + So the only thing to test for here is the condition code. + + Note, no testing for "convert from ..." insns here, as they are + covered in bfd-emit.pl and do not set the condition code. +*/ +#include <stdio.h> +#include <stdint.h> +#include <math.h> +#include <assert.h> +#include "rounding.h" + +#define convert_to_int(opcode,src_type,dst_type,round,value,fmt) \ + do { \ + src_type src = value; \ + dst_type dst; \ + unsigned cc; \ + \ + __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28\n\t" \ + : [dst]"=d"(dst), [cc]"=d"(cc) \ + : [src]"f"(src) \ + : "cc"); \ + \ + printf("%s "fmt"\tcc = %u\n", opcode, src, cc); \ + \ + __asm__ volatile (opcode "a %[dst]," #round ",%[src],0\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28\n\t" \ + : [dst]"=d"(dst), [cc]"=d"(cc) \ + : [src]"f"(src) \ + : "cc"); \ + \ + printf("%sa "fmt"\tcc = %u\n", opcode, src, cc); \ +} while (0) + +#define convert_to_logical(opcode,src_type,dst_type,round,value,fmt) \ + do { \ + src_type src = value; \ + dst_type dst; \ + unsigned cc; \ + \ + __asm__ volatile (opcode " %[dst]," #round ",%[src], 0\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28\n\t" \ + : [dst]"=d"(dst), [cc]"=d"(cc) \ + : [src]"f"(src) \ + : "cc"); \ + \ + printf("%s "fmt"\tcc = %u\n", opcode, src, cc); \ +} while (0) + +/* Convenience macros */ +#define cfebr(value,round) \ + convert_to_int("cfebr",float,int32_t,round,value,"%f") +#define cfdbr(value,round) \ + convert_to_int("cfdbr",double,int32_t,round,value,"%f") +#define cfxbr(value,round) \ + convert_to_int("cfxbr",long double,int32_t,round,value,"%Lf") +#define cgebr(value,round) \ + convert_to_int("cgebr",float,int64_t,round,value,"%f") +#define cgdbr(value,round) \ + convert_to_int("cgdbr",double,int64_t,round,value,"%f") +#define cgxbr(value,round) \ + convert_to_int("cgxbr",long double,int64_t,round,value,"%Lf") + +#define clfebr(value,round) \ + convert_to_logical("clfebr",float,uint32_t,round,value,"%f") +#define clfdbr(value,round) \ + convert_to_logical("clfdbr",double,uint32_t,round,value,"%f") +#define clfxbr(value,round) \ + convert_to_logical("clfxbr",long double,uint32_t,round,value,"%Lf") +#define clgebr(value,round) \ + convert_to_logical("clgebr",float,uint64_t,round,value,"%f") +#define clgdbr(value,round) \ + convert_to_logical("clgdbr",double,uint64_t,round,value,"%f") +#define clgxbr(value,round) \ + convert_to_logical("clgxbr",long double,uint64_t,round,value,"%Lf") + +#define convert_to_int_m3_tests(mode) \ + printf("...setting M3 rounding mode to %s\n", m3_rtext(mode)); \ + \ + /* f32 -> i32 */ \ + printf("......f32 -> i32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cfebr(values[j], mode); \ + \ + /* f32 -> i64 */ \ + printf("......f32 -> i64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cgebr(values[j], mode); \ + \ + /* f64 -> i32 */ \ + printf("......f64 -> i32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cfdbr(values[j], mode); \ + \ + /* f64 -> i64 */ \ + printf("......f64 -> i64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cgdbr(values[j], mode); \ + \ + /* f128 -> i32 */ \ + printf("......f128 -> i32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cfxbr(values[j], mode); \ + \ + /* f128 -> i64 */ \ + printf("......f128 -> i64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cgxbr(values[j], mode); + +#define convert_to_logical_m3_tests(mode) \ + printf("...setting M3 rounding mode to %s\n", m3_rtext(mode)); \ + \ + /* f32 -> u32 */ \ + printf("......f32 -> u32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clfebr(values[j], mode); \ + \ + /* f32 -> u64 */ \ + printf("......f32 -> u64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clgebr(values[j], mode); \ + \ + /* f64 -> u32 */ \ + printf("......f64 -> u32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clfdbr(values[j], mode); \ + \ + /* f64 -> u64 */ \ + printf("......f64 -> u64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clgdbr(values[j], mode); \ + \ + /* f128 -> u32 */ \ + printf("......f128 -> u32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clfxbr(values[j], mode); \ + \ + /* f128 -> u64 */ \ + printf("......f128 -> u64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clgxbr(values[j], mode); + +static void +set_rounding_mode(unsigned mode) +{ + __asm__ volatile ("sfpc %[r1]" : : [r1]"d"(mode)); +} + +static const char * +fpc_rtext(unsigned fpc_round) +{ + switch (fpc_round) { + case FPC_BFP_ROUND_NEAREST_EVEN: return "[-> near]"; + case FPC_BFP_ROUND_ZERO: return "[-> zero]"; + case FPC_BFP_ROUND_POSINF: return "[-> +inf]"; + case FPC_BFP_ROUND_NEGINF: return "[-> -inf]"; + case FPC_BFP_ROUND_PREPARE_SHORT: return "[-> prepare-short]"; + } + assert(0); +} + +static const char * +m3_rtext(unsigned m3_round) +{ + switch (m3_round) { + case M3_BFP_ROUND_PER_FPC: return "[per fpc]"; + case M3_BFP_ROUND_NEAREST_AWAY: return "[-> near away]"; + case M3_BFP_ROUND_PREPARE_SHORT: return "[-> prepare-short]"; + case M3_BFP_ROUND_NEAREST_EVEN: return "[-> near away]"; + case M3_BFP_ROUND_ZERO: return "[-> zero]"; + case M3_BFP_ROUND_POSINF: return "[-> +inf]"; + case M3_BFP_ROUND_NEGINF: return "[-> -inf]"; + } + assert(0); +} + +/* Can be converted to 64-bit and 128-bit values without issues. */ +static const float values[] = { + 0.0f, -1.0f, 2.0f, NAN, INFINITY +}; + +static void +convert_to_int_fpc_tests(unsigned mode) +{ + set_rounding_mode(mode); + + /* f32 -> i32 */ + printf("......f32 -> i32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cfebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f32 -> i64 */ + printf("......f32 -> i64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cgebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> i32 */ + printf("......f64 -> i32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cfdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> i64 */ + printf("......f64 -> i64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cgdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> i32 */ + printf("......f128 -> i32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cfxbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> i64 */ + printf("......f128 -> i64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cgxbr(values[j], M3_BFP_ROUND_PER_FPC); +} + +#if 0 +static void +convert_to_logical_fpc_tests(unsigned mode) +{ + set_rounding_mode(mode); + + /* f32 -> u32 */ + printf("......f32 -> u32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clfebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f32 -> u64 */ + printf("......f32 -> u64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clgebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> u32 */ + printf("......f64 -> u32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clfdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> u64 */ + printf("......f64 -> u64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clgdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> u32 */ + printf("......f128 -> u32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clfxbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> u64 */ + printf("......f128 -> u64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clgxbr(values[j], M3_BFP_ROUND_PER_FPC); +} +#endif + +int +main(void) +{ + assert(sizeof(long double) == 16); + + static const unsigned fpc_rmodes[] = { + FPC_BFP_ROUND_NEAREST_EVEN, + FPC_BFP_ROUND_ZERO, + FPC_BFP_ROUND_POSINF, + FPC_BFP_ROUND_NEGINF, + FPC_BFP_ROUND_PREPARE_SHORT + }; + + //---------------------------------------------------------- + // Convert to int + //---------------------------------------------------------- + printf("============ Convert to int =============\n"); + printf("Rounding as 'per FPC'\n"); + for (int i = 0; i < sizeof fpc_rmodes / sizeof fpc_rmodes[0]; ++i) { + printf("...setting FPC rounding mode to %s\n", fpc_rtext(fpc_rmodes[i])); + convert_to_int_fpc_tests(fpc_rmodes[i]); + } + + printf("Rounding as 'per M3'\n"); + convert_to_int_m3_tests(1); // M3_BFP_ROUND_NEAREST_AWAY + convert_to_int_m3_tests(3); // M3_BFP_ROUND_PREPARE_SHORT + convert_to_int_m3_tests(4); // M3_BFP_ROUND_NEAREST_EVEN + convert_to_int_m3_tests(5); // M3_BFP_ROUND_ZERO + convert_to_int_m3_tests(6); // M3_BFP_ROUND_POSINF + convert_to_int_m3_tests(7); // M3_BFP_ROUND_NEGINF + + //---------------------------------------------------------- + // Convert to logical + //---------------------------------------------------------- +#if 0 + /* Disabled until condition code weirdness has been cleared up. + Negative floating point number --> cc = 3. Seems wrong to me. */ + putchar('\n'); + printf("============ Convert to logical =============\n"); + printf("Rounding as 'per FPC'\n"); + for (int i = 0; i < sizeof fpc_rmodes / sizeof fpc_rmodes[0]; ++i) { + printf("...setting FPC rounding mode to %s\n", fpc_rtext(fpc_rmodes[i])); + convert_to_logical_fpc_tests(fpc_rmodes[i]); + } + + printf("Rounding as 'per M3'\n"); + convert_to_logical_m3_tests(1); // M3_BFP_ROUND_NEAREST_AWAY + convert_to_logical_m3_tests(3); // M3_BFP_ROUND_PREPARE_SHORT + convert_to_logical_m3_tests(4); // M3_BFP_ROUND_NEAREST_EVEN + convert_to_logical_m3_tests(5); // M3_BFP_ROUND_ZERO + convert_to_logical_m3_tests(6); // M3_BFP_ROUND_POSINF + convert_to_logical_m3_tests(7); // M3_BFP_ROUND_NEGINF +#endif + return 0; +} diff --git a/none/tests/s390x/fpconv.stderr.exp b/none/tests/s390x/bfp-convert.stderr.exp similarity index 100% rename from none/tests/s390x/fpconv.stderr.exp rename to none/tests/s390x/bfp-convert.stderr.exp diff --git a/none/tests/s390x/bfp-convert.stdout.exp b/none/tests/s390x/bfp-convert.stdout.exp new file mode 100644 index 0000000000..c5a17ebd43 --- /dev/null +++ b/none/tests/s390x/bfp-convert.stdout.exp @@ -0,0 +1,740 @@ +============ Convert to int ============= +Rounding as 'per FPC' +...setting FPC rounding mode to [-> near] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> zero] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> +inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> -inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> prepare-short] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +Rounding as 'per M3' +...setting M3 rounding mode to [-> near away] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> prepare-short] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> near away] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> zero] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> +inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> -inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 diff --git a/none/tests/s390x/bfp-convert.vgtest b/none/tests/s390x/bfp-convert.vgtest new file mode 100644 index 0000000000..11cd11c527 --- /dev/null +++ b/none/tests/s390x/bfp-convert.vgtest @@ -0,0 +1,2 @@ +prog: bfp-convert +prereq: ../../../tests/s390x_features s390x-fpext diff --git a/none/tests/s390x/fpconv.c b/none/tests/s390x/fpconv.c deleted file mode 100644 index 02b5128e7c..0000000000 --- a/none/tests/s390x/fpconv.c +++ /dev/null @@ -1,119 +0,0 @@ -#include <float.h> -#include <stdio.h> -#include <stdint.h> -#include <inttypes.h> -#include <limits.h> - -/* The following opcodes are tested: - - Convert to fixed: cfebr, cgebr, cfdbr, cgdbr - Convert from fixed: cefbr, cdfbr, cegbr, cdgbr - - We do not test rounding here. Just making sure the insn selector - picks the correct insn. -*/ - -#define I2F(insn, initial, target_type) \ -do { \ - int64_t source = initial; \ - target_type target; \ - asm volatile(insn " %0,%1\n\t" :"=f" (target) :"d"(source)); \ - printf(insn " %"PRId64" -> %f\n", source, target); \ -} while (0) - -#define DO_INSN_I32_TO_F(insn, target_type) \ -do { \ - printf("\n----- int32_t -> " #target_type "\n");\ - I2F(insn, 0, target_type); \ - I2F(insn, 1, target_type); \ - I2F(insn, -1, target_type); \ - I2F(insn, 42, target_type); \ - I2F(insn, SHRT_MAX, target_type); \ - I2F(insn, SHRT_MIN, target_type); \ - I2F(insn, INT_MAX, target_type); \ - I2F(insn, INT_MIN, target_type); \ -} while (0) - -#define DO_INSN_I64_TO_F(insn, target_type) \ -do { \ - printf("\n----- int64_t -> " #target_type "\n");\ - I2F(insn, 0, target_type); \ - I2F(insn, 1, target_type); \ - I2F(insn, -1, target_type); \ - I2F(insn, 42, target_type); \ - I2F(insn, SHRT_MAX, target_type); \ - I2F(insn, SHRT_MIN, target_type); \ - I2F(insn, INT_MAX, target_type); \ - I2F(insn, INT_MIN, target_type); \ - I2F(insn, LONG_MAX, target_type); \ - I2F(insn, LONG_MIN, target_type); \ -} while (0) - -#define DO_I2F() \ -do { \ - DO_INSN_I32_TO_F("cefbr", float); \ - DO_INSN_I32_TO_F("cdfbr", double); \ - DO_INSN_I64_TO_F("cegbr", float); \ - DO_INSN_I64_TO_F("cdgbr", double); \ -} while (0) - - -#define F2I(insn, initial, source_type, target_type) \ -do { \ - int cc; \ - source_type source = initial; \ - target_type target = 0; \ - asm volatile(insn " %0,0,%2\n\t" \ - "ipm %1\n\t" \ - "srl %1,28\n\t" \ - : "=d" (target), "=d" (cc) : "f"(source) : "cc"); \ - printf(insn " %f -> %ld cc = %d\n", source, (long)target, cc); \ -} while (0) - -#define DO_INSN_F32_TO_I(insn, type) \ -do { \ - printf("\n----- float -> " #type "\n"); \ - F2I(insn, -1.0f, float, type); \ - F2I(insn, 0.0f, float, type); \ - F2I(insn, 1.0f, float, type); \ - F2I(insn, 1.4f, float, type); \ - F2I(insn, 1.5f, float, type); \ - F2I(insn, 1.6f, float, type); \ - F2I(insn, 1.6E+4f, float, type); \ - F2I(insn, 1.6E+8f, float, type); \ - F2I(insn, 1.6E-4f, float, type); \ - F2I(insn, FLT_MAX, float, type); \ -} while (0) - -#define DO_INSN_F64_TO_I(insn, type) \ -do { \ - printf("\n----- double -> " #type "\n"); \ - F2I(insn, -1.0, double, type); \ - F2I(insn, 0.0, double, type); \ - F2I(insn, 1.0, double, type); \ - F2I(insn, 1.4, double, type); \ - F2I(insn, 1.5, double, type); \ - F2I(insn, 1.6, double, type); \ - F2I(insn, 1.6E+4, double, type); \ - F2I(insn, 1.6E+8, double, type); \ - F2I(insn, 1.6E-4, double, type); \ - F2I(insn, FLT_MAX, double, type); \ - F2I(insn, DBL_MAX, double, type); \ -} while (0) - -#define DO_F2I() \ -do { \ - DO_INSN_F32_TO_I("cfebr", int32_t); \ - DO_INSN_F32_TO_I("cgebr", int64_t); \ - DO_INSN_F64_TO_I("cfdbr", int32_t); \ - DO_INSN_F64_TO_I("cgdbr", int64_t); \ -} while (0) - - -int main() -{ - DO_I2F(); - DO_F2I(); - - return 0; -} diff --git a/none/tests/s390x/fpconv.stdout.exp b/none/tests/s390x/fpconv.stdout.exp deleted file mode 100644 index 779655e13c..0000000000 --- a/none/tests/s390x/fpconv.stdout.exp +++ /dev/null @@ -1,94 +0,0 @@ - ------ int32_t -> float -cefbr 0 -> 0.000000 -cefbr 1 -> 1.000000 -cefbr -1 -> -1.000000 -cefbr 42 -> 42.000000 -cefbr 32767 -> 32767.000000 -cefbr -32768 -> -32768.000000 -cefbr 2147483647 -> 2147483648.000000 -cefbr -2147483648 -> -2147483648.000000 - ------ int32_t -> double -cdfbr 0 -> 0.000000 -cdfbr 1 -> 1.000000 -cdfbr -1 -> -1.000000 -cdfbr 42 -> 42.000000 -cdfbr 32767 -> 32767.000000 -cdfbr -32768 -> -32768.000000 -cdfbr 2147483647 -> 2147483647.000000 -cdfbr -2147483648 -> -2147483648.000000 - ------ int64_t -> float -cegbr 0 -> 0.000000 -cegbr 1 -> 1.000000 -cegbr -1 -> -1.000000 -cegbr 42 -> 42.000000 -cegbr 32767 -> 32767.000000 -cegbr -32768 -> -32768.000000 -cegbr 2147483647 -> 2147483648.000000 -cegbr -2147483648 -> -2147483648.000000 -cegbr 9223372036854775807 -> 9223372036854775808.000000 -cegbr -9223372036854775808 -> -9223372036854775808.000000 - ------ int64_t -> double -cdgbr 0 -> 0.000000 -cdgbr 1 -> 1.000000 -cdgbr -1 -> -1.000000 -cdgbr 42 -> 42.000000 -cdgbr 32767 -> 32767.000000 -cdgbr -32768 -> -32768.000000 -cdgbr 2147483647 -> 2147483647.000000 -cdgbr -2147483648 -> -2147483648.000000 -cdgbr 9223372036854775807 -> 9223372036854775808.000000 -cdgbr -9223372036854775808 -> -9223372036854775808.000000 - ------ float -> int32_t -cfebr -1.000000 -> -1 cc = 1 -cfebr 0.000000 -> 0 cc = 0 -cfebr 1.000000 -> 1 cc = 2 -cfebr 1.400000 -> 1 cc = 2 -cfebr 1.500000 -> 2 cc = 2 -cfebr 1.600000 -> 2 cc = 2 -cfebr 16000.000000 -> 16000 cc = 2 -cfebr 160000000.000000 -> 160000000 cc = 2 -cfebr 0.000160 -> 0 cc = 2 -cfebr 340282346638528859811704183484516925440.000000 -> 2147483647 cc = 3 - ------ float -> int64_t -cgebr -1.000000 -> -1 cc = 1 -cgebr 0.000000 -> 0 cc = 0 -cgebr 1.000000 -> 1 cc = 2 -cgebr 1.400000 -> 1 cc = 2 -cgebr 1.500000 -> 2 cc = 2 -cgebr 1.600000 -> 2 cc = 2 -cgebr 16000.000000 -> 16000 cc = 2 -cgebr 160000000.000000 -> 160000000 cc = 2 -cgebr 0.000160 -> 0 cc = 2 -cgebr 340282346638528859811704183484516925440.000000 -> 9223372036854775807 cc = 3 - ------ double -> int32_t -cfdbr -1.000000 -> -1 cc = 1 -cfdbr 0.000000 -> 0 cc = 0 -cfdbr 1.000000 -> 1 cc = 2 -cfdbr 1.400000 -> 1 cc = 2 -cfdbr 1.500000 -> 2 cc = 2 -cfdbr 1.600000 -> 2 cc = 2 -cfdbr 16000.000000 -> 16000 cc = 2 -cfdbr 160000000.000000 -> 160000000 cc = 2 -cfdbr 0.000160 -> 0 cc = 2 -cfdbr 340282346638528859811704183484516925440.000000 -> 2147483647 cc = 3 -cfdbr 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 -> 2147483647 cc = 3 - ------ double -> int64_t -cgdbr -1.000000 -> -1 cc = 1 -cgdbr 0.000000 -> 0 cc = 0 -cgdbr 1.000000 -> 1 cc = 2 -cgdbr 1.400000 -> 1 cc = 2 -cgdbr 1.500000 -> 2 cc = 2 -cgdbr 1.600000 -> 2 cc = 2 -cgdbr 16000.000000 -> 16000 cc = 2 -cgdbr 160000000.000000 -> 160000000 cc = 2 -cgdbr 0.000160 -> 0 cc = 2 -cgdbr 340282346638528859811704183484516925440.000000 -> 9223372036854775807 cc = 3 -cgdbr 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 -> 9223372036854775807 cc = 3 diff --git a/none/tests/s390x/fpconv.vgtest b/none/tests/s390x/fpconv.vgtest deleted file mode 100644 index e2e3c2872a..0000000000 --- a/none/tests/s390x/fpconv.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: fpconv diff --git a/none/tests/s390x/fpext.c b/none/tests/s390x/fpext.c deleted file mode 100644 index 62b6bb7f24..0000000000 --- a/none/tests/s390x/fpext.c +++ /dev/null @@ -1,149 +0,0 @@ -#include <float.h> -#include <stdio.h> -#include <assert.h> -#include "opcodes.h" - - -#define L2F(insn, initial, target,round) \ -({ \ - register unsigned long source asm("2") = initial; \ - register typeof(target) _t asm("f0"); \ - asm volatile(insn(round,0,0,2) :"=f" (_t):"d"(source)); \ - _t; \ -}) - -#define F2L(insn, initial, type, round, cc) \ -({ \ - register type source asm("f0") = initial; \ - register unsigned long target asm ("2") = 0; \ - asm volatile(insn(round,0,2,0) \ - "ipm %1\n\t" \ - "srl %1,28\n\t" \ - :"=d" (target), "=d" (cc) :"f"(source):"cc"); \ - target; \ -}) - - -#define DO_INSN_L2F32(insn, round) \ -({ \ - float f32; \ - printf(#insn " %f\n", L2F(insn, 0, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 1, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffUL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x80000000UL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffUL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x100000000UL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffffffffffUL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x8000000000000000UL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffffffffffUL, f32, round)); \ -}) - -#define DO_INSN_L2F64(insn, round) \ -({ \ - double f64; \ - printf(#insn " %f\n", L2F(insn, 0, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 1, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffUL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x80000000UL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffUL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x100000000UL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffffffffffUL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x8000000000000000UL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffffffffffUL, f64, round)); \ -}) - -#define DO_INSN_L2F128(insn, round) \ -({ \ - long double f128; \ - printf(#insn " %Lf\n", L2F(insn, 0, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 1, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0xffffffffUL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x80000000UL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x7fffffffUL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x100000000UL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0xffffffffffffffffUL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x8000000000000000UL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x7fffffffffffffffUL, f128, round)); \ -}) - -#define DO_INSN_F2L(insn, round, type) \ -({ \ - int cc; \ - printf(#insn " %lu ", F2L(insn, -1.1, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 0, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.4, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.5, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+4, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+8, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+12, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+20, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+200, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+2000L, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E-4, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, FLT_MIN, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, FLT_MAX, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, DBL_MIN, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, DBL_MAX, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, LDBL_MIN, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, LDBL_MAX, type, round, cc)); \ - printf("cc=%d\n", cc); \ -}) - -#define DO_L2F(round) \ -({ \ - DO_INSN_L2F32(CELFBR, round); \ - DO_INSN_L2F32(CELGBR, round); \ - DO_INSN_L2F64(CDLFBR, round); \ - DO_INSN_L2F64(CDLGBR, round); \ - DO_INSN_L2F128(CXLFBR, round); \ - DO_INSN_L2F128(CXLGBR, round); \ -}) - -#define DO_F2L(round) \ -({ \ - DO_INSN_F2L(CLFEBR, round, float); \ - DO_INSN_F2L(CLGEBR, round, float); \ - DO_INSN_F2L(CLFDBR, round, double); \ - DO_INSN_F2L(CLGDBR, round, double); \ - DO_INSN_F2L(CLFXBR, round, long double); \ - DO_INSN_F2L(CLGXBR, round, long double); \ -}) - - -int main() -{ - assert(sizeof(long double) == 16); - DO_L2F(4); - DO_F2L(4); - - DO_L2F(5); - DO_F2L(5); - - DO_L2F(6); - DO_F2L(6); - - DO_L2F(7); - DO_F2L(7); - - return 0; -} diff --git a/none/tests/s390x/fpext.stderr.exp b/none/tests/s390x/fpext.stderr.exp deleted file mode 100644 index 139597f9cb..0000000000 --- a/none/tests/s390x/fpext.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/fpext.stdout.exp b/none/tests/s390x/fpext.stdout.exp deleted file mode 100644 index 48fbda0c45..0000000000 --- a/none/tests/s390x/fpext.stdout.exp +++ /dev/null @@ -1,672 +0,0 @@ -CELFBR 0.000000 -CELFBR 1.000000 -CELFBR 4294967296.000000 -CELFBR 2147483648.000000 -CELFBR 2147483648.000000 -CELFBR 0.000000 -CELFBR 4294967296.000000 -CELFBR 0.000000 -CELFBR 4294967296.000000 -CELGBR 0.000000 -CELGBR 1.000000 -CELGBR 4294967296.000000 -CELGBR 2147483648.000000 -CELGBR 2147483648.000000 -CELGBR 4294967296.000000 -CELGBR 18446744073709551616.000000 -CELGBR 9223372036854775808.000000 -CELGBR 9223372036854775808.000000 -CDLFBR 0.000000 -CDLFBR 1.000000 -CDLFBR 4294967295.000000 -CDLFBR 2147483648.000000 -CDLFBR 2147483647.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLGBR 0.000000 -CDLGBR 1.000000 -CDLGBR 4294967295.000000 -CDLGBR 2147483648.000000 -CDLGBR 2147483647.000000 -CDLGBR 4294967296.000000 -CDLGBR 18446744073709551616.000000 -CDLGBR 9223372036854775808.000000 -CDLGBR 9223372036854775808.000000 -CXLFBR 0.000000 -CXLFBR 1.000000 -CXLFBR 4294967295.000000 -CXLFBR 2147483648.000000 -CXLFBR 2147483647.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLGBR 0.000000 -CXLGBR 1.000000 -CXLGBR 4294967295.000000 -CXLGBR 2147483648.000000 -CXLGBR 2147483647.000000 -CXLGBR 4294967296.000000 -CXLGBR 18446744073709551615.000000 -CXLGBR 9223372036854775808.000000 -CXLGBR 9223372036854775807.000000 -CLFEBR 0 cc=3 -CLFEBR 0 cc=0 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 2 cc=2 -CLFEBR 2 cc=2 -CLFEBR 16000 cc=2 -CLFEBR 160000000 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=2 -CLFEBR 0 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLGEBR 0 cc=3 -CLGEBR 0 cc=0 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 2 cc=2 -CLGEBR 2 cc=2 -CLGEBR 16000 cc=2 -CLGEBR 160000000 cc=2 -CLGEBR 1599999967232 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=2 -CLGEBR 0 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLFDBR 0 cc=3 -CLFDBR 0 cc=0 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 2 cc=2 -CLFDBR 2 cc=2 -CLFDBR 16000 cc=2 -CLFDBR 160000000 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=0 -CLFDBR 4294967295 cc=3 -CLGDBR 0 cc=3 -CLGDBR 0 cc=0 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 2 cc=2 -CLGDBR 2 cc=2 -CLGDBR 16000 cc=2 -CLGDBR 160000000 cc=2 -CLGDBR 1600000000000 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=0 -CLGDBR 18446744073709551615 cc=3 -CLFXBR 0 cc=3 -CLFXBR 0 cc=0 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 2 cc=2 -CLFXBR 2 cc=2 -CLFXBR 16000 cc=2 -CLFXBR 160000000 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLGXBR 0 cc=3 -CLGXBR 0 cc=0 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 2 cc=2 -CLGXBR 2 cc=2 -CLGXBR 16000 cc=2 -CLGXBR 160000000 cc=2 -CLGXBR 1600000000000 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CELFBR 0.000000 -CELFBR 1.000000 -CELFBR 4294967040.000000 -CELFBR 2147483648.000000 -CELFBR 2147483520.000000 -CELFBR 0.000000 -CELFBR 4294967040.000000 -CELFBR 0.000000 -CELFBR 4294967040.000000 -CELGBR 0.000000 -CELGBR 1.000000 -CELGBR 4294967040.000000 -CELGBR 2147483648.000000 -CELGBR 2147483520.000000 -CELGBR 4294967296.000000 -CELGBR 18446742974197923840.000000 -CELGBR 9223372036854775808.000000 -CELGBR 9223371487098961920.000000 -CDLFBR 0.000000 -CDLFBR 1.000000 -CDLFBR 4294967295.000000 -CDLFBR 2147483648.000000 -CDLFBR 2147483647.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLGBR 0.000000 -CDLGBR 1.000000 -CDLGBR 4294967295.000000 -CDLGBR 2147483648.000000 -CDLGBR 2147483647.000000 -CDLGBR 4294967296.000000 -CDLGBR 18446744073709549568.000000 -CDLGBR 9223372036854775808.000000 -CDLGBR 9223372036854774784.000000 -CXLFBR 0.000000 -CXLFBR 1.000000 -CXLFBR 4294967295.000000 -CXLFBR 2147483648.000000 -CXLFBR 2147483647.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLGBR 0.000000 -CXLGBR 1.000000 -CXLGBR 4294967295.000000 -CXLGBR 2147483648.000000 -CXLGBR 2147483647.000000 -CXLGBR 4294967296.000000 -CXLGBR 18446744073709551615.000000 -CXLGBR 9223372036854775808.000000 -CXLGBR 9223372036854775807.000000 -CLFEBR 0 cc=3 -CLFEBR 0 cc=0 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 16000 cc=2 -CLFEBR 160000000 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=2 -CLFEBR 0 cc=2 -CLFEBR 4294967295 c... [truncated message content] |
|
From: Alexandra H. <aha...@so...> - 2025-09-24 17:01:04
|
https://sourceware.org/cgit/valgrind/commit/?id=e8e4066c3a0160f03d9dfffaa360b65eb79745d1 commit e8e4066c3a0160f03d9dfffaa360b65eb79745d1 Author: Alexandra Hájková <aha...@re...> Date: Tue Aug 12 12:17:54 2025 -0400 Filter Valgrind FDs from getdents syscalls This change prevents client programs from seeing Valgrind's internal file descriptors when scanning /proc/self/fd or /proc/<pid>/fd. This patch modifies the getdents and getdents64 syscall wrappers to selectively filter out Valgrind's internal file descriptors only when listing /proc/*/fd directories for the current process. Add none/tests/getdents_filter.vgtest test that tests that the Valgrind's file descriptors are hidden from the client program and verifies both /proc/self/fd filtering and that regular directory listings remain unfiltered. https://bugs.kde.org/show_bug.cgi?id=331311 Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 193 +++++++++++++++++++++++++++++++++- none/tests/Makefile.am | 2 + none/tests/getdents_filter.c | 159 ++++++++++++++++++++++++++++ none/tests/getdents_filter.stderr.exp | 0 none/tests/getdents_filter.stdout.exp | 16 +++ none/tests/getdents_filter.vgtest | 2 + 8 files changed, 370 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e70c9cc421..de362ecc28 100644 --- a/.gitignore +++ b/.gitignore @@ -1701,6 +1701,7 @@ /none/tests/vgprintf /none/tests/vgprintf_nvalgrind /none/tests/yield +/none/tests/getdents_filter # /none/tests/amd64/ /none/tests/amd64/*.dSYM diff --git a/NEWS b/NEWS index ecd58cc501..d7f0cb3ba2 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +331311 Valgrind shows open files in /proc/self/fd that don't work for the process 309554 Wrap syscall remap_file_pages (216) 338803 Handling of dwz debug alt files or cross-CU is broken 369030 Wrap linux syscall: 171 (setdomainname) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index ce4c11c26c..33b58f5a5e 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3994,11 +3994,181 @@ PRE(sys_getdents) PRE_MEM_WRITE( "getdents(dirp)", ARG2, ARG3 ); } +/* Check if the given file descriptor points to a /proc/PID/fd or /proc/PID/fdinfo directory. + Returns True if it's a directory we should filter Valgrind FDs from. */ +static Bool is_proc_fd_directory(Int fd) +{ + const HChar* path; + if (!VG_(resolve_filename)(fd, &path)) + return False; + + HChar ppfd[32]; /* large enough for /proc/<pid>/fd and /proc/<pid>/fdinfo */ + HChar ppfdinfo[32]; + VG_(sprintf)(ppfd, "/proc/%d/fd", VG_(getpid)()); + VG_(sprintf)(ppfdinfo, "/proc/%d/fdinfo", VG_(getpid)()); + + if (VG_(strcmp)(path, "/proc/self/fd") == 0 + || VG_(strcmp)(path, "/proc/self/fdinfo") == 0 + || VG_(strcmp)(path, ppfd) == 0 + || VG_(strcmp)(path, ppfdinfo) == 0) + return True; + + return False; +} + + +/* Helper function to decide if an FD entry should be kept */ +static Bool should_keep_fd_entry(const HChar *name) +{ + if (VG_(strcmp)(name, ".") == 0 || VG_(strcmp)(name, "..") == 0) + return True; + + Bool is_numeric = True; + for (Int i = 0; name[i] != '\0'; i++) { + if (name[i] < '0' || name[i] > '9') { + is_numeric = False; + if (VG_(clo_verbosity) > 1) + VG_(dmsg)("Warning: Non-numeric entry '%s' found in /proc/*/fd directory\n", name); + break; + } + } + + if (is_numeric && name[0] != '\0') { + Int fd_num = VG_(strtoll10)(name, NULL); + /* Hide FDs beyond soft limit or Valgrind's output FDs */ + if (fd_num >= VG_(fd_soft_limit) || + fd_num == VG_(log_output_sink).fd || + fd_num == VG_(xml_output_sink).fd) + return False; + } + + return True; +} + +/* Filter and compact dirent entries */ +static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) +{ + struct vki_dirent *dp = dirp; + struct vki_dirent *write_pos = dirp; + SizeT bytes_processed = 0; + SizeT new_size = 0; + + while (bytes_processed < orig_size) { + if (should_keep_fd_entry(dp->d_name)) { + if (write_pos != dp) + VG_(memmove)(write_pos, dp, dp->d_reclen); + new_size += dp->d_reclen; + write_pos = (struct vki_dirent *)((HChar *)write_pos + dp->d_reclen); + } + + bytes_processed += dp->d_reclen; + dp = (struct vki_dirent *)((HChar *)dp + dp->d_reclen); + } + + return new_size; +} + +/* Filter and compact dirent64 entries */ +static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) +{ + struct vki_dirent64 *dp = dirp; + struct vki_dirent64 *write_pos = dirp; + SizeT bytes_processed = 0; + SizeT new_size = 0; + + while (bytes_processed < orig_size) { + if (should_keep_fd_entry(dp->d_name)) { + if (write_pos != dp) + VG_(memmove)(write_pos, dp, dp->d_reclen); + new_size += dp->d_reclen; + write_pos = (struct vki_dirent64 *)((HChar *)write_pos + dp->d_reclen); + } + + bytes_processed += dp->d_reclen; + dp = (struct vki_dirent64 *)((HChar *)dp + dp->d_reclen); + } + + return new_size; +} + +/* Filter out Valgrind's internal file descriptors from getdents results with refill capability. + When entries are filtered out, attempts to read more entries to avoid empty results. + Returns filtered size on success, or -1 if retry syscall failed. */ +static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_dirent *dirp, SizeT orig_size, SizeT buf_size, /*MOD*/SyscallStatus* status) +{ + SizeT new_size = filter_dirent_entries(dirp, orig_size); + + /* If we filtered out everything, try to read more entries. + Since new_size == 0, the buffer is completely unused. */ + while (new_size == 0) { + SysRes retry = VG_(do_syscall3)(__NR_getdents, fd, (UWord)dirp, buf_size); + if (sr_isError(retry)) { + /* Set the syscall status and return error indicator */ + SET_STATUS_from_SysRes(retry); + return -1; + } + if (sr_Res(retry) == 0) { + /* Real EOF - stop trying */ + break; + } + + /* Filter the new batch */ + SizeT retry_size = sr_Res(retry); + new_size = filter_dirent_entries(dirp, retry_size); + } + + return new_size; +} + +/* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability. + Same logic as getdents version but for 64-bit dirent structures. + Returns filtered size on success, or -1 if retry syscall failed. */ +static SizeT filter_valgrind_fds_from_getdents64_with_refill(Int fd, struct vki_dirent64 *dirp, SizeT orig_size, SizeT buf_size, /*MOD*/SyscallStatus* status) +{ + SizeT new_size = filter_dirent64_entries(dirp, orig_size); + + /* If we filtered out everything, try to read more entries. + Since new_size == 0, the buffer is completely unused. */ + while (new_size == 0) { + SysRes retry = VG_(do_syscall3)(__NR_getdents64, fd, (UWord)dirp, buf_size); + if (sr_isError(retry)) { + /* Set the syscall status and return error indicator */ + SET_STATUS_from_SysRes(retry); + return -1; + } + if (sr_Res(retry) == 0) { + /* Real EOF - stop trying */ + break; + } + + /* Filter the new batch */ + SizeT retry_size = sr_Res(retry); + new_size = filter_dirent64_entries(dirp, retry_size); + } + + return new_size; +} + POST(sys_getdents) { vg_assert(SUCCESS); - if (RES > 0) - POST_MEM_WRITE( ARG2, RES ); + if (RES > 0) { + SizeT result_size = RES; + + /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ + if (is_proc_fd_directory(ARG1)) { + SizeT filtered_size = filter_valgrind_fds_from_getdents_with_refill(ARG1, (struct vki_dirent *)ARG2, RES, ARG3, status); + if ((SizeT)filtered_size == (SizeT)-1) { + /* Error already set by filter function */ + return; + } + result_size = filtered_size; + if (result_size != RES) + SET_STATUS_Success(result_size); + } + + POST_MEM_WRITE( ARG2, result_size ); + } } PRE(sys_getdents64) @@ -4015,8 +4185,23 @@ PRE(sys_getdents64) POST(sys_getdents64) { vg_assert(SUCCESS); - if (RES > 0) - POST_MEM_WRITE( ARG2, RES ); + if (RES > 0) { + SizeT result_size = RES; + + /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ + if (is_proc_fd_directory(ARG1)) { + SizeT filtered_size = filter_valgrind_fds_from_getdents64_with_refill(ARG1, (struct vki_dirent64 *)ARG2, RES, ARG3, status); + if ((SizeT)filtered_size == (SizeT)-1) { + /* Error already set by filter function */ + return; + } + result_size = filtered_size; + if (result_size != RES) + SET_STATUS_Success(result_size); + } + + POST_MEM_WRITE( ARG2, result_size ); + } } PRE(sys_getgroups) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 716ce000d3..ccdd85e53e 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -172,6 +172,7 @@ EXTRA_DIST = \ floored.stderr.exp floored.stdout.exp floored.vgtest \ fork.stderr.exp fork.stdout.exp fork.vgtest \ fucomip.stderr.exp fucomip.vgtest \ + getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \ gxx304.stderr.exp gxx304.vgtest \ ifunc.stderr.exp ifunc.stdout.exp ifunc.vgtest \ ioctl_moans.stderr.exp ioctl_moans.vgtest \ @@ -291,6 +292,7 @@ check_PROGRAMS = \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ + getdents_filter \ ioctl_moans \ libvex_test \ libvexmultiarch_test \ diff --git a/none/tests/getdents_filter.c b/none/tests/getdents_filter.c new file mode 100644 index 0000000000..d508cdde0f --- /dev/null +++ b/none/tests/getdents_filter.c @@ -0,0 +1,159 @@ +/* Regression test for bug #331311: Valgrind file descriptors visible in /proc/self/fd and /proc/self/fdinfo */ + +#define _GNU_SOURCE +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <dirent.h> +#include <errno.h> +#include <string.h> +#include <fcntl.h> +#include <sys/resource.h> +#include <sys/stat.h> +#include <sys/syscall.h> +#include <sys/types.h> + +struct linux_dirent { + unsigned long d_ino; + off_t d_off; + unsigned short d_reclen; + char d_name[]; +}; + +/* Small buffer size to test retry logic when all entries get filtered */ +#define SMALL_BUF_SIZE 64 + +/* Helper function to scan a /proc directory and print numeric FD entries with a prefix. + Returns 0 on success, -1 if directory unavailable */ +static int scan_proc_fd_directory(const char *dir_path, const char *prefix) +{ + DIR *d = opendir(dir_path); + if (d == NULL) { + printf("%s not available\n", dir_path); + return -1; + } + + struct dirent *entry; + while ((entry = readdir(d)) != NULL) { + if (entry->d_name[0] == '.') + continue; + + char *endptr; + long fd = strtol(entry->d_name, &endptr, 10); + if (*endptr == '\0' && fd >= 0) { + if (prefix) { + printf("%s:%ld\n", prefix, fd); + } else { + printf("%ld\n", fd); + } + } + } + closedir(d); + return 0; +} + +/* + * Test retry logic with raw getdents syscall and small buffer. + * + * This test validates the filtering refill mechanism in syswrap-generic.c. + * When using a tiny buffer (64 bytes), getdents may return only Valgrind FDs + * in a single call. The filtering code should detect this (new_size == 0) and + * automatically retry the syscall to get more entries until it finds client FDs + * or reaches EOF. This prevents the client from seeing empty results when + * Valgrind FDs get filtered out. + */ +static void test_retry_logic_with_small_buffer(void) +{ + int fd; + char buf[SMALL_BUF_SIZE]; + long nread; + struct linux_dirent *d; + + printf("retry_test_start\n"); + + fd = open("/proc/self/fd", O_RDONLY | O_DIRECTORY); + if (fd == -1) { + printf("retry_test_unavailable\n"); + return; + } + + /* + * Use raw getdents syscall with tiny 64-byte buffer. This forces multiple + * syscalls since each directory entry is typically 20+ bytes. Some calls + * may return only Valgrind FDs, which will trigger the retry mechanism. + */ + for (;;) { + nread = syscall(SYS_getdents, fd, buf, SMALL_BUF_SIZE); + + if (nread == -1) { + printf("retry_test_error\n"); + close(fd); + return; + } + + if (nread == 0) { + break; /* EOF - no more entries */ + } + + /* Print client FD entries found in this buffer (excluding . and ..) */ + for (size_t bpos = 0; bpos < nread;) { + d = (struct linux_dirent *)(buf + bpos); + if (strcmp(d->d_name, ".") != 0 && strcmp(d->d_name, "..") != 0) { + char *endptr; + long fd_num = strtol(d->d_name, &endptr, 10); + if (*endptr == '\0' && fd_num >= 0) { + printf("retry:%ld\n", fd_num); + } + } + bpos += d->d_reclen; + } + } + + close(fd); + printf("retry_test_end\n"); +} + +int main(void) +{ + /* Test 0: Retry logic with small buffer (tests the filtering refill mechanism) */ + test_retry_logic_with_small_buffer(); + + /* Test 1: /proc/self/fd should have Valgrind FDs filtered out */ + if (scan_proc_fd_directory("/proc/self/fd", NULL) == -1) { + return 0; /* Skip remaining tests if /proc/self/fd unavailable */ + } + + /* Test 2: /proc/self/fdinfo should have Valgrind FDs filtered out */ + scan_proc_fd_directory("/proc/self/fdinfo", "fdinfo"); + + /* Test 3: Regular directory should show all numbered files */ + DIR *d; + struct dirent *entry; + if (mkdir("testdir", 0755) == 0) { + FILE *f1 = fopen("testdir/1000", "w"); + FILE *f2 = fopen("testdir/1001", "w"); + if (f1) { fprintf(f1, "test"); fclose(f1); } + if (f2) { fprintf(f2, "test"); fclose(f2); } + + d = opendir("testdir"); + if (d != NULL) { + while ((entry = readdir(d)) != NULL) { + if (entry->d_name[0] != '.') { + char *endptr; + long num = strtol(entry->d_name, &endptr, 10); + if (*endptr == '\0' && num >= 1000) { + printf("regular:%ld\n", num); + } + } + } + closedir(d); + } + + unlink("testdir/1000"); + unlink("testdir/1001"); + rmdir("testdir"); + } + + + return 0; +} diff --git a/none/tests/getdents_filter.stderr.exp b/none/tests/getdents_filter.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/none/tests/getdents_filter.stdout.exp b/none/tests/getdents_filter.stdout.exp new file mode 100644 index 0000000000..c228ee81fd --- /dev/null +++ b/none/tests/getdents_filter.stdout.exp @@ -0,0 +1,16 @@ +retry_test_start +retry:0 +retry:1 +retry:2 +retry:3 +retry_test_end +0 +1 +2 +3 +fdinfo:0 +fdinfo:1 +fdinfo:2 +fdinfo:3 +regular:1000 +regular:1001 diff --git a/none/tests/getdents_filter.vgtest b/none/tests/getdents_filter.vgtest new file mode 100644 index 0000000000..eb5bd6cebd --- /dev/null +++ b/none/tests/getdents_filter.vgtest @@ -0,0 +1,2 @@ +prog: getdents_filter +vgopts: -q |
|
From: Florian K. <fk...@so...> - 2025-09-23 20:30:13
|
https://sourceware.org/cgit/valgrind/commit/?id=d8cf0a84b26ff1ed1b5a9560bfbe5bf476f10c3a commit d8cf0a84b26ff1ed1b5a9560bfbe5bf476f10c3a Author: Florian Krohm <fl...@ei...> Date: Tue Sep 23 20:29:19 2025 +0000 s390: Add missing BFP rounding mode conversions Function decode_bfp_rounding_mode: - Irrm_NEAREST_TIE_AWAY_0 --> S390_BFP_ROUND_NEAREST_AWAY - Irrm_PREPARE_SHORTER --> S390_BFP_ROUND_PREPARE_SHORT Macros S390_CC_FOR_BFP_CONVERT, S390_CC_FOR_BFP_UCONVERT - add S390_BFP_ROUND_NEAREST_AWAY - add S390_BFP_ROUND_PREPARE_SHORT Macros S390_CC_FOR_BFP128_CONVERT, S390_CC_FOR_BFP128_UCONVERT - add S390_BFP_ROUND_NEAREST_AWAY - add S390_BFP_ROUND_PREPARE_SHORT Fix more out-of-date comments related to rounding. Diff: --- VEX/priv/guest_s390_helpers.c | 29 ++++++++++++++++++++++++++++- none/tests/s390x/rounding.h | 3 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 5bfd5eb3fa..4fd9daf410 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -628,7 +628,7 @@ s390_do_cu12_cu14_helper2(UInt byte1, UInt byte2, UInt byte3, UInt byte4, UInt ij = (byte3 >> 4) & 0x3; UInt klmn = byte3 & 0xf; UInt opqrst = byte4 & 0x3f; - + if (is_cu12) { UInt abcd = (uvwxy - 1) & 0xf; UInt high_surrogate = (0xd8 << 8) | (abcd << 6) | (efgh << 2) | ij; @@ -782,6 +782,8 @@ decode_bfp_rounding_mode(UInt irrm) case Irrm_NegINF: return S390_BFP_ROUND_NEGINF; case Irrm_PosINF: return S390_BFP_ROUND_POSINF; case Irrm_ZERO: return S390_BFP_ROUND_ZERO; + case Irrm_NEAREST_TIE_AWAY_0: return S390_BFP_ROUND_NEAREST_AWAY; + case Irrm_PREPARE_SHORTER: return S390_BFP_ROUND_PREPARE_SHORT; } vpanic("decode_bfp_rounding_mode"); } @@ -880,6 +882,12 @@ decode_bfp_rounding_mode(UInt irrm) ({ \ UInt cc; \ switch (decode_bfp_rounding_mode(cc_dep2)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,4); \ break; \ @@ -914,6 +922,12 @@ decode_bfp_rounding_mode(UInt irrm) ({ \ UInt cc; \ switch (decode_bfp_rounding_mode(cc_dep2)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,4); \ break; \ @@ -951,6 +965,12 @@ decode_bfp_rounding_mode(UInt irrm) s390_cc_thunk_put3 for rationale. */ \ cc_dep2 = cc_dep2 ^ cc_ndep; \ switch (decode_bfp_rounding_mode(cc_ndep)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \ break; \ @@ -988,6 +1008,13 @@ decode_bfp_rounding_mode(UInt irrm) s390_cc_thunk_put3 for rationale. */ \ cc_dep2 = cc_dep2 ^ cc_ndep; \ switch (decode_bfp_rounding_mode(cc_ndep)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,3); \ + cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \ break; \ diff --git a/none/tests/s390x/rounding.h b/none/tests/s390x/rounding.h index 34555a8d88..63f19a7239 100644 --- a/none/tests/s390x/rounding.h +++ b/none/tests/s390x/rounding.h @@ -8,14 +8,11 @@ /* instructions (e.g. CFEBR) */ /* ---------------------------------------------------------------- */ #define M3_BFP_ROUND_PER_FPC 0 - -// Cannot be mapped to IRRoundingMode #define M3_BFP_ROUND_NEAREST_AWAY 1 // 2 is not allowed // Needs floating point extension facility -// Cannot be mapped to IRRoundingMode #define M3_BFP_ROUND_PREPARE_SHORT 3 #define M3_BFP_ROUND_NEAREST_EVEN 4 |
|
From: Florian K. <fk...@so...> - 2025-09-23 13:20:33
|
https://sourceware.org/cgit/valgrind/commit/?id=e5cd167a57e8e6141ac5b7f22df29ca2e218a935 commit e5cd167a57e8e6141ac5b7f22df29ca2e218a935 Author: Florian Krohm <fl...@ei...> Date: Tue Sep 23 13:19:58 2025 +0000 Fix an out-of-date comment. Diff: --- none/tests/s390x/rounding.h | 1 - 1 file changed, 1 deletion(-) diff --git a/none/tests/s390x/rounding.h b/none/tests/s390x/rounding.h index 0be1ee3cb5..34555a8d88 100644 --- a/none/tests/s390x/rounding.h +++ b/none/tests/s390x/rounding.h @@ -37,7 +37,6 @@ // 4,5,6 are not allowed // Needs floating point extension facility -// Cannot be mapped to IRRoundingMode #define FPC_BFP_ROUND_PREPARE_SHORT 7 |
|
From: Florian K. <fk...@so...> - 2025-09-23 13:18:57
|
https://sourceware.org/cgit/valgrind/commit/?id=ce0b91e1e49af679c1cbd51d88b5a95df7fc3c29 commit ce0b91e1e49af679c1cbd51d88b5a95df7fc3c29 Author: Florian Krohm <fl...@ei...> Date: Tue Sep 23 13:18:25 2025 +0000 s390: BFP testsuite: condolidate FPC insns in bfp-insn.c Remove srnm, srnmb, and rounding-2 testcases. Also test EFPC and LFPC. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 5 +- none/tests/s390x/Makefile.am | 4 +- none/tests/s390x/bfp-fpc.c | 178 +++++++++++++++++++++ .../{rounding-2.stderr.exp => bfp-fpc.stderr.exp} | 0 none/tests/s390x/bfp-fpc.stdout.exp | 70 ++++++++ none/tests/s390x/bfp-fpc.vgtest | 2 + none/tests/s390x/rounding-2.c | 41 ----- none/tests/s390x/rounding-2.stdout.exp | 9 -- none/tests/s390x/rounding-2.vgtest | 1 - none/tests/s390x/srnm.c | 47 ------ none/tests/s390x/srnm.stderr.exp | 2 - none/tests/s390x/srnm.stdout.exp | 8 - none/tests/s390x/srnm.vgtest | 1 - none/tests/s390x/srnmb.c | 65 -------- none/tests/s390x/srnmb.stderr.exp | 19 --- none/tests/s390x/srnmb.stdout.exp | 6 - none/tests/s390x/srnmb.vgtest | 2 - 17 files changed, 254 insertions(+), 206 deletions(-) diff --git a/.gitignore b/.gitignore index fb69b92a02..e70c9cc421 100644 --- a/.gitignore +++ b/.gitignore @@ -2137,7 +2137,6 @@ /none/tests/s390x/sub /none/tests/s390x/sub-z14 /none/tests/s390x/sub_EI -/none/tests/s390x/bfp-tdc /none/tests/s390x/hfp /none/tests/s390x/xc /none/tests/s390x/xor @@ -2190,10 +2189,10 @@ /none/tests/s390x/rounding-3 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load +/none/tests/s390x/bfp-fpc +/none/tests/s390x/bfp-tdc /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-compare -/none/tests/s390x/srnm -/none/tests/s390x/srnmb /none/tests/s390x/comp-1 /none/tests/s390x/comp-2 /none/tests/s390x/ex diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index b1f41a90fa..7d2d1f8c48 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,8 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc bfp-load rounding-1 rounding-2 rounding-3 bfp-arith \ - bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ + bfp-tdc bfp-load bfp-fpc rounding-1 rounding-3 bfp-arith \ + bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ diff --git a/none/tests/s390x/bfp-fpc.c b/none/tests/s390x/bfp-fpc.c new file mode 100644 index 0000000000..0862c5b040 --- /dev/null +++ b/none/tests/s390x/bfp-fpc.c @@ -0,0 +1,178 @@ +#include <assert.h> +#include <stdint.h> +#include <stdio.h> +#include "opcodes.h" +#include "rounding.h" + +/* Instructions modifying / querying the FPC register: + EFPC, LFPC, SFPC, STFPC, SRNM, SRNMB. + + No tests for SFASR and LFAS asa they are not implemented */ + +void +sfpc(unsigned mode) +{ + register unsigned r asm("1") = mode; + __asm__ volatile ( SFPC(1) : : "d"(r) ); +} + +unsigned +get_rounding_mode(void) +{ + unsigned fpc1; + uint64_t fpc2 = ~(uint64_t)0; + + __asm__ volatile ("stfpc %0" : "=Q"(fpc1)); + __asm__ volatile ("efpc %0" : "+d"(fpc2)); + + assert((fpc1 & 0x7) == (fpc2 & 0x7)); + assert((fpc2 >> 32) == 0xFFFFFFFF); + + return fpc1 & 0x7; +} + +#define srnm(b,d) \ + ({ \ + __asm__ volatile ("srnm %[displ] (%[base])\n\t" \ + : : [base]"a"(b), [displ]"L"(d)); \ + }) + +#define srnmb(b,d) \ + ({ \ + __asm__ volatile ("srnmb %[displ] (%[base])\n\t" \ + : : [base]"a"(b), [displ]"L"(d)); \ + }) + +int main(void) +{ + /* Order of rounding modes is such that the first rounding mode in + the list differs from the default rounding mode which is + FPC_BFP_ROUND_NEAREST_EVEN. */ + const unsigned rmodes[] = { + FPC_BFP_ROUND_ZERO, + FPC_BFP_ROUND_POSINF, + FPC_BFP_ROUND_NEGINF, + FPC_BFP_ROUND_PREPARE_SHORT, + FPC_BFP_ROUND_NEAREST_EVEN, + }; + + int initial = get_rounding_mode(); + assert(initial == FPC_BFP_ROUND_NEAREST_EVEN); + + printf("initial rounding mode: %u\n", initial); + + printf("Setting FPC rounding mode via SFPC\n"); + for (int i = 0; i < sizeof rmodes / sizeof rmodes[0]; ++i) { + printf("setting rounding mode to %u\n", rmodes[i]); + sfpc(rmodes[i]); + printf("...checking: %u\n", get_rounding_mode()); + } + + putchar('\n'); + printf("Setting FPC rounding mode via SRNM\n"); + /* Only rounding modes 0,1,2,3 are valid for SRNM */ + + /* Rounding mode --> base register */ + printf(".... using base register\n"); + printf("setting rounding mode to %u\n", 0); + srnm(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnm(1, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnm(2, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnm(3, 0); + printf("...checking: %u\n", get_rounding_mode()); + + /* Rounding mode --> displacement */ + printf(".... using displacement\n"); + printf("setting rounding mode to %u\n", 0); + srnm(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnm(0, 1); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnm(0, 2); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnm(0, 3); + printf("...checking: %u\n", get_rounding_mode()); + + putchar('\n'); + printf("Setting FPC rounding mode via SRNMB\n"); + /* All rounding modes allowed */ + + /* Rounding mode --> base register */ + printf(".... using base register\n"); + printf("setting rounding mode to %u\n", 0); + srnmb(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnmb(1, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnmb(2, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnmb(3, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 7); + srnmb(7, 0); + printf("...checking: %u\n", get_rounding_mode()); + + /* Rounding mode --> displacement */ + printf(".... using displacement\n"); + printf("setting rounding mode to %u\n", 0); + srnmb(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnmb(0, 1); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnmb(0, 2); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnmb(0, 3); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 7); + srnmb(0, 7); + printf("...checking: %u\n", get_rounding_mode()); + + putchar('\n'); + printf("SRNM specific checks\n"); + /* Making sure base reg and displacement are added. */ + srnm(1,2); // 1 + 2 = 3 + printf("rounding mode = %u\n", get_rounding_mode()); + /* Making sure extra bits get masked away */ + srnm(0,0xfff); /* 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + srnm(0xfff,0); /* 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + srnm(0xfff,0xfff); /* 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + srnm(3,3); /* 2 */ + printf("rounding mode = %u\n", get_rounding_mode()); + + putchar('\n'); + printf("SRNMB specific checks\n"); + /* Making sure base reg and displacement are added. */ + srnmb(3,4); // 3 + 4 = 7 + printf("rounding mode = %u\n", get_rounding_mode()); + + putchar('\n'); + printf("LFPC\n"); + unsigned fpcval; + + sfpc(3); /* Set rounding mode to 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + __asm__ volatile ("stfpc %0" : "=Q"(fpcval)); /* Store FPC -> fpcval; */ + fpcval = (fpcval & ~0x7) | 0x2; /* modify rounding mode bits */ + __asm__ volatile ("lfpc %0" : "=Q"(fpcval)); + printf("rounding mode = %u\n", get_rounding_mode()); + + return 0; +} diff --git a/none/tests/s390x/rounding-2.stderr.exp b/none/tests/s390x/bfp-fpc.stderr.exp similarity index 100% rename from none/tests/s390x/rounding-2.stderr.exp rename to none/tests/s390x/bfp-fpc.stderr.exp diff --git a/none/tests/s390x/bfp-fpc.stdout.exp b/none/tests/s390x/bfp-fpc.stdout.exp new file mode 100644 index 0000000000..6e6c2c9ef6 --- /dev/null +++ b/none/tests/s390x/bfp-fpc.stdout.exp @@ -0,0 +1,70 @@ +initial rounding mode: 0 +Setting FPC rounding mode via SFPC +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +setting rounding mode to 7 +...checking: 7 +setting rounding mode to 0 +...checking: 0 + +Setting FPC rounding mode via SRNM +.... using base register +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +.... using displacement +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 + +Setting FPC rounding mode via SRNMB +.... using base register +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +setting rounding mode to 7 +...checking: 7 +.... using displacement +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +setting rounding mode to 7 +...checking: 7 + +SRNM specific checks +rounding mode = 3 +rounding mode = 3 +rounding mode = 3 +rounding mode = 2 +rounding mode = 2 + +SRNMB specific checks +rounding mode = 7 + +LFPC +rounding mode = 3 +rounding mode = 2 diff --git a/none/tests/s390x/bfp-fpc.vgtest b/none/tests/s390x/bfp-fpc.vgtest new file mode 100644 index 0000000000..d7306a2e32 --- /dev/null +++ b/none/tests/s390x/bfp-fpc.vgtest @@ -0,0 +1,2 @@ +prog: bfp-fpc +prereq: ../../../tests/s390x_features s390x-fpext diff --git a/none/tests/s390x/rounding-2.c b/none/tests/s390x/rounding-2.c deleted file mode 100644 index 32813ad267..0000000000 --- a/none/tests/s390x/rounding-2.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include "opcodes.h" - -/* Basic test that we can set the rounding mode in the FPC and - query it. Covers only generally available rounding modes. */ - -void -set_rounding_mode(unsigned mode) -{ - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - -unsigned -get_rounding_mode(void) -{ - unsigned fpc; - - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); - - return fpc & 0x7; -} - - -int main(void) -{ - int i; - const unsigned rmodes[] = { 0, 1, 2, 3 }; - - printf("initial rounding mode: %u\n", get_rounding_mode()); - - for (i = 0; i < sizeof rmodes / sizeof rmodes[0]; ++i) { - printf("setting rounding mode to %u\n", rmodes[i]); - set_rounding_mode(rmodes[i]); - printf("...checking: %u\n", get_rounding_mode()); - } - - return 0; -} diff --git a/none/tests/s390x/rounding-2.stdout.exp b/none/tests/s390x/rounding-2.stdout.exp deleted file mode 100644 index e0da369578..0000000000 --- a/none/tests/s390x/rounding-2.stdout.exp +++ /dev/null @@ -1,9 +0,0 @@ -initial rounding mode: 0 -setting rounding mode to 0 -...checking: 0 -setting rounding mode to 1 -...checking: 1 -setting rounding mode to 2 -...checking: 2 -setting rounding mode to 3 -...checking: 3 diff --git a/none/tests/s390x/rounding-2.vgtest b/none/tests/s390x/rounding-2.vgtest deleted file mode 100644 index c6e067d8b0..0000000000 --- a/none/tests/s390x/rounding-2.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-2 diff --git a/none/tests/s390x/srnm.c b/none/tests/s390x/srnm.c deleted file mode 100644 index b2948f3277..0000000000 --- a/none/tests/s390x/srnm.c +++ /dev/null @@ -1,47 +0,0 @@ -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include "opcodes.h" - -#define srnm(b,d) \ - ({ \ - __asm__ volatile ( "lghi 8," #b "\n\t" \ - "srnm " #d "(8)\n\t" ::: "8"); \ - }) - -#define get_rounding_mode() \ - ({ \ - unsigned fpc; \ - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); \ - fpc & 0x7; \ - }) - -int main(void) -{ - printf("initial rounding mode = %u\n", get_rounding_mode()); - - /* Set basic rounding modes in various ways */ - srnm(1,2); // 1 + 2 = 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(2,0); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0,1); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0,0); - printf("rounding mode = %u\n", get_rounding_mode()); - - /* Some rounding modes with bits to be ignored */ - srnm(0xff,0); // -> 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0,0xfe); // -> 2 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0xf0,0x0f); // -> 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - return 0; -} diff --git a/none/tests/s390x/srnm.stderr.exp b/none/tests/s390x/srnm.stderr.exp deleted file mode 100644 index 139597f9cb..0000000000 --- a/none/tests/s390x/srnm.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/srnm.stdout.exp b/none/tests/s390x/srnm.stdout.exp deleted file mode 100644 index a5a027802c..0000000000 --- a/none/tests/s390x/srnm.stdout.exp +++ /dev/null @@ -1,8 +0,0 @@ -initial rounding mode = 0 -rounding mode = 3 -rounding mode = 2 -rounding mode = 1 -rounding mode = 0 -rounding mode = 3 -rounding mode = 2 -rounding mode = 3 diff --git a/none/tests/s390x/srnm.vgtest b/none/tests/s390x/srnm.vgtest deleted file mode 100644 index 4144aeb190..0000000000 --- a/none/tests/s390x/srnm.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: srnm diff --git a/none/tests/s390x/srnmb.c b/none/tests/s390x/srnmb.c deleted file mode 100644 index 72fc799fb7..0000000000 --- a/none/tests/s390x/srnmb.c +++ /dev/null @@ -1,65 +0,0 @@ -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include "opcodes.h" - -#define srnmb(b,d) \ - ({ \ - __asm__ volatile ( "lghi 8," #b "\n\t" \ - SRNMB(8,d) \ - ::: "8"); \ - }) - - -/* Like srnm above, except it uses r0 as a base register */ -#define srnmb0(d) \ - ({ \ - __asm__ volatile ( SRNMB(0,d) \ - ::: "0"); \ - }) - -#define get_rounding_mode() \ - ({ \ - unsigned fpc; \ - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); \ - fpc & 0x7; \ - }) - -int main(void) -{ - setlinebuf(stdout); - printf("initial rounding mode = %u\n", get_rounding_mode()); - - /* Set basic rounding modes in various ways */ - srnmb(1,002); // 1 + 2 = 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(2,000); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,001); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,000); - printf("rounding mode = %u\n", get_rounding_mode()); - -#if 0 - // fpext - srnmb(7,000); // -> 7 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,000); // -> 0 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,007); // -> 7 - printf("rounding mode = %u\n", get_rounding_mode()); -#endif - - srnmb(0,001); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb0(004); // -> specification exception - printf("rounding mode = %u\n", get_rounding_mode()); - - return 0; -} diff --git a/none/tests/s390x/srnmb.stderr.exp b/none/tests/s390x/srnmb.stderr.exp deleted file mode 100644 index bfdaf8b0ab..0000000000 --- a/none/tests/s390x/srnmb.stderr.exp +++ /dev/null @@ -1,19 +0,0 @@ - -vex s390->IR: specification exception: B2B8 0004 -valgrind: Unrecognised instruction at address 0x......... - at 0x........: main (srnmb.c:59) -Your program just tried to execute an instruction that Valgrind -did not recognise. There are two possible reasons for this. -1. Your program has a bug and erroneously jumped to a non-code - location. If you are running Memcheck and you just saw a - warning about a bad jump, it's probably your program's fault. -2. The instruction is legitimate but Valgrind doesn't handle it, - i.e. it's Valgrind's fault. If you think this is the case or - you are not sure, please let us know and we'll try to fix it. -Either way, Valgrind will now raise a SIGILL signal which will -probably kill your program. - -Process terminating with default action of signal 4 (SIGILL) - Illegal opcode at address 0x........ - at 0x........: main (srnmb.c:59) - diff --git a/none/tests/s390x/srnmb.stdout.exp b/none/tests/s390x/srnmb.stdout.exp deleted file mode 100644 index c9127aaf1c..0000000000 --- a/none/tests/s390x/srnmb.stdout.exp +++ /dev/null @@ -1,6 +0,0 @@ -initial rounding mode = 0 -rounding mode = 3 -rounding mode = 2 -rounding mode = 1 -rounding mode = 0 -rounding mode = 1 diff --git a/none/tests/s390x/srnmb.vgtest b/none/tests/s390x/srnmb.vgtest deleted file mode 100644 index 6eff81bafc..0000000000 --- a/none/tests/s390x/srnmb.vgtest +++ /dev/null @@ -1,2 +0,0 @@ -prog: srnmb -vgopts: --show-emwarns=yes |
|
From: Florian K. <fl...@ei...> - 2025-09-23 09:11:34
|
Hi Paul,
as of c1f6e5e64a I am getting:
m_ume/script.c: In function ‘vgPlain_load_script’:
m_ume/script.c:130:20: warning: cast discards ‘const’ qualifier from pointer
target type [-Wcast-qual]
130 | VG_(free)((void*)VG_(args_the_exename));
Reading through your commit message:
If it gets called more than
once it sets VG_(args_the_exename) to point to the new name.
But that is on the stack. Later, if the stack grows too much the
name will get overwritten.
So somebody was assigning a pointer to stack allocated space to a global
variable. I've noticed that you ran Coverity Scan on valgrind occasionally. They
did not spot this?
Cheers,
Florian
|
|
From: Florian K. <fk...@so...> - 2025-09-22 22:21:28
|
https://sourceware.org/cgit/valgrind/commit/?id=69e67dadf5572b5e6521da2b87633d503f1d597b commit 69e67dadf5572b5e6521da2b87633d503f1d597b Author: Florian Krohm <fl...@ei...> Date: Mon Sep 22 22:20:57 2025 +0000 s390: BFP testsuite: load positive/negative/complement, load and test Remove bfp-2. Add bfp-load Observe condition code! Also add correct bfp-compare.stdout.exp (c.f. 6190acedb1d) Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 2 +- none/tests/s390x/Makefile.am | 4 +- none/tests/s390x/bfp-2.c | 81 ------ none/tests/s390x/bfp-2.stdout.exp | 12 - none/tests/s390x/bfp-2.vgtest | 1 - none/tests/s390x/bfp-compare.stdout.exp | 275 +++++++++++++++++---- none/tests/s390x/bfp-load.c | 168 +++++++++++++ .../{bfp-2.stderr.exp => bfp-load.stderr.exp} | 0 none/tests/s390x/bfp-load.stdout.exp | 109 ++++++++ none/tests/s390x/bfp-load.vgtest | 1 + 10 files changed, 511 insertions(+), 142 deletions(-) diff --git a/.gitignore b/.gitignore index efdfea78aa..fb69b92a02 100644 --- a/.gitignore +++ b/.gitignore @@ -2189,7 +2189,7 @@ /none/tests/s390x/rounding-2 /none/tests/s390x/rounding-3 /none/tests/s390x/bfp-arith -/none/tests/s390x/bfp-2 +/none/tests/s390x/bfp-load /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-compare /none/tests/s390x/srnm diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 89bba9ec8a..b1f41a90fa 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,8 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc rounding-1 rounding-2 rounding-3 bfp-arith \ - bfp-2 bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ + bfp-tdc bfp-load rounding-1 rounding-2 rounding-3 bfp-arith \ + bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c deleted file mode 100644 index 7fbc2cbf3b..0000000000 --- a/none/tests/s390x/bfp-2.c +++ /dev/null @@ -1,81 +0,0 @@ -#include <stdio.h> - -/* Test various BFP ops: - - load negative - - load positive - - load complement -*/ - -void lnebr(float in) -{ - float out; - - __asm__ volatile("lnebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lnebr %f -> %f\n", in, out); -} - -void lndbr(double in) -{ - double out; - - __asm__ volatile("lndbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lndbr %f -> %f\n", in, out); -} - -void lpebr(float in) -{ - float out; - - __asm__ volatile("lpebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lpebr %f -> %f\n", in, out); -} - -void lpdbr(double in) -{ - double out; - - __asm__ volatile("lpdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lpdbr %f -> %f\n", in, out); -} - -void lcebr(float in) -{ - float out; - - __asm__ volatile("lcebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lcebr %f -> %f\n", in, out); -} - -void lcdbr(double in) -{ - double out; - - __asm__ volatile("lcdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lcdbr %f -> %f\n", in, out); -} - -int main(void) -{ - // load negative - lnebr(-2.5f); // 4 byte values - lnebr(12.5f); // 4 byte values - - lndbr(-0.5); // 8 byte values - lndbr(42.5); // 8 byte values - - // load positive - lpebr(-2.5f); // 4 byte values - lpebr(12.5f); // 4 byte values - - lpdbr(-0.5); // 8 byte values - lpdbr(42.5); // 8 byte values - - // load complement - lcebr(-23.5f); // 4 byte values - lcebr(123.5f); // 4 byte values - - lcdbr(-17.5); // 8 byte values - lcdbr(234.5); // 8 byte values - - return 0; -} diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp deleted file mode 100644 index d2bc54136b..0000000000 --- a/none/tests/s390x/bfp-2.stdout.exp +++ /dev/null @@ -1,12 +0,0 @@ -lnebr -2.500000 -> -2.500000 -lnebr 12.500000 -> -12.500000 -lndbr -0.500000 -> -0.500000 -lndbr 42.500000 -> -42.500000 -lpebr -2.500000 -> 2.500000 -lpebr 12.500000 -> 12.500000 -lpdbr -0.500000 -> 0.500000 -lpdbr 42.500000 -> 42.500000 -lcebr -23.500000 -> 23.500000 -lcebr 123.500000 -> -123.500000 -lcdbr -17.500000 -> 17.500000 -lcdbr 234.500000 -> -234.500000 diff --git a/none/tests/s390x/bfp-2.vgtest b/none/tests/s390x/bfp-2.vgtest deleted file mode 100644 index 239b8f985d..0000000000 --- a/none/tests/s390x/bfp-2.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-2 diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp index 4f2c2a940a..b81f3f6e24 100644 --- a/none/tests/s390x/bfp-compare.stdout.exp +++ b/none/tests/s390x/bfp-compare.stdout.exp @@ -1,45 +1,230 @@ -LOAD AND TEST short BFP -ltebr 100.000000 -> 100.000000 cc = 2 -ltebr -10.500000 -> -10.500000 cc = 1 -ltebr 0.000000 -> 0.000000 cc = 0 -ltebr nan -> nan cc = 3 -LOAD AND TEST long BFP -ltdbr 100.000000 -> 100.000000 cc = 2 -ltdbr -10.500000 -> -10.500000 cc = 1 -ltdbr 0.000000 -> 0.000000 cc = 0 -ltdbr nan -> nan cc = 3 -LOAD AND TEST extended BFP -ltxbr 100.000000 -> 100.000000 cc = 2 -ltxbr -10.500000 -> -10.500000 cc = 1 -ltxbr 0.000000 -> 0.000000 cc = 0 -ltxbr nan -> nan cc = 3 - -LOAD LENGTHENED short BFP -> long BFP -ldebr 101.5 -> 101.500000 -ldebr -11.1 -> -11.100000 -ldebr 0 -> 0.000000 -ldebr 7e-06 -> 0.000007 -ldebr nan -> nan -ldebr inf -> inf -ldebr -inf -> -inf -LOAD LENGTHENED short BFP -> extended BFP -lxebr 101.5 -> 101.500000 -lxebr -11.1 -> -11.100000 -lxebr 0 -> 0.000000 -lxebr 7e-06 -> 0.000007 -lxebr nan -> nan -lxebr inf -> inf -lxebr -inf -> -inf -LOAD LENGTHENED long BFP -> extended BFP -lxdbr 101.5 -> 101.500000 -lxdbr -11.1 -> -11.100000 -lxdbr 0 -> 0.000000 -lxdbr 7e-16 -> 7e-16 -lxdbr nan -> nan -lxdbr inf -> inf -lxdbr -inf -> -inf - -LOAD ZERO -lzer gpr value = 0 -lzdr gpr value = 0 -lzdr gpr values = 0 0 +cebr: 3.14 == 3.14 +ceb: 3.14 == 3.14 +kebr: 3.14 == 3.14 +keb: 3.14 == 3.14 +cdbr: 3.14 == 3.14 +cdb: 3.14 == 3.14 +kdbr: 3.14 == 3.14 +kdb: 3.14 == 3.14 +cxbr: 3.14 == 3.14 +kxbr: 3.14 == 3.14 +cebr: -2.78 < 2.78 +ceb: -2.78 < 2.78 +kebr: -2.78 < 2.78 +keb: -2.78 < 2.78 +cdbr: -2.78 < 2.78 +cdb: -2.78 < 2.78 +kdbr: -2.78 < 2.78 +kdb: -2.78 < 2.78 +cxbr: -2.78 < 2.78 +kxbr: -2.78 < 2.78 +cebr: inf == inf +ceb: inf == inf +kebr: inf == inf +keb: inf == inf +cdbr: inf == inf +cdb: inf == inf +kdbr: inf == inf +kdb: inf == inf +cxbr: inf == inf +kxbr: inf == inf +cebr: inf > -inf +ceb: inf > -inf +kebr: inf > -inf +keb: inf > -inf +cdbr: inf > -inf +cdb: inf > -inf +kdbr: inf > -inf +kdb: inf > -inf +cxbr: inf > -inf +kxbr: inf > -inf +cebr: -inf == -inf +ceb: -inf == -inf +kebr: -inf == -inf +keb: -inf == -inf +cdbr: -inf == -inf +cdb: -inf == -inf +kdbr: -inf == -inf +kdb: -inf == -inf +cxbr: -inf == -inf +kxbr: -inf == -inf +cebr: -inf < inf +ceb: -inf < inf +kebr: -inf < inf +keb: -inf < inf +cdbr: -inf < inf +cdb: -inf < inf +kdbr: -inf < inf +kdb: -inf < inf +cxbr: -inf < inf +kxbr: -inf < inf +cebr: inf > 1 +ceb: inf > 1 +kebr: inf > 1 +keb: inf > 1 +cdbr: inf > 1 +cdb: inf > 1 +kdbr: inf > 1 +kdb: inf > 1 +cxbr: inf > 1 +kxbr: inf > 1 +cebr: -inf < -1 +ceb: -inf < -1 +kebr: -inf < -1 +keb: -inf < -1 +cdbr: -inf < -1 +cdb: -inf < -1 +kdbr: -inf < -1 +kdb: -inf < -1 +cxbr: -inf < -1 +kxbr: -inf < -1 +cebr: 1 < inf +ceb: 1 < inf +kebr: 1 < inf +keb: 1 < inf +cdbr: 1 < inf +cdb: 1 < inf +kdbr: 1 < inf +kdb: 1 < inf +cxbr: 1 < inf +kxbr: 1 < inf +cebr: -1 > -inf +ceb: -1 > -inf +kebr: -1 > -inf +keb: -1 > -inf +cdbr: -1 > -inf +cdb: -1 > -inf +kdbr: -1 > -inf +kdb: -1 > -inf +cxbr: -1 > -inf +kxbr: -1 > -inf +cebr: nan ?? nan +ceb: nan ?? nan +kebr: nan ?? nan +keb: nan ?? nan +cdbr: nan ?? nan +cdb: nan ?? nan +kdbr: nan ?? nan +kdb: nan ?? nan +cxbr: nan ?? nan +kxbr: nan ?? nan +cebr: nan ?? -nan +ceb: nan ?? -nan +kebr: nan ?? -nan +keb: nan ?? -nan +cdbr: nan ?? -nan +cdb: nan ?? -nan +kdbr: nan ?? -nan +kdb: nan ?? -nan +cxbr: nan ?? -nan +kxbr: nan ?? -nan +cebr: -nan ?? nan +ceb: -nan ?? nan +kebr: -nan ?? nan +keb: -nan ?? nan +cdbr: -nan ?? nan +cdb: -nan ?? nan +kdbr: -nan ?? nan +kdb: -nan ?? nan +cxbr: -nan ?? nan +kxbr: -nan ?? nan +cebr: -nan ?? -nan +ceb: -nan ?? -nan +kebr: -nan ?? -nan +keb: -nan ?? -nan +cdbr: -nan ?? -nan +cdb: -nan ?? -nan +kdbr: -nan ?? -nan +kdb: -nan ?? -nan +cxbr: -nan ?? -nan +kxbr: -nan ?? -nan +cebr: nan ?? inf +ceb: nan ?? inf +kebr: nan ?? inf +keb: nan ?? inf +cdbr: nan ?? inf +cdb: nan ?? inf +kdbr: nan ?? inf +kdb: nan ?? inf +cxbr: nan ?? inf +kxbr: nan ?? inf +cebr: nan ?? -inf +ceb: nan ?? -inf +kebr: nan ?? -inf +keb: nan ?? -inf +cdbr: nan ?? -inf +cdb: nan ?? -inf +kdbr: nan ?? -inf +kdb: nan ?? -inf +cxbr: nan ?? -inf +kxbr: nan ?? -inf +cebr: -nan ?? inf +ceb: -nan ?? inf +kebr: -nan ?? inf +keb: -nan ?? inf +cdbr: -nan ?? inf +cdb: -nan ?? inf +kdbr: -nan ?? inf +kdb: -nan ?? inf +cxbr: -nan ?? inf +kxbr: -nan ?? inf +cebr: -nan ?? -inf +ceb: -nan ?? -inf +kebr: -nan ?? -inf +keb: -nan ?? -inf +cdbr: -nan ?? -inf +cdb: -nan ?? -inf +kdbr: -nan ?? -inf +kdb: -nan ?? -inf +cxbr: -nan ?? -inf +kxbr: -nan ?? -inf +cebr: nan ?? 1.5 +ceb: nan ?? 1.5 +kebr: nan ?? 1.5 +keb: nan ?? 1.5 +cdbr: nan ?? 1.5 +cdb: nan ?? 1.5 +kdbr: nan ?? 1.5 +kdb: nan ?? 1.5 +cxbr: nan ?? 1.5 +kxbr: nan ?? 1.5 +cebr: -nan ?? -1.5 +ceb: -nan ?? -1.5 +kebr: -nan ?? -1.5 +keb: -nan ?? -1.5 +cdbr: -nan ?? -1.5 +cdb: -nan ?? -1.5 +kdbr: -nan ?? -1.5 +kdb: -nan ?? -1.5 +cxbr: -nan ?? -1.5 +kxbr: -nan ?? -1.5 +cebr: 1.5 ?? nan +ceb: 1.5 ?? nan +kebr: 1.5 ?? nan +keb: 1.5 ?? nan +cdbr: 1.5 ?? nan +cdb: 1.5 ?? nan +kdbr: 1.5 ?? nan +kdb: 1.5 ?? nan +cxbr: 1.5 ?? nan +kxbr: 1.5 ?? nan +cebr: -1.5 ?? -nan +ceb: -1.5 ?? -nan +kebr: -1.5 ?? -nan +keb: -1.5 ?? -nan +cdbr: -1.5 ?? -nan +cdb: -1.5 ?? -nan +kdbr: -1.5 ?? -nan +kdb: -1.5 ?? -nan +cxbr: -1.5 ?? -nan +kxbr: -1.5 ?? -nan +cebr: 0 == -0 +ceb: 0 == -0 +kebr: 0 == -0 +keb: 0 == -0 +cdbr: 0 == -0 +cdb: 0 == -0 +kdbr: 0 == -0 +kdb: 0 == -0 +cxbr: 0 == -0 +kxbr: 0 == -0 diff --git a/none/tests/s390x/bfp-load.c b/none/tests/s390x/bfp-load.c new file mode 100644 index 0000000000..e5d862e697 --- /dev/null +++ b/none/tests/s390x/bfp-load.c @@ -0,0 +1,168 @@ +#include <stdio.h> +#include <assert.h> +#include <math.h> + +/* Test various BFP ops: + - load and test + - load zero +*/ + +#define LOADxxx(insn, initial, type, fmt) \ + do { \ + int cc; \ + type in = initial; \ + type out = 17; \ + __asm__ volatile("cr 0,0\n\t /* clear cc */\n\t" \ + insn " %[r1],%[r2]\n\t" \ + "ipm %[psw]\n\t" \ + "srl %[psw],28\n\t" \ + : [r1]"=f"(out), [psw]"=d"(cc) \ + : [r2]"f"(in) \ + : "cc"); \ + printf(insn " " fmt " -> " fmt " cc = %d\n", in, out, cc); \ + } while (0) + +void lzxr(void) +{ + long double value; + + __builtin_memset(&value, 0xff, sizeof value); + __asm__ volatile("lzxr %[r1]" : [r1]"=f"(value)); + + printf("lzxr --> "); + for (unsigned i = 0; i < sizeof(long double); ++i) { + if (i % 4 == 0) putchar(' '); + unsigned byte = ((char *)&value)[i]; + printf("%02u", byte); + } + putchar ('\n'); +} + +int main(void) +{ + assert(sizeof(long double) == 16); + + printf("LOAD AND TEST short BFP\n"); + LOADxxx("ltebr", 100.0f, float, "%f"); + LOADxxx("ltebr", -10.5f, float, "%f"); + LOADxxx("ltebr", 0.0f, float, "%f"); + LOADxxx("ltebr", NAN, float, "%f"); + LOADxxx("ltebr", -NAN, float, "%f"); + LOADxxx("ltebr", INFINITY, float, "%f"); + LOADxxx("ltebr", -INFINITY, float, "%f"); + + printf("LOAD AND TEST long BFP\n"); + LOADxxx("ltdbr", 100.0, double, "%f"); + LOADxxx("ltdbr", -10.5, double, "%f"); + LOADxxx("ltdbr", 0.0, double, "%f"); + LOADxxx("ltdbr", NAN, double, "%f"); + LOADxxx("ltdbr", INFINITY, double, "%f"); + LOADxxx("ltdbr", -INFINITY, double, "%f"); + + printf("LOAD AND TEST extended BFP\n"); + LOADxxx("ltxbr", 100.0L, long double, "%Lf"); + LOADxxx("ltxbr", -10.5L, long double, "%Lf"); + LOADxxx("ltxbr", 0.0L, long double, "%Lf"); + LOADxxx("ltxbr", NAN, long double, "%Lf"); + LOADxxx("ltxbr", INFINITY, long double, "%Lf"); + LOADxxx("ltxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD NEGATIVE short BFP\n"); + LOADxxx("lnebr", 0.0f, float, "%f"); + LOADxxx("lnebr", -0.0f, float, "%f"); + LOADxxx("lnebr", 123.0f, float, "%f"); + LOADxxx("lnebr", -12.0f, float, "%f"); + LOADxxx("lnebr", NAN, float, "%f"); + LOADxxx("lnebr", -NAN, float, "%f"); + LOADxxx("lnebr", INFINITY, float, "%f"); + LOADxxx("lnebr", -INFINITY, float, "%f"); + + printf("LOAD NEGATIVE long BFP\n"); + LOADxxx("lndbr", 0.0, double, "%f"); + LOADxxx("lndbr", -0.0, double, "%f"); + LOADxxx("lndbr", 123.0, double, "%f"); + LOADxxx("lndbr", -12.0, double, "%f"); + LOADxxx("lndbr", NAN, double, "%f"); + LOADxxx("lndbr", -NAN, double, "%f"); + LOADxxx("lndbr", INFINITY, double, "%f"); + LOADxxx("lndbr", -INFINITY, double, "%f"); + + printf("LOAD NEGATIVE extended BFP\n"); + LOADxxx("lnxbr", 0.0L, long double, "%Lf"); + LOADxxx("lnxbr", -0.0L, long double, "%Lf"); + LOADxxx("lnxbr", 123.0L, long double, "%Lf"); + LOADxxx("lnxbr", -12.0L, long double, "%Lf"); + LOADxxx("lnxbr", NAN, long double, "%Lf"); + LOADxxx("lnxbr", -NAN, long double, "%Lf"); + LOADxxx("lnxbr", INFINITY, long double, "%Lf"); + LOADxxx("lnxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD POSITIVE short BFP\n"); + LOADxxx("lpebr", 0.0f, float, "%f"); + LOADxxx("lpebr", -0.0f, float, "%f"); + LOADxxx("lpebr", 123.0f, float, "%f"); + LOADxxx("lpebr", -12.0f, float, "%f"); + LOADxxx("lpebr", NAN, float, "%f"); + LOADxxx("lpebr", -NAN, float, "%f"); + LOADxxx("lpebr", INFINITY, float, "%f"); + LOADxxx("lpebr", -INFINITY, float, "%f"); + + printf("LOAD POSITIVE long BFP\n"); + LOADxxx("lpdbr", 0.0, double, "%f"); + LOADxxx("lpdbr", -0.0, double, "%f"); + LOADxxx("lpdbr", 123.0, double, "%f"); + LOADxxx("lpdbr", -12.0, double, "%f"); + LOADxxx("lpdbr", NAN, double, "%f"); + LOADxxx("lpdbr", -NAN, double, "%f"); + LOADxxx("lpdbr", INFINITY, double, "%f"); + LOADxxx("lpdbr", -INFINITY, double, "%f"); + + printf("LOAD POSITIVE extended BFP\n"); + LOADxxx("lpxbr", 0.0L, long double, "%Lf"); + LOADxxx("lpxbr", -0.0L, long double, "%Lf"); + LOADxxx("lpxbr", 123.0L, long double, "%Lf"); + LOADxxx("lpxbr", -12.0L, long double, "%Lf"); + LOADxxx("lpxbr", NAN, long double, "%Lf"); + LOADxxx("lpxbr", -NAN, long double, "%Lf"); + LOADxxx("lpxbr", INFINITY, long double, "%Lf"); + LOADxxx("lpxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD COMPLEMENT short BFP\n"); + LOADxxx("lcebr", 0.0f, float, "%f"); + LOADxxx("lcebr", -0.0f, float, "%f"); + LOADxxx("lcebr", 123.0f, float, "%f"); + LOADxxx("lcebr", -12.0f, float, "%f"); + LOADxxx("lcebr", NAN, float, "%f"); + LOADxxx("lcebr", -NAN, float, "%f"); + LOADxxx("lcebr", INFINITY, float, "%f"); + LOADxxx("lcebr", -INFINITY, float, "%f"); + + printf("LOAD COMPLEMENT long BFP\n"); + LOADxxx("lcdbr", 0.0, double, "%f"); + LOADxxx("lcdbr", -0.0, double, "%f"); + LOADxxx("lcdbr", 123.0, double, "%f"); + LOADxxx("lcdbr", -12.0, double, "%f"); + LOADxxx("lcdbr", NAN, double, "%f"); + LOADxxx("lcdbr", -NAN, double, "%f"); + LOADxxx("lcdbr", INFINITY, double, "%f"); + LOADxxx("lcdbr", -INFINITY, double, "%f"); + + printf("LOAD COMPLEMENT extended BFP\n"); + LOADxxx("lcxbr", 0.0L, long double, "%Lf"); + LOADxxx("lcxbr", -0.0L, long double, "%Lf"); + LOADxxx("lcxbr", 123.0L, long double, "%Lf"); + LOADxxx("lcxbr", -12.0L, long double, "%Lf"); + LOADxxx("lcxbr", NAN, long double, "%Lf"); + LOADxxx("lcxbr", -NAN, long double, "%Lf"); + LOADxxx("lcxbr", INFINITY, long double, "%Lf"); + LOADxxx("lcxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD ZERO\n"); + lzxr(); + + return 0; +} diff --git a/none/tests/s390x/bfp-2.stderr.exp b/none/tests/s390x/bfp-load.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-2.stderr.exp rename to none/tests/s390x/bfp-load.stderr.exp diff --git a/none/tests/s390x/bfp-load.stdout.exp b/none/tests/s390x/bfp-load.stdout.exp new file mode 100644 index 0000000000..a2c287c366 --- /dev/null +++ b/none/tests/s390x/bfp-load.stdout.exp @@ -0,0 +1,109 @@ +LOAD AND TEST short BFP +ltebr 100.000000 -> 100.000000 cc = 2 +ltebr -10.500000 -> -10.500000 cc = 1 +ltebr 0.000000 -> 0.000000 cc = 0 +ltebr nan -> nan cc = 3 +ltebr -nan -> -nan cc = 3 +ltebr inf -> inf cc = 2 +ltebr -inf -> -inf cc = 1 +LOAD AND TEST long BFP +ltdbr 100.000000 -> 100.000000 cc = 2 +ltdbr -10.500000 -> -10.500000 cc = 1 +ltdbr 0.000000 -> 0.000000 cc = 0 +ltdbr nan -> nan cc = 3 +ltdbr inf -> inf cc = 2 +ltdbr -inf -> -inf cc = 1 +LOAD AND TEST extended BFP +ltxbr 100.000000 -> 100.000000 cc = 2 +ltxbr -10.500000 -> -10.500000 cc = 1 +ltxbr 0.000000 -> 0.000000 cc = 0 +ltxbr nan -> nan cc = 3 +ltxbr inf -> inf cc = 2 +ltxbr -inf -> -inf cc = 1 + +LOAD NEGATIVE short BFP +lnebr 0.000000 -> -0.000000 cc = 0 +lnebr -0.000000 -> -0.000000 cc = 0 +lnebr 123.000000 -> -123.000000 cc = 1 +lnebr -12.000000 -> -12.000000 cc = 1 +lnebr nan -> -nan cc = 3 +lnebr -nan -> -nan cc = 3 +lnebr inf -> -inf cc = 1 +lnebr -inf -> -inf cc = 1 +LOAD NEGATIVE long BFP +lndbr 0.000000 -> -0.000000 cc = 0 +lndbr -0.000000 -> -0.000000 cc = 0 +lndbr 123.000000 -> -123.000000 cc = 1 +lndbr -12.000000 -> -12.000000 cc = 1 +lndbr nan -> -nan cc = 3 +lndbr -nan -> -nan cc = 3 +lndbr inf -> -inf cc = 1 +lndbr -inf -> -inf cc = 1 +LOAD NEGATIVE extended BFP +lnxbr 0.000000 -> -0.000000 cc = 0 +lnxbr -0.000000 -> -0.000000 cc = 0 +lnxbr 123.000000 -> -123.000000 cc = 1 +lnxbr -12.000000 -> -12.000000 cc = 1 +lnxbr nan -> -nan cc = 3 +lnxbr -nan -> -nan cc = 3 +lnxbr inf -> -inf cc = 1 +lnxbr -inf -> -inf cc = 1 + +LOAD POSITIVE short BFP +lpebr 0.000000 -> 0.000000 cc = 0 +lpebr -0.000000 -> 0.000000 cc = 0 +lpebr 123.000000 -> 123.000000 cc = 2 +lpebr -12.000000 -> 12.000000 cc = 2 +lpebr nan -> nan cc = 3 +lpebr -nan -> nan cc = 3 +lpebr inf -> inf cc = 2 +lpebr -inf -> inf cc = 2 +LOAD POSITIVE long BFP +lpdbr 0.000000 -> 0.000000 cc = 0 +lpdbr -0.000000 -> 0.000000 cc = 0 +lpdbr 123.000000 -> 123.000000 cc = 2 +lpdbr -12.000000 -> 12.000000 cc = 2 +lpdbr nan -> nan cc = 3 +lpdbr -nan -> nan cc = 3 +lpdbr inf -> inf cc = 2 +lpdbr -inf -> inf cc = 2 +LOAD POSITIVE extended BFP +lpxbr 0.000000 -> 0.000000 cc = 0 +lpxbr -0.000000 -> 0.000000 cc = 0 +lpxbr 123.000000 -> 123.000000 cc = 2 +lpxbr -12.000000 -> 12.000000 cc = 2 +lpxbr nan -> nan cc = 3 +lpxbr -nan -> nan cc = 3 +lpxbr inf -> inf cc = 2 +lpxbr -inf -> inf cc = 2 + +LOAD COMPLEMENT short BFP +lcebr 0.000000 -> -0.000000 cc = 0 +lcebr -0.000000 -> 0.000000 cc = 0 +lcebr 123.000000 -> -123.000000 cc = 1 +lcebr -12.000000 -> 12.000000 cc = 2 +lcebr nan -> -nan cc = 3 +lcebr -nan -> nan cc = 3 +lcebr inf -> -inf cc = 1 +lcebr -inf -> inf cc = 2 +LOAD COMPLEMENT long BFP +lcdbr 0.000000 -> -0.000000 cc = 0 +lcdbr -0.000000 -> 0.000000 cc = 0 +lcdbr 123.000000 -> -123.000000 cc = 1 +lcdbr -12.000000 -> 12.000000 cc = 2 +lcdbr nan -> -nan cc = 3 +lcdbr -nan -> nan cc = 3 +lcdbr inf -> -inf cc = 1 +lcdbr -inf -> inf cc = 2 +LOAD COMPLEMENT extended BFP +lcxbr 0.000000 -> -0.000000 cc = 0 +lcxbr -0.000000 -> 0.000000 cc = 0 +lcxbr 123.000000 -> -123.000000 cc = 1 +lcxbr -12.000000 -> 12.000000 cc = 2 +lcxbr nan -> -nan cc = 3 +lcxbr -nan -> nan cc = 3 +lcxbr inf -> -inf cc = 1 +lcxbr -inf -> inf cc = 2 + +LOAD ZERO +lzxr --> 00000000 00000000 00000000 00000000 diff --git a/none/tests/s390x/bfp-load.vgtest b/none/tests/s390x/bfp-load.vgtest new file mode 100644 index 0000000000..3e1dfc7db6 --- /dev/null +++ b/none/tests/s390x/bfp-load.vgtest @@ -0,0 +1 @@ +prog: bfp-load |
|
From: Florian K. <fk...@so...> - 2025-09-22 20:44:10
|
https://sourceware.org/cgit/valgrind/commit/?id=6190acedb1d5f1e8a3365e8affcf8ce5c0beac0f commit 6190acedb1d5f1e8a3365e8affcf8ce5c0beac0f Author: Florian Krohm <fl...@ei...> Date: Mon Sep 22 20:43:23 2025 +0000 s390: Add forgotten file bfp-compare.stdout.exp Diff: --- none/tests/s390x/bfp-compare.stdout.exp | 275 ++++++-------------------------- 1 file changed, 45 insertions(+), 230 deletions(-) diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp index b81f3f6e24..4f2c2a940a 100644 --- a/none/tests/s390x/bfp-compare.stdout.exp +++ b/none/tests/s390x/bfp-compare.stdout.exp @@ -1,230 +1,45 @@ -cebr: 3.14 == 3.14 -ceb: 3.14 == 3.14 -kebr: 3.14 == 3.14 -keb: 3.14 == 3.14 -cdbr: 3.14 == 3.14 -cdb: 3.14 == 3.14 -kdbr: 3.14 == 3.14 -kdb: 3.14 == 3.14 -cxbr: 3.14 == 3.14 -kxbr: 3.14 == 3.14 -cebr: -2.78 < 2.78 -ceb: -2.78 < 2.78 -kebr: -2.78 < 2.78 -keb: -2.78 < 2.78 -cdbr: -2.78 < 2.78 -cdb: -2.78 < 2.78 -kdbr: -2.78 < 2.78 -kdb: -2.78 < 2.78 -cxbr: -2.78 < 2.78 -kxbr: -2.78 < 2.78 -cebr: inf == inf -ceb: inf == inf -kebr: inf == inf -keb: inf == inf -cdbr: inf == inf -cdb: inf == inf -kdbr: inf == inf -kdb: inf == inf -cxbr: inf == inf -kxbr: inf == inf -cebr: inf > -inf -ceb: inf > -inf -kebr: inf > -inf -keb: inf > -inf -cdbr: inf > -inf -cdb: inf > -inf -kdbr: inf > -inf -kdb: inf > -inf -cxbr: inf > -inf -kxbr: inf > -inf -cebr: -inf == -inf -ceb: -inf == -inf -kebr: -inf == -inf -keb: -inf == -inf -cdbr: -inf == -inf -cdb: -inf == -inf -kdbr: -inf == -inf -kdb: -inf == -inf -cxbr: -inf == -inf -kxbr: -inf == -inf -cebr: -inf < inf -ceb: -inf < inf -kebr: -inf < inf -keb: -inf < inf -cdbr: -inf < inf -cdb: -inf < inf -kdbr: -inf < inf -kdb: -inf < inf -cxbr: -inf < inf -kxbr: -inf < inf -cebr: inf > 1 -ceb: inf > 1 -kebr: inf > 1 -keb: inf > 1 -cdbr: inf > 1 -cdb: inf > 1 -kdbr: inf > 1 -kdb: inf > 1 -cxbr: inf > 1 -kxbr: inf > 1 -cebr: -inf < -1 -ceb: -inf < -1 -kebr: -inf < -1 -keb: -inf < -1 -cdbr: -inf < -1 -cdb: -inf < -1 -kdbr: -inf < -1 -kdb: -inf < -1 -cxbr: -inf < -1 -kxbr: -inf < -1 -cebr: 1 < inf -ceb: 1 < inf -kebr: 1 < inf -keb: 1 < inf -cdbr: 1 < inf -cdb: 1 < inf -kdbr: 1 < inf -kdb: 1 < inf -cxbr: 1 < inf -kxbr: 1 < inf -cebr: -1 > -inf -ceb: -1 > -inf -kebr: -1 > -inf -keb: -1 > -inf -cdbr: -1 > -inf -cdb: -1 > -inf -kdbr: -1 > -inf -kdb: -1 > -inf -cxbr: -1 > -inf -kxbr: -1 > -inf -cebr: nan ?? nan -ceb: nan ?? nan -kebr: nan ?? nan -keb: nan ?? nan -cdbr: nan ?? nan -cdb: nan ?? nan -kdbr: nan ?? nan -kdb: nan ?? nan -cxbr: nan ?? nan -kxbr: nan ?? nan -cebr: nan ?? -nan -ceb: nan ?? -nan -kebr: nan ?? -nan -keb: nan ?? -nan -cdbr: nan ?? -nan -cdb: nan ?? -nan -kdbr: nan ?? -nan -kdb: nan ?? -nan -cxbr: nan ?? -nan -kxbr: nan ?? -nan -cebr: -nan ?? nan -ceb: -nan ?? nan -kebr: -nan ?? nan -keb: -nan ?? nan -cdbr: -nan ?? nan -cdb: -nan ?? nan -kdbr: -nan ?? nan -kdb: -nan ?? nan -cxbr: -nan ?? nan -kxbr: -nan ?? nan -cebr: -nan ?? -nan -ceb: -nan ?? -nan -kebr: -nan ?? -nan -keb: -nan ?? -nan -cdbr: -nan ?? -nan -cdb: -nan ?? -nan -kdbr: -nan ?? -nan -kdb: -nan ?? -nan -cxbr: -nan ?? -nan -kxbr: -nan ?? -nan -cebr: nan ?? inf -ceb: nan ?? inf -kebr: nan ?? inf -keb: nan ?? inf -cdbr: nan ?? inf -cdb: nan ?? inf -kdbr: nan ?? inf -kdb: nan ?? inf -cxbr: nan ?? inf -kxbr: nan ?? inf -cebr: nan ?? -inf -ceb: nan ?? -inf -kebr: nan ?? -inf -keb: nan ?? -inf -cdbr: nan ?? -inf -cdb: nan ?? -inf -kdbr: nan ?? -inf -kdb: nan ?? -inf -cxbr: nan ?? -inf -kxbr: nan ?? -inf -cebr: -nan ?? inf -ceb: -nan ?? inf -kebr: -nan ?? inf -keb: -nan ?? inf -cdbr: -nan ?? inf -cdb: -nan ?? inf -kdbr: -nan ?? inf -kdb: -nan ?? inf -cxbr: -nan ?? inf -kxbr: -nan ?? inf -cebr: -nan ?? -inf -ceb: -nan ?? -inf -kebr: -nan ?? -inf -keb: -nan ?? -inf -cdbr: -nan ?? -inf -cdb: -nan ?? -inf -kdbr: -nan ?? -inf -kdb: -nan ?? -inf -cxbr: -nan ?? -inf -kxbr: -nan ?? -inf -cebr: nan ?? 1.5 -ceb: nan ?? 1.5 -kebr: nan ?? 1.5 -keb: nan ?? 1.5 -cdbr: nan ?? 1.5 -cdb: nan ?? 1.5 -kdbr: nan ?? 1.5 -kdb: nan ?? 1.5 -cxbr: nan ?? 1.5 -kxbr: nan ?? 1.5 -cebr: -nan ?? -1.5 -ceb: -nan ?? -1.5 -kebr: -nan ?? -1.5 -keb: -nan ?? -1.5 -cdbr: -nan ?? -1.5 -cdb: -nan ?? -1.5 -kdbr: -nan ?? -1.5 -kdb: -nan ?? -1.5 -cxbr: -nan ?? -1.5 -kxbr: -nan ?? -1.5 -cebr: 1.5 ?? nan -ceb: 1.5 ?? nan -kebr: 1.5 ?? nan -keb: 1.5 ?? nan -cdbr: 1.5 ?? nan -cdb: 1.5 ?? nan -kdbr: 1.5 ?? nan -kdb: 1.5 ?? nan -cxbr: 1.5 ?? nan -kxbr: 1.5 ?? nan -cebr: -1.5 ?? -nan -ceb: -1.5 ?? -nan -kebr: -1.5 ?? -nan -keb: -1.5 ?? -nan -cdbr: -1.5 ?? -nan -cdb: -1.5 ?? -nan -kdbr: -1.5 ?? -nan -kdb: -1.5 ?? -nan -cxbr: -1.5 ?? -nan -kxbr: -1.5 ?? -nan -cebr: 0 == -0 -ceb: 0 == -0 -kebr: 0 == -0 -keb: 0 == -0 -cdbr: 0 == -0 -cdb: 0 == -0 -kdbr: 0 == -0 -kdb: 0 == -0 -cxbr: 0 == -0 -kxbr: 0 == -0 +LOAD AND TEST short BFP +ltebr 100.000000 -> 100.000000 cc = 2 +ltebr -10.500000 -> -10.500000 cc = 1 +ltebr 0.000000 -> 0.000000 cc = 0 +ltebr nan -> nan cc = 3 +LOAD AND TEST long BFP +ltdbr 100.000000 -> 100.000000 cc = 2 +ltdbr -10.500000 -> -10.500000 cc = 1 +ltdbr 0.000000 -> 0.000000 cc = 0 +ltdbr nan -> nan cc = 3 +LOAD AND TEST extended BFP +ltxbr 100.000000 -> 100.000000 cc = 2 +ltxbr -10.500000 -> -10.500000 cc = 1 +ltxbr 0.000000 -> 0.000000 cc = 0 +ltxbr nan -> nan cc = 3 + +LOAD LENGTHENED short BFP -> long BFP +ldebr 101.5 -> 101.500000 +ldebr -11.1 -> -11.100000 +ldebr 0 -> 0.000000 +ldebr 7e-06 -> 0.000007 +ldebr nan -> nan +ldebr inf -> inf +ldebr -inf -> -inf +LOAD LENGTHENED short BFP -> extended BFP +lxebr 101.5 -> 101.500000 +lxebr -11.1 -> -11.100000 +lxebr 0 -> 0.000000 +lxebr 7e-06 -> 0.000007 +lxebr nan -> nan +lxebr inf -> inf +lxebr -inf -> -inf +LOAD LENGTHENED long BFP -> extended BFP +lxdbr 101.5 -> 101.500000 +lxdbr -11.1 -> -11.100000 +lxdbr 0 -> 0.000000 +lxdbr 7e-16 -> 7e-16 +lxdbr nan -> nan +lxdbr inf -> inf +lxdbr -inf -> -inf + +LOAD ZERO +lzer gpr value = 0 +lzdr gpr value = 0 +lzdr gpr values = 0 0 |
|
From: Florian K. <fk...@so...> - 2025-09-22 20:37:35
|
https://sourceware.org/cgit/valgrind/commit/?id=73ece460ef7e891b404576fd7cc8bd92f4f753ed commit 73ece460ef7e891b404576fd7cc8bd92f4f753ed Author: Florian Krohm <fl...@ei...> Date: Mon Sep 22 20:36:45 2025 +0000 s390: BFP testsuite: comparison ops Rename bfp-4.c --> bfp-compare.c. Add more testcases including NANs. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 2 +- none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/bfp-4.stdout.exp | 80 ------- none/tests/s390x/bfp-4.vgtest | 1 - none/tests/s390x/{bfp-4.c => bfp-compare.c} | 35 +++- .../{bfp-4.stderr.exp => bfp-compare.stderr.exp} | 0 none/tests/s390x/bfp-compare.stdout.exp | 230 +++++++++++++++++++++ none/tests/s390x/bfp-compare.vgtest | 1 + 8 files changed, 260 insertions(+), 91 deletions(-) diff --git a/.gitignore b/.gitignore index fb3c9cc43b..efdfea78aa 100644 --- a/.gitignore +++ b/.gitignore @@ -2191,7 +2191,7 @@ /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-2 /none/tests/s390x/bfp-3 -/none/tests/s390x/bfp-4 +/none/tests/s390x/bfp-compare /none/tests/s390x/srnm /none/tests/s390x/srnmb /none/tests/s390x/comp-1 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 234ed656ea..89bba9ec8a 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -10,7 +10,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ bfp-tdc rounding-1 rounding-2 rounding-3 bfp-arith \ - bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ + bfp-2 bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ diff --git a/none/tests/s390x/bfp-4.stdout.exp b/none/tests/s390x/bfp-4.stdout.exp deleted file mode 100644 index bc81ea6cec..0000000000 --- a/none/tests/s390x/bfp-4.stdout.exp +++ /dev/null @@ -1,80 +0,0 @@ -cebr: 3.14 == 3.14 -ceb: 3.14 == 3.14 -kebr: 3.14 == 3.14 -keb: 3.14 == 3.14 -cdbr: 3.14 == 3.14 -cdb: 3.14 == 3.14 -kdbr: 3.14 == 3.14 -kdb: 3.14 == 3.14 -cxbr: 3.14 == 3.14 -kxbr: 3.14 == 3.14 -cebr: -2.78 < 2.78 -ceb: -2.78 < 2.78 -kebr: -2.78 < 2.78 -keb: -2.78 < 2.78 -cdbr: -2.78 < 2.78 -cdb: -2.78 < 2.78 -kdbr: -2.78 < 2.78 -kdb: -2.78 < 2.78 -cxbr: -2.78 < 2.78 -kxbr: -2.78 < 2.78 -cebr: inf == inf -ceb: inf == inf -kebr: inf == inf -keb: inf == inf -cdbr: inf == inf -cdb: inf == inf -kdbr: inf == inf -kdb: inf == inf -cxbr: inf == inf -kxbr: inf == inf -cebr: inf > -inf -ceb: inf > -inf -kebr: inf > -inf -keb: inf > -inf -cdbr: inf > -inf -cdb: inf > -inf -kdbr: inf > -inf -kdb: inf > -inf -cxbr: inf > -inf -kxbr: inf > -inf -cebr: -inf == -inf -ceb: -inf == -inf -kebr: -inf == -inf -keb: -inf == -inf -cdbr: -inf == -inf -cdb: -inf == -inf -kdbr: -inf == -inf -kdb: -inf == -inf -cxbr: -inf == -inf -kxbr: -inf == -inf -cebr: inf > 1 -ceb: inf > 1 -kebr: inf > 1 -keb: inf > 1 -cdbr: inf > 1 -cdb: inf > 1 -kdbr: inf > 1 -kdb: inf > 1 -cxbr: inf > 1 -kxbr: inf > 1 -cebr: -inf < -1 -ceb: -inf < -1 -kebr: -inf < -1 -keb: -inf < -1 -cdbr: -inf < -1 -cdb: -inf < -1 -kdbr: -inf < -1 -kdb: -inf < -1 -cxbr: -inf < -1 -kxbr: -inf < -1 -cebr: 0 == -0 -ceb: 0 == -0 -kebr: 0 == -0 -keb: 0 == -0 -cdbr: 0 == -0 -cdb: 0 == -0 -kdbr: 0 == -0 -kdb: 0 == -0 -cxbr: 0 == -0 -kxbr: 0 == -0 diff --git a/none/tests/s390x/bfp-4.vgtest b/none/tests/s390x/bfp-4.vgtest deleted file mode 100644 index b800aa313f..0000000000 --- a/none/tests/s390x/bfp-4.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-4 diff --git a/none/tests/s390x/bfp-4.c b/none/tests/s390x/bfp-compare.c similarity index 72% rename from none/tests/s390x/bfp-4.c rename to none/tests/s390x/bfp-compare.c index 02315b6f9d..35d5018b69 100644 --- a/none/tests/s390x/bfp-4.c +++ b/none/tests/s390x/bfp-compare.c @@ -1,4 +1,8 @@ +// FIXME rename bfp-compare.c + #include <stdio.h> +#include <math.h> +#include <assert.h> static const char *const cmp_result_str[] = { "==", "<", ">", "??" @@ -86,16 +90,31 @@ static void do_compare(float a, float b) int main(void) { - float inf = 1.f / 0.; - float neg_inf = -1.f / 0.; + assert(sizeof(long double) == 16); do_compare(3.14f, 3.14f); do_compare(-2.78f, 2.78f); - do_compare(inf, inf); - do_compare(inf, neg_inf); - do_compare(neg_inf, neg_inf); - do_compare(inf, 1.f); - do_compare(neg_inf, -1.f); - do_compare(1.f / inf, -1.f / inf); + do_compare( INFINITY, INFINITY); + do_compare( INFINITY, -INFINITY); + do_compare(-INFINITY, -INFINITY); + do_compare(-INFINITY, INFINITY); + do_compare( INFINITY, 1.f); + do_compare(-INFINITY, -1.f); + do_compare( 1.f, INFINITY); + do_compare(-1.f, -INFINITY); + + do_compare( NAN, NAN); + do_compare( NAN, -NAN); + do_compare(-NAN, NAN); + do_compare(-NAN, -NAN); + do_compare( NAN, INFINITY); + do_compare( NAN, -INFINITY); + do_compare(-NAN, INFINITY); + do_compare(-NAN, -INFINITY); + do_compare( NAN, 1.5); + do_compare(-NAN, -1.5); + do_compare( 1.5, NAN); + do_compare(-1.5, -NAN); + do_compare(1.f / INFINITY, -1.f / INFINITY); return 0; } diff --git a/none/tests/s390x/bfp-4.stderr.exp b/none/tests/s390x/bfp-compare.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-4.stderr.exp rename to none/tests/s390x/bfp-compare.stderr.exp diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp new file mode 100644 index 0000000000..b81f3f6e24 --- /dev/null +++ b/none/tests/s390x/bfp-compare.stdout.exp @@ -0,0 +1,230 @@ +cebr: 3.14 == 3.14 +ceb: 3.14 == 3.14 +kebr: 3.14 == 3.14 +keb: 3.14 == 3.14 +cdbr: 3.14 == 3.14 +cdb: 3.14 == 3.14 +kdbr: 3.14 == 3.14 +kdb: 3.14 == 3.14 +cxbr: 3.14 == 3.14 +kxbr: 3.14 == 3.14 +cebr: -2.78 < 2.78 +ceb: -2.78 < 2.78 +kebr: -2.78 < 2.78 +keb: -2.78 < 2.78 +cdbr: -2.78 < 2.78 +cdb: -2.78 < 2.78 +kdbr: -2.78 < 2.78 +kdb: -2.78 < 2.78 +cxbr: -2.78 < 2.78 +kxbr: -2.78 < 2.78 +cebr: inf == inf +ceb: inf == inf +kebr: inf == inf +keb: inf == inf +cdbr: inf == inf +cdb: inf == inf +kdbr: inf == inf +kdb: inf == inf +cxbr: inf == inf +kxbr: inf == inf +cebr: inf > -inf +ceb: inf > -inf +kebr: inf > -inf +keb: inf > -inf +cdbr: inf > -inf +cdb: inf > -inf +kdbr: inf > -inf +kdb: inf > -inf +cxbr: inf > -inf +kxbr: inf > -inf +cebr: -inf == -inf +ceb: -inf == -inf +kebr: -inf == -inf +keb: -inf == -inf +cdbr: -inf == -inf +cdb: -inf == -inf +kdbr: -inf == -inf +kdb: -inf == -inf +cxbr: -inf == -inf +kxbr: -inf == -inf +cebr: -inf < inf +ceb: -inf < inf +kebr: -inf < inf +keb: -inf < inf +cdbr: -inf < inf +cdb: -inf < inf +kdbr: -inf < inf +kdb: -inf < inf +cxbr: -inf < inf +kxbr: -inf < inf +cebr: inf > 1 +ceb: inf > 1 +kebr: inf > 1 +keb: inf > 1 +cdbr: inf > 1 +cdb: inf > 1 +kdbr: inf > 1 +kdb: inf > 1 +cxbr: inf > 1 +kxbr: inf > 1 +cebr: -inf < -1 +ceb: -inf < -1 +kebr: -inf < -1 +keb: -inf < -1 +cdbr: -inf < -1 +cdb: -inf < -1 +kdbr: -inf < -1 +kdb: -inf < -1 +cxbr: -inf < -1 +kxbr: -inf < -1 +cebr: 1 < inf +ceb: 1 < inf +kebr: 1 < inf +keb: 1 < inf +cdbr: 1 < inf +cdb: 1 < inf +kdbr: 1 < inf +kdb: 1 < inf +cxbr: 1 < inf +kxbr: 1 < inf +cebr: -1 > -inf +ceb: -1 > -inf +kebr: -1 > -inf +keb: -1 > -inf +cdbr: -1 > -inf +cdb: -1 > -inf +kdbr: -1 > -inf +kdb: -1 > -inf +cxbr: -1 > -inf +kxbr: -1 > -inf +cebr: nan ?? nan +ceb: nan ?? nan +kebr: nan ?? nan +keb: nan ?? nan +cdbr: nan ?? nan +cdb: nan ?? nan +kdbr: nan ?? nan +kdb: nan ?? nan +cxbr: nan ?? nan +kxbr: nan ?? nan +cebr: nan ?? -nan +ceb: nan ?? -nan +kebr: nan ?? -nan +keb: nan ?? -nan +cdbr: nan ?? -nan +cdb: nan ?? -nan +kdbr: nan ?? -nan +kdb: nan ?? -nan +cxbr: nan ?? -nan +kxbr: nan ?? -nan +cebr: -nan ?? nan +ceb: -nan ?? nan +kebr: -nan ?? nan +keb: -nan ?? nan +cdbr: -nan ?? nan +cdb: -nan ?? nan +kdbr: -nan ?? nan +kdb: -nan ?? nan +cxbr: -nan ?? nan +kxbr: -nan ?? nan +cebr: -nan ?? -nan +ceb: -nan ?? -nan +kebr: -nan ?? -nan +keb: -nan ?? -nan +cdbr: -nan ?? -nan +cdb: -nan ?? -nan +kdbr: -nan ?? -nan +kdb: -nan ?? -nan +cxbr: -nan ?? -nan +kxbr: -nan ?? -nan +cebr: nan ?? inf +ceb: nan ?? inf +kebr: nan ?? inf +keb: nan ?? inf +cdbr: nan ?? inf +cdb: nan ?? inf +kdbr: nan ?? inf +kdb: nan ?? inf +cxbr: nan ?? inf +kxbr: nan ?? inf +cebr: nan ?? -inf +ceb: nan ?? -inf +kebr: nan ?? -inf +keb: nan ?? -inf +cdbr: nan ?? -inf +cdb: nan ?? -inf +kdbr: nan ?? -inf +kdb: nan ?? -inf +cxbr: nan ?? -inf +kxbr: nan ?? -inf +cebr: -nan ?? inf +ceb: -nan ?? inf +kebr: -nan ?? inf +keb: -nan ?? inf +cdbr: -nan ?? inf +cdb: -nan ?? inf +kdbr: -nan ?? inf +kdb: -nan ?? inf +cxbr: -nan ?? inf +kxbr: -nan ?? inf +cebr: -nan ?? -inf +ceb: -nan ?? -inf +kebr: -nan ?? -inf +keb: -nan ?? -inf +cdbr: -nan ?? -inf +cdb: -nan ?? -inf +kdbr: -nan ?? -inf +kdb: -nan ?? -inf +cxbr: -nan ?? -inf +kxbr: -nan ?? -inf +cebr: nan ?? 1.5 +ceb: nan ?? 1.5 +kebr: nan ?? 1.5 +keb: nan ?? 1.5 +cdbr: nan ?? 1.5 +cdb: nan ?? 1.5 +kdbr: nan ?? 1.5 +kdb: nan ?? 1.5 +cxbr: nan ?? 1.5 +kxbr: nan ?? 1.5 +cebr: -nan ?? -1.5 +ceb: -nan ?? -1.5 +kebr: -nan ?? -1.5 +keb: -nan ?? -1.5 +cdbr: -nan ?? -1.5 +cdb: -nan ?? -1.5 +kdbr: -nan ?? -1.5 +kdb: -nan ?? -1.5 +cxbr: -nan ?? -1.5 +kxbr: -nan ?? -1.5 +cebr: 1.5 ?? nan +ceb: 1.5 ?? nan +kebr: 1.5 ?? nan +keb: 1.5 ?? nan +cdbr: 1.5 ?? nan +cdb: 1.5 ?? nan +kdbr: 1.5 ?? nan +kdb: 1.5 ?? nan +cxbr: 1.5 ?? nan +kxbr: 1.5 ?? nan +cebr: -1.5 ?? -nan +ceb: -1.5 ?? -nan +kebr: -1.5 ?? -nan +keb: -1.5 ?? -nan +cdbr: -1.5 ?? -nan +cdb: -1.5 ?? -nan +kdbr: -1.5 ?? -nan +kdb: -1.5 ?? -nan +cxbr: -1.5 ?? -nan +kxbr: -1.5 ?? -nan +cebr: 0 == -0 +ceb: 0 == -0 +kebr: 0 == -0 +keb: 0 == -0 +cdbr: 0 == -0 +cdb: 0 == -0 +kdbr: 0 == -0 +kdb: 0 == -0 +cxbr: 0 == -0 +kxbr: 0 == -0 diff --git a/none/tests/s390x/bfp-compare.vgtest b/none/tests/s390x/bfp-compare.vgtest new file mode 100644 index 0000000000..8bc91934ce --- /dev/null +++ b/none/tests/s390x/bfp-compare.vgtest @@ -0,0 +1 @@ +prog: bfp-compare |
|
From: Florian K. <fk...@so...> - 2025-09-22 19:33:21
|
https://sourceware.org/cgit/valgrind/commit/?id=7d9005f4912fa02eb48dcf578f40c035d8cc851b commit 7d9005f4912fa02eb48dcf578f40c035d8cc851b Author: Florian Krohm <fl...@ei...> Date: Mon Sep 22 19:31:50 2025 +0000 s390: BFP testsuite tweaks Remove square root tests as they are covered by bfp-emit.pl Likewise for multiplication. Add tests for division. New file bfp-arith.c: Check condition code of arithmetic ops. Remove bfp-1.c Part of https://bugs.kde.org/show_bug.cgi?id=509572 Diff: --- .gitignore | 2 +- none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/bfp-1.c | 93 -------------------- none/tests/s390x/bfp-1.stdout.exp | 10 --- none/tests/s390x/bfp-1.vgtest | 1 - none/tests/s390x/bfp-2.c | 21 ----- none/tests/s390x/bfp-2.stdout.exp | 2 - none/tests/s390x/bfp-3.c | 41 ++++++++- none/tests/s390x/bfp-3.stdout.exp | 3 + none/tests/s390x/bfp-arith.c | 99 ++++++++++++++++++++++ .../{bfp-1.stderr.exp => bfp-arith.stderr.exp} | 0 none/tests/s390x/bfp-arith.stdout.exp | 30 +++++++ none/tests/s390x/bfp-arith.vgtest | 1 + 13 files changed, 175 insertions(+), 130 deletions(-) diff --git a/.gitignore b/.gitignore index 00233d852f..fb3c9cc43b 100644 --- a/.gitignore +++ b/.gitignore @@ -2188,7 +2188,7 @@ /none/tests/s390x/rounding-1 /none/tests/s390x/rounding-2 /none/tests/s390x/rounding-3 -/none/tests/s390x/bfp-1 +/none/tests/s390x/bfp-arith /none/tests/s390x/bfp-2 /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-4 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 8a373c4c88..234ed656ea 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,7 +9,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc rounding-1 rounding-2 rounding-3 bfp-1 \ + bfp-tdc rounding-1 rounding-2 rounding-3 bfp-arith \ bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ diff --git a/none/tests/s390x/bfp-1.c b/none/tests/s390x/bfp-1.c deleted file mode 100644 index 2cf558e241..0000000000 --- a/none/tests/s390x/bfp-1.c +++ /dev/null @@ -1,93 +0,0 @@ -#include <stdio.h> - -/* Simple test to see that basic operators are mapped - correctly. Uses default rounding mode. */ - -volatile double d1, d2; -volatile float f1, f2; - -void fadd8(void) -{ - printf("%f + %f = %f\n", d1, d2, d1 + d2); -} - -void fsub8(void) -{ - printf("%f - %f = %f\n", d1, d2, d1 - d2); -} - -void fmul8(void) -{ - printf("%f * %f = %f\n", d1, d2, d1 * d2); -} - -void fdiv8(void) -{ - printf("%f / %f = %f\n", d1, d2, d1 / d2); -} - -void fadd4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("aebr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f + %f = %f\n", f1, f2, r1); -} - -void fsub4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("sebr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f - %f = %f\n", f1, f2, r1); -} - -void fmul4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("meebr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f * %f = %f\n", f1, f2, r1); -} - -void fdiv4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("debr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f / %f = %f\n", f1, f2, r1); -} - - -int main() -{ - printf("double arithmetic\n"); - d1 = 10.5; - d2 = 1.25; - fadd8(); - fsub8(); - fmul8(); - fdiv8(); - - printf("float arithmetic\n"); - f1 = 10.5f; - f2 = 1.25f; - fadd4(); - fsub4(); - fmul4(); - fdiv4(); - - return 0; -} diff --git a/none/tests/s390x/bfp-1.stdout.exp b/none/tests/s390x/bfp-1.stdout.exp deleted file mode 100644 index 023c598648..0000000000 --- a/none/tests/s390x/bfp-1.stdout.exp +++ /dev/null @@ -1,10 +0,0 @@ -double arithmetic -10.500000 + 1.250000 = 11.750000 -10.500000 - 1.250000 = 9.250000 -10.500000 * 1.250000 = 13.125000 -10.500000 / 1.250000 = 8.400000 -float arithmetic -10.500000 + 1.250000 = 11.750000 -10.500000 - 1.250000 = 9.250000 -10.500000 * 1.250000 = 13.125000 -10.500000 / 1.250000 = 8.400000 diff --git a/none/tests/s390x/bfp-1.vgtest b/none/tests/s390x/bfp-1.vgtest deleted file mode 100644 index 9d67c4abbf..0000000000 --- a/none/tests/s390x/bfp-1.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-1 diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c index b8109ba889..7fbc2cbf3b 100644 --- a/none/tests/s390x/bfp-2.c +++ b/none/tests/s390x/bfp-2.c @@ -1,28 +1,11 @@ #include <stdio.h> /* Test various BFP ops: - - square root - load negative - load positive - load complement */ -void sqebr(float in) -{ - float out; - - __asm__ volatile("sqebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in)); - printf("sqebr %f -> %f\n", in, out); -} - -void sqdbr(double in) -{ - double out; - - __asm__ volatile("sqdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in)); - printf("sqdbr %f -> %f\n", in, out); -} - void lnebr(float in) { float out; @@ -73,10 +56,6 @@ void lcdbr(double in) int main(void) { - // square root - sqebr(121.0f); // 4 byte values - sqdbr(144.0); // 8 bytes values - // load negative lnebr(-2.5f); // 4 byte values lnebr(12.5f); // 4 byte values diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp index 074180a279..d2bc54136b 100644 --- a/none/tests/s390x/bfp-2.stdout.exp +++ b/none/tests/s390x/bfp-2.stdout.exp @@ -1,5 +1,3 @@ -sqebr 121.000000 -> 11.000000 -sqdbr 144.000000 -> 12.000000 lnebr -2.500000 -> -2.500000 lnebr 12.500000 -> -12.500000 lndbr -0.500000 -> -0.500000 diff --git a/none/tests/s390x/bfp-3.c b/none/tests/s390x/bfp-3.c index 857e1c83ff..d7d66f2632 100644 --- a/none/tests/s390x/bfp-3.c +++ b/none/tests/s390x/bfp-3.c @@ -1,7 +1,9 @@ #include <stdio.h> +#include <assert.h> /* Test BFP multiply and add/sub 32/64-bit. There are no such insns - working with 128-bit data */ + working with 128-bit data. + Also test division making sure operand order is preserved. */ void maebr(float v1, float v2, float v3) { @@ -39,8 +41,40 @@ void msdbr(double v1, double v2, double v3) printf("msdbr %f * %f - %f -> %f\n", v2, v3, v1, r1); } +static void debr(float v1, float v2) +{ + float r1 = v1; + + __asm__ volatile("debr %[r1],%[r2]" + : [r1]"+f"(v1) + : [r2]"f"(v2)); + printf("debr %f / %f -> %f\n", r1, v2, v1); +} + +static void ddbr(double v1, double v2) +{ + double r1 = v1; + + __asm__ volatile("ddbr %[r1],%[r2]" + : [r1]"+f"(v1) + : [r2]"f"(v2)); + printf("ddbr %f / %f -> %f\n", r1, v2, v1); +} + +static void dxbr(long double v1, long double v2) +{ + long double r1 = v1; + + __asm__ volatile("dxbr %[r1],%[r2]" + : [r1]"+f"(v1) + : [r2]"f"(v2)); + printf("dxbr %Lf / %Lf -> %Lf\n", r1, v2, v1); +} + int main(void) { + assert(sizeof(long double) == 16); + // multiply and add maebr(10.5f, 20.25, 3.0); // 4 byte values madbr(-10.5, 42.75, -2.0); // 8 byte values @@ -49,5 +83,10 @@ int main(void) msebr(10.5f, 20.25, 3.0); // 4 byte values msdbr(-10.5, 42.75, -2.0); // 8 byte values + /* Just checking that the operand order is not mixed up. */ + debr(10.0f, 2.0f); + ddbr(10.0, 2.0); + dxbr(10.0L, 2.0L); + return 0; } diff --git a/none/tests/s390x/bfp-3.stdout.exp b/none/tests/s390x/bfp-3.stdout.exp index bd9e5c49c3..b1eb0a72e8 100644 --- a/none/tests/s390x/bfp-3.stdout.exp +++ b/none/tests/s390x/bfp-3.stdout.exp @@ -2,3 +2,6 @@ maebr 20.250000 * 3.000000 + 10.500000 -> 71.250000 madbr 42.750000 * -2.000000 + -10.500000 -> -96.000000 msebr 20.250000 * 3.000000 - 10.500000 -> 50.250000 msdbr 42.750000 * -2.000000 - -10.500000 -> -75.000000 +debr 10.000000 / 2.000000 -> 5.000000 +ddbr 10.000000 / 2.000000 -> 5.000000 +dxbr 10.000000 / 2.000000 -> 5.000000 diff --git a/none/tests/s390x/bfp-arith.c b/none/tests/s390x/bfp-arith.c new file mode 100644 index 0000000000..e69b7cf027 --- /dev/null +++ b/none/tests/s390x/bfp-arith.c @@ -0,0 +1,99 @@ +#include <stdio.h> +#include <math.h> +#include <assert.h> + +/* Making sure that the condition code of arithmetic BFP ops is + set correctly. + + Multiply and square root are covered by bfp-emit.pl +*/ + +volatile int cc; + +#define TEST_INSN(insn, fmt, opnd1, opnd2) \ + do { \ + __typeof__(opnd1) v1 = opnd1; \ + __typeof__(opnd2) v2 = opnd2; \ + __asm__ volatile(insn " %[r1],%[r2]\n\t" \ + "ipm %[psw]\n\t" \ + "srl %[psw],28\n\t" \ + : [psw]"=d"(cc) \ + : [r1]"f"(v1), [r2]"f"(v2) \ + : "cc"); \ + printf("%s r1 = "fmt" r2 = "fmt" --> cc = %d\n", \ + insn, opnd1, opnd2, cc); \ + } while (0) + + +static void aebr(float r1, float r2) +{ + TEST_INSN("aebr", "%g", r1, r2); +} + +static void adbr(double r1, double r2) +{ + TEST_INSN("adbr", "%g", r1, r2); +} + +static void axbr(long double r1, long double r2) +{ + TEST_INSN("axbr", "%Lg", r1, r2); +} + +static void sebr(float r1, float r2) +{ + TEST_INSN("sebr", "%g", r1, r2); +} + +static void sdbr(double r1, double r2) +{ + TEST_INSN("sdbr", "%g", r1, r2); +} + +static void sxbr(long double r1, long double r2) +{ + TEST_INSN("sxbr", "%Lg", r1, r2); +} + +int main() +{ + assert(sizeof(long double) == 16); // ensure 128 bit wide + + printf("32-bit ADD\n"); + aebr(2.5f, -2.5f); + aebr(4.75f, -6.25f); + aebr(-2.5f, 8.5f); + aebr(NAN, 0); + + printf("64-bit ADD\n"); + adbr(2.5, -2.5); + adbr(4.75, -6.25); + adbr(-2.5, 8.5); + adbr(NAN, 0); + + printf("128-bit ADD\n"); + axbr(2.5L, -2.5L); + axbr(4.75L, -6.25L); + axbr(-2.5L, 8.5L); + axbr(NAN, 0); + + printf("32-bit SUBTRACT\n"); + sebr(2.5f, 2.5f); + sebr(4.75f, 6.25f); + sebr(8.5f, 2.5f); + sebr(NAN, 0); + + printf("64-bit SUBTRACT\n"); + sdbr(2.5, 2.5); + sdbr(4.75, 6.25); + sdbr(8.5, 2.5f); + sdbr(NAN, 0); + + printf("128-bit SUBTRACT\n"); + sxbr(2.5f, 2.5); + sxbr(4.75f, 6.25); + sxbr(8.5f, 2.5); + sxbr(NAN, 0); + + return 0; +} diff --git a/none/tests/s390x/bfp-1.stderr.exp b/none/tests/s390x/bfp-arith.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-1.stderr.exp rename to none/tests/s390x/bfp-arith.stderr.exp diff --git a/none/tests/s390x/bfp-arith.stdout.exp b/none/tests/s390x/bfp-arith.stdout.exp new file mode 100644 index 0000000000..237b5b3c82 --- /dev/null +++ b/none/tests/s390x/bfp-arith.stdout.exp @@ -0,0 +1,30 @@ +32-bit ADD +aebr r1 = 2.5 r2 = -2.5 --> cc = 0 +aebr r1 = 4.75 r2 = -6.25 --> cc = 1 +aebr r1 = -2.5 r2 = 8.5 --> cc = 2 +aebr r1 = nan r2 = 0 --> cc = 3 +64-bit ADD +adbr r1 = 2.5 r2 = -2.5 --> cc = 0 +adbr r1 = 4.75 r2 = -6.25 --> cc = 1 +adbr r1 = -2.5 r2 = 8.5 --> cc = 2 +adbr r1 = nan r2 = 0 --> cc = 3 +128-bit ADD +axbr r1 = 2.5 r2 = -2.5 --> cc = 0 +axbr r1 = 4.75 r2 = -6.25 --> cc = 1 +axbr r1 = -2.5 r2 = 8.5 --> cc = 2 +axbr r1 = nan r2 = 0 --> cc = 3 +32-bit SUBTRACT +sebr r1 = 2.5 r2 = 2.5 --> cc = 0 +sebr r1 = 4.75 r2 = 6.25 --> cc = 1 +sebr r1 = 8.5 r2 = 2.5 --> cc = 2 +sebr r1 = nan r2 = 0 --> cc = 3 +64-bit SUBTRACT +sdbr r1 = 2.5 r2 = 2.5 --> cc = 0 +sdbr r1 = 4.75 r2 = 6.25 --> cc = 1 +sdbr r1 = 8.5 r2 = 2.5 --> cc = 2 +sdbr r1 = nan r2 = 0 --> cc = 3 +128-bit SUBTRACT +sxbr r1 = 2.5 r2 = 2.5 --> cc = 0 +sxbr r1 = 4.75 r2 = 6.25 --> cc = 1 +sxbr r1 = 8.5 r2 = 2.5 --> cc = 2 +sxbr r1 = nan r2 = 0 --> cc = 3 diff --git a/none/tests/s390x/bfp-arith.vgtest b/none/tests/s390x/bfp-arith.vgtest new file mode 100644 index 0000000000..19b58a066f --- /dev/null +++ b/none/tests/s390x/bfp-arith.vgtest @@ -0,0 +1 @@ +prog: bfp-arith |
|
From: Paul F. <pa...@so...> - 2025-09-22 18:22:41
|
https://sourceware.org/cgit/valgrind/commit/?id=d0bfd2556ce498cb091299249cb6804cbff57e81 commit d0bfd2556ce498cb091299249cb6804cbff57e81 Author: Paul Floyd <pj...@wa...> Date: Mon Sep 22 20:21:57 2025 +0200 FreeBSD regtest: add an x86 version of scalar_arg_check Diff: --- .gitignore | 1 + memcheck/tests/x86-freebsd/Makefile.am | 8 +++++--- memcheck/tests/x86-freebsd/filter_arg_check | 20 ++++++++++++++++++++ memcheck/tests/x86-freebsd/scalar_arg_check.c | 8 ++++++++ .../tests/x86-freebsd/scalar_arg_check.stderr.exp | 1 + memcheck/tests/x86-freebsd/scalar_arg_check.vgtest | 1 + 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6cf083afe2..00233d852f 100644 --- a/.gitignore +++ b/.gitignore @@ -1505,6 +1505,7 @@ /memcheck/tests/x86-freebsd/posix_fadvise /memcheck/tests/x86-freebsd/posix_fallocate /memcheck/tests/x86-freebsd/reallocarray +/memcheck/tests/x86-freebsd/scalar_arg_check # /memcheck/tests/arm64-freebsd /memcheck/tests/arm64-freebsd/*.stderr.diff diff --git a/memcheck/tests/x86-freebsd/Makefile.am b/memcheck/tests/x86-freebsd/Makefile.am index 1d8069021b..8c48506c2b 100644 --- a/memcheck/tests/x86-freebsd/Makefile.am +++ b/memcheck/tests/x86-freebsd/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr +dist_noinst_SCRIPTS = filter_stderr filter_arg_check EXTRA_DIST = \ posix_fadvise.vgtest \ @@ -9,10 +9,12 @@ EXTRA_DIST = \ posix_fadvise.stderr.exp \ posix_fallocate.stderr.exp \ reallocarray.vgtest \ - reallocarray.stderr.exp + reallocarray.stderr.exp \ + scalar_arg_check.vgtest \ + scalar_arg_check.stderr.exp check_PROGRAMS = \ - posix_fadvise posix_fallocate reallocarray + posix_fadvise posix_fallocate reallocarray scalar_arg_check # Linux also adds $(FLAG_MMMX) $(FLAG_MSSE) to the first two AM_CFLAGS += @FLAG_M32@ diff --git a/memcheck/tests/x86-freebsd/filter_arg_check b/memcheck/tests/x86-freebsd/filter_arg_check new file mode 100755 index 0000000000..302dea2dfe --- /dev/null +++ b/memcheck/tests/x86-freebsd/filter_arg_check @@ -0,0 +1,20 @@ +#! /bin/sh + +# Only one test uses this which calls syscall(SYS_sendfile) +# which is the only x86 syscall that uses 8 arguments +# The output includes --trace-syscalls=yes which is very verbose +# but we only want to see the sendfile line + +# the libc signature for sendfile is +# int sendfile(int fd, int s, off_t offset, size_t nbytes, +# struct sf_hdtr *hdtr, off_t *sbytes, int flags); +# The testcase uses values from 101 to 108 for the arguments +# (to make it easy to match the testcase to the log output) +# Some of the arguments are printed as hex, not too bad. +# Argument 3 is a 64bit value made up from the 32bit arguments +# 3 and 4 resulting in 7 values in the expected. + +grep "SYSCALL.*sendfile" | +sed 's/==.*//' | +sed -E 's/\[[0-9]{5}/[xxxxx/' + diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.c b/memcheck/tests/x86-freebsd/scalar_arg_check.c new file mode 100644 index 0000000000..c608150f2d --- /dev/null +++ b/memcheck/tests/x86-freebsd/scalar_arg_check.c @@ -0,0 +1,8 @@ +#include "../freebsd/scalar.h" + +int main(void) +{ + /* sendfile uses 8 args */ + SY(SYS_sendfile, 101, 102, 103, 104, 105, 106, 107, 108); +} + diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp new file mode 100644 index 0000000000..354d16821d --- /dev/null +++ b/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp @@ -0,0 +1 @@ +SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 446676598887, 105, 0x6a, 0x6b, 108 ) diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest b/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest new file mode 120000 index 0000000000..5b2d7ffafc --- /dev/null +++ b/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest @@ -0,0 +1 @@ +../amd64-freebsd/scalar_arg_check.vgtest \ No newline at end of file |
|
From: Paul F. <pa...@so...> - 2025-09-22 17:51:55
|
https://sourceware.org/cgit/valgrind/commit/?id=0c0e1a0b0a77a399ff220b60c3d46dc779dd9d09 commit 0c0e1a0b0a77a399ff220b60c3d46dc779dd9d09 Author: Paul Floyd <pj...@wa...> Date: Mon Sep 22 19:49:52 2025 +0200 DRD suppression: broaden drd-glibc-io-xsputn-mempcpy Add wildcards to cover variations of mem[p]cpy. This is now the same as Helgrind. Diff: --- glibc-2.X-drd.supp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in index a75b4421fe..419ff2256c 100644 --- a/glibc-2.X-drd.supp.in +++ b/glibc-2.X-drd.supp.in @@ -40,7 +40,7 @@ { drd-glibc-io-xsputn-mempcpy drd:ConflictingAccess - fun:__GI_mempcpy + fun:*mem*cpy fun:_IO_*xsputn* obj:@GLIBC_LIBC_PATH@ } |