From: Taylor Simpson <tsimpson@quicinc.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, tsimpson@quicinc.com,
richard.henderson@linaro.org, f4bug@amsat.org,
zongyuan.li@smartx.com
Subject: [PULL v2 08/12] Hexagon (tests/tcg/hexagon) update overflow test
Date: Sat, 12 Mar 2022 12:13:15 -0800 [thread overview]
Message-ID: <20220312201319.29040-9-tsimpson@quicinc.com> (raw)
In-Reply-To: <20220312201319.29040-1-tsimpson@quicinc.com>
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>
---
tests/tcg/hexagon/overflow.c | 61 +++++++++++++++++++++++++++++++++++-
1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/tests/tcg/hexagon/overflow.c b/tests/tcg/hexagon/overflow.c
index 196fcf7f3a..94087851b0 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;
}
--
2.17.1
next prev parent reply other threads:[~2022-03-12 20:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 20:13 [PULL v2 00/12] Hexagon (target/hexagon) queue Taylor Simpson
2022-03-12 20:13 ` [PULL v2 01/12] Hexagon (target/hexagon) fix bug in circular addressing Taylor Simpson
2022-03-12 20:13 ` [PULL v2 02/12] Hexagon HVX (target/hexagon) fix bug in HVX saturate instructions Taylor Simpson
2022-03-12 20:13 ` [PULL v2 03/12] Hexagon (target/hexagon) properly set FPINVF bit in sfcmp.uo and dfcmp.uo Taylor Simpson
2022-03-12 20:13 ` [PULL v2 04/12] Hexagon (target/hexagon) properly handle denorm in arch_sf_recip_common Taylor Simpson
2022-03-12 20:13 ` [PULL v2 05/12] Hexagon (target/hexagon) properly handle NaN in dfmin/dfmax/sfmin/sfmax Taylor Simpson
2022-03-12 20:13 ` [PULL v2 06/12] Hexagon (tests/tcg/hexagon) test instructions that might set bits in USR Taylor Simpson
2022-03-12 20:13 ` [PULL v2 07/12] Hexagon (tests/tcg/hexagon) add floating point instructions to usr.c Taylor Simpson
2022-03-12 20:13 ` Taylor Simpson [this message]
2022-03-12 20:13 ` [PULL v2 09/12] Hexagon (tests/tcg/hexagon) fix inline asm in preg_alias.c Taylor Simpson
2022-03-12 20:13 ` [PULL v2 10/12] Hexagon (target/hexagon) fix bug in conv_df2uw_chop Taylor Simpson
2022-03-12 20:13 ` [PULL v2 11/12] Hexagon (target/hexagon) assignment to c4 should wait until packet commit Taylor Simpson
2022-03-12 20:13 ` [PULL v2 12/12] target/hexagon: remove unused variable Taylor Simpson
2022-03-14 13:22 ` [PULL v2 00/12] Hexagon (target/hexagon) queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220312201319.29040-9-tsimpson@quicinc.com \
--to=tsimpson@quicinc.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zongyuan.li@smartx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).