aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTaylor Simpson <tsimpson@quicinc.com>2022-02-09 18:15:52 -0800
committerTaylor Simpson <tsimpson@quicinc.com>2022-03-12 09:14:22 -0800
commit8576e7ecae056845de6e0bafc547501f2bc6461c (patch)
tree62f986a080171f1205d7ecd19f4e0f6c6fd6e036 /tests
parent2479540fff4aa4519ff45e122be360492f970598 (diff)
downloadqemu-8576e7ecae056845de6e0bafc547501f2bc6461c.zip
qemu-8576e7ecae056845de6e0bafc547501f2bc6461c.tar.gz
qemu-8576e7ecae056845de6e0bafc547501f2bc6461c.tar.bz2
Hexagon (tests/tcg/hexagon) update overflow test
Add a test that sets USR multiple times in a packet Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20220210021556.9217-9-tsimpson@quicinc.com> Acked-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/tcg/hexagon/overflow.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/tests/tcg/hexagon/overflow.c b/tests/tcg/hexagon/overflow.c
index 196fcf7..9408785 100644
--- a/tests/tcg/hexagon/overflow.c
+++ b/tests/tcg/hexagon/overflow.c
@@ -1,5 +1,5 @@
/*
- * Copyright(c) 2021 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ * Copyright(c) 2021-2022 Qualcomm Innovation Center, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,6 +72,20 @@ int read_usr_overflow(void)
return result & 1;
}
+int get_usr_overflow(int usr)
+{
+ return usr & 1;
+}
+
+int get_usr_fp_invalid(int usr)
+{
+ return (usr >> 1) & 1;
+}
+
+int get_usr_lpcfg(int usr)
+{
+ return (usr >> 8) & 0x3;
+}
jmp_buf jmp_env;
int usr_overflow;
@@ -82,6 +96,49 @@ static void sig_segv(int sig, siginfo_t *info, void *puc)
longjmp(jmp_env, 1);
}
+static void test_packet(void)
+{
+ int convres;
+ int satres;
+ int usr;
+
+ asm("r2 = usr\n\t"
+ "r2 = clrbit(r2, #0)\n\t" /* clear overflow bit */
+ "r2 = clrbit(r2, #1)\n\t" /* clear FP invalid bit */
+ "usr = r2\n\t"
+ "{\n\t"
+ " %0 = convert_sf2uw(%3):chop\n\t"
+ " %1 = satb(%4)\n\t"
+ "}\n\t"
+ "%2 = usr\n\t"
+ : "=r"(convres), "=r"(satres), "=r"(usr)
+ : "r"(0x6a051b86), "r"(0x0410eec0)
+ : "r2", "usr");
+
+ check(convres, 0xffffffff);
+ check(satres, 0x7f);
+ check(get_usr_overflow(usr), 1);
+ check(get_usr_fp_invalid(usr), 1);
+
+ asm("r2 = usr\n\t"
+ "r2 = clrbit(r2, #0)\n\t" /* clear overflow bit */
+ "usr = r2\n\t"
+ "%2 = r2\n\t"
+ "p3 = sp3loop0(1f, #1)\n\t"
+ "1:\n\t"
+ "{\n\t"
+ " %0 = satb(%2)\n\t"
+ "}:endloop0\n\t"
+ "%1 = usr\n\t"
+ : "=r"(satres), "=r"(usr)
+ : "r"(0x0410eec0)
+ : "r2", "usr", "p3", "sa0", "lc0");
+
+ check(satres, 0x7f);
+ check(get_usr_overflow(usr), 1);
+ check(get_usr_lpcfg(usr), 2);
+}
+
int main()
{
struct sigaction act;
@@ -102,6 +159,8 @@ int main()
check(usr_overflow, 0);
+ test_packet();
+
puts(err ? "FAIL" : "PASS");
return err ? EXIT_FAILURE : EXIT_SUCCESS;
}