From: Andreas Arnez Date: Wed, 2 Apr 2025 17:52:26 +0000 (+0200) Subject: Bug 502324 - Add test case for TMx memcheck false positives X-Git-Tag: VALGRIND_3_25_0~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d5cd244c7a81931ee17c3a7d46691774847222b;p=thirdparty%2Fvalgrind.git Bug 502324 - Add test case for TMx memcheck false positives Add a regression test for Bug 502324. Before the bug was fixed, this test failed with various "conditional jump or move depends on uninitialised value(s)" messages. --- diff --git a/.gitignore b/.gitignore index f9e50b1357..f58e91dd83 100644 --- a/.gitignore +++ b/.gitignore @@ -1266,6 +1266,7 @@ /memcheck/tests/s390x/cu21 /memcheck/tests/s390x/cu42 /memcheck/tests/s390x/ltgjhe +/memcheck/tests/s390x/tmxx /memcheck/tests/s390x/vstrc /memcheck/tests/s390x/vfae /memcheck/tests/s390x/vistr diff --git a/NEWS b/NEWS index 7f1d4246c3..ee501aef69 100644 --- a/NEWS +++ b/NEWS @@ -73,6 +73,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? 502126 glibc 2.41 extra syscall_cancel frames 502288 s390x: Memcheck false positives with NNPA last tensor dimension +502324 s390x: Memcheck false positives with TMxx and TM/TMY To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/s390x/Makefile.am b/memcheck/tests/s390x/Makefile.am index 095c07c7f3..32a898ca5f 100644 --- a/memcheck/tests/s390x/Makefile.am +++ b/memcheck/tests/s390x/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr -INSN_TESTS = cdsg cli cu21 cu42 ltgjhe vstrc vfae vistr vstrs +INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs check_PROGRAMS = $(INSN_TESTS) diff --git a/memcheck/tests/s390x/tmxx.c b/memcheck/tests/s390x/tmxx.c new file mode 100644 index 0000000000..ed4447f08f --- /dev/null +++ b/memcheck/tests/s390x/tmxx.c @@ -0,0 +1,50 @@ +#include + +union foo { + char a; + unsigned long val; +}; + +static int do_tmhh(unsigned long val, int eq, int neq) +{ + int ret = eq; + int alt = neq; + __asm__("tmhh %[val],0xf000\n\t" + "jo 1f\n\t" + "nopr 0\n" + "1:\t" + "locgrne %[ret],%[alt]" + : [ret] "+d"(ret) + : [val] "d"(val), [alt] "d"(alt) + : "cc"); + return ret; +} + +static int do_tm(unsigned char val, int eq, int neq) +{ + int ret = eq; + int alt = neq; + __asm__("tm %[val],0xf0\n\t" + "jo 1f\n\t" + "nopr 0\n" + "1:\t" + "locgrne %[ret],%[alt]" + : [ret] "+d"(ret) + : [val] "Q"(val), [alt] "d"(alt) + : "cc"); + return ret; +} + +int main(void) +{ + volatile union foo a; + a.a = 0x40; + printf("%c\n", do_tmhh(a.val, 'A', 'B')); + a.val = a.val << 1; + printf("%c\n", do_tmhh(a.val, 'C', 'D')); + printf("%c\n", do_tm(a.a, 'E', 'F')); + a.val = a.val << 1; + printf("%c\n", do_tmhh(a.val, 'G', 'H')); + printf("%c\n", do_tm(a.a, 'I', 'J')); + return 0; +} diff --git a/memcheck/tests/s390x/tmxx.stderr.exp b/memcheck/tests/s390x/tmxx.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/s390x/tmxx.stdout.exp b/memcheck/tests/s390x/tmxx.stdout.exp new file mode 100644 index 0000000000..af2c2d5543 --- /dev/null +++ b/memcheck/tests/s390x/tmxx.stdout.exp @@ -0,0 +1,5 @@ +B +D +F +G +I diff --git a/memcheck/tests/s390x/tmxx.vgtest b/memcheck/tests/s390x/tmxx.vgtest new file mode 100644 index 0000000000..650afd4375 --- /dev/null +++ b/memcheck/tests/s390x/tmxx.vgtest @@ -0,0 +1,2 @@ +prog: tmxx +vgopts: -q