valgrind/valgrind-3.21.0-vgm-tests.p...

106 lines
3.7 KiB
Diff

From 21f7a2af2805a02a144c81f12895c134f4a171a3 Mon Sep 17 00:00:00 2001
From: Andreas Arnez <arnez@linux.ibm.com>
Date: Mon, 22 May 2023 19:49:08 +0200
Subject: [PATCH 2/2] Bug 470132 - s390x: Increase test coverage for VGM
Add more tests for the VGM instruction, to verify the fix for the VGM
wrap-around case. Also test setting unused bits in the I2 and I3 fields,
to check that Valgrind ignores them as it should.
---
none/tests/s390x/vec2.c | 44 ++++++++++++++++++++++++++++++++
none/tests/s390x/vec2.stdout.exp | 20 +++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/none/tests/s390x/vec2.c b/none/tests/s390x/vec2.c
index 73b04dee4..c473a2a9a 100644
--- a/none/tests/s390x/vec2.c
+++ b/none/tests/s390x/vec2.c
@@ -301,6 +301,49 @@ static void test_all_fp_int_conversions()
#undef TEST_EXEC
#undef TEST_GENERATE
+/* -- Vector generate mask -- */
+
+#define TEST_GENERATE(insn, i2, i3, m4) \
+ static void test_vgm_##i2##_##i3##_##m4(void) \
+ { \
+ ulong_v out = vec_ini; \
+ __asm__("vgm %[out]," #i2 "," #i3 "," #m4 : [out] "+v"(out) : :); \
+ printf("\t%016lx %016lx\n", out[0], out[1]); \
+ }
+
+#define TEST_EXEC(insn, i2, i3, m4) \
+ do { \
+ puts(#insn " " #i2 "," #i3 "," #m4); \
+ test_vgm_##i2##_##i3##_##m4(); \
+ } while (0)
+
+#define INSNS \
+ XTEST(vgmb, 2, 1, 0); \
+ XTEST(vgmb, 0xf7, 0x30, 0); \
+ XTEST(vgmb, 0, 0, 0); \
+ XTEST(vgmh, 3, 2, 1); \
+ XTEST(vgmh, 15, 15, 1); \
+ XTEST(vgmf, 4, 3, 2); \
+ XTEST(vgmf, 16, 17, 2); \
+ XTEST(vgmg, 55, 63, 3); \
+ XTEST(vgmg, 43, 55, 3); \
+ XTEST(vgmg, 63, 2, 3);
+
+#define XTEST TEST_GENERATE
+INSNS
+#undef XTEST
+
+static void test_all_generate_mask()
+{
+#define XTEST TEST_EXEC
+ INSNS
+#undef XTEST
+}
+
+#undef INSNS
+#undef TEST_EXEC
+#undef TEST_GENERATE
+
int main()
{
@@ -310,5 +353,6 @@ int main()
test_all_double_bitshifts();
test_all_int_fp_conversions();
test_all_fp_int_conversions();
+ test_all_generate_mask();
return 0;
}
diff --git a/none/tests/s390x/vec2.stdout.exp b/none/tests/s390x/vec2.stdout.exp
index b32cbe1bc..2c9ac21c1 100644
--- a/none/tests/s390x/vec2.stdout.exp
+++ b/none/tests/s390x/vec2.stdout.exp
@@ -166,3 +166,23 @@ vcsfp 0
vcsfp 8
00ffffff - - -
00000004 - - -
+vgmb 2,1,0
+ ffffffffffffffff ffffffffffffffff
+vgmb 0xf7,0x30,0
+ 8181818181818181 8181818181818181
+vgmb 0,0,0
+ 8080808080808080 8080808080808080
+vgmh 3,2,1
+ ffffffffffffffff ffffffffffffffff
+vgmh 15,15,1
+ 0001000100010001 0001000100010001
+vgmf 4,3,2
+ ffffffffffffffff ffffffffffffffff
+vgmf 16,17,2
+ 0000c0000000c000 0000c0000000c000
+vgmg 55,63,3
+ 00000000000001ff 00000000000001ff
+vgmg 43,55,3
+ 00000000001fff00 00000000001fff00
+vgmg 63,2,3
+ e000000000000001 e000000000000001
--
2.40.1