Signed-off-by: Taylor Simpson <[email protected]>
---
tests/tcg/hexagon/multiple-writes.c | 46 +++++++++++++++++++++++++++++
tests/tcg/hexagon/meson.build | 2 +-
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/tests/tcg/hexagon/multiple-writes.c
b/tests/tcg/hexagon/multiple-writes.c
index 4305903547..b93f2ab32e 100644
--- a/tests/tcg/hexagon/multiple-writes.c
+++ b/tests/tcg/hexagon/multiple-writes.c
@@ -199,6 +199,49 @@ static int test_post_increment3(void)
return sig;
}
+static int test_vreg_legal_predicated(void)
+{
+ int sig;
+
+ asm volatile(
+ "r0 = #0\n"
+ "r1 = ##1f\n"
+ "memw(%1) = r1\n"
+ "r2 = #7\n"
+ "r3 = #13\n"
+ "p0 = cmp.eq(r2, r3)\n"
+ "{\n"
+ " if (p0) v0 = v1\n"
+ " if (!p0) v0 = v2\n"
+ "}\n"
+ "1:\n"
+ "%0 = #23\n"
+ : "=r"(sig)
+ : "r"(&resume_pc)
+ : "r0", "r1", "r2", "r3", "p0", "v0", "v1", "memory");
+
+ return sig;
+}
+
+static int test_vreg_illegal(void)
+{
+ int sig;
+
+ asm volatile(
+ "r0 = #0\n"
+ "r1 = ##1f\n"
+ "memw(%1) = r1\n"
+ ".word 0x1e0361e0 /* { v0 = v1 */\n"
+ ".word 0x1e03e2e0 /* v0 = v2 } */\n"
+ "1:\n"
+ "%0 = r0\n"
+ : "=r"(sig)
+ : "r"(&resume_pc)
+ : "r0", "r1", "memory");
+
+ return sig;
+}
+
int main()
{
struct sigaction act;
@@ -224,6 +267,9 @@ int main()
assert(test_post_increment2() == SIGILL);
assert(test_post_increment3() == SIGILL);
+ assert(test_vreg_legal_predicated() == 23);
+ assert(test_vreg_illegal() == SIGILL);
+
puts("PASS");
return EXIT_SUCCESS;
}
diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build
index 4a2826c427..08c6e34c20 100644
--- a/tests/tcg/hexagon/meson.build
+++ b/tests/tcg/hexagon/meson.build
@@ -54,7 +54,7 @@ tests += {
'load_unpack.c': {'cflags': cflags},
# Build this test with -mv71 to exercise the CABAC instruction
'misc.c': {'cflags': [cflags, '-mv71', '-O2']},
- 'multiple-writes.c': {'cflags': cflags},
+ 'multiple-writes.c': {'cflags': [cflags, '-mhvx']},
'overflow.c': {'cflags': cflags, 'exe_name': 'hex-overflow'},
'preg_alias.c': {'cflags': cflags},
'dual_stores.c': {'cflags': cflags},
--
2.43.0