[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] Hexagon (tests/tcg/hexagon) update overflow test
From: |
Taylor Simpson |
Subject: |
[PATCH 8/8] Hexagon (tests/tcg/hexagon) update overflow test |
Date: |
Sun, 6 Feb 2022 15:50:30 -0800 |
Add a test that sets USR multiple times in a packet
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
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
- [PATCH 0/8] Hexagon bug fixes and additional tests, Taylor Simpson, 2022/02/06
- [PATCH 5/8] Hexagon (target/hexagon) properly handle denorm in arch_sf_recip_common, Taylor Simpson, 2022/02/06
- [PATCH 1/8] Hexagon (target/hexagon) fix bug in circular addressing, Taylor Simpson, 2022/02/06
- [PATCH 6/8] Hexagon (tests/tcg/hexagon) test instructions that might set bits in USR, Taylor Simpson, 2022/02/06
- [PATCH 8/8] Hexagon (tests/tcg/hexagon) update overflow test,
Taylor Simpson <=
- [PATCH 3/8] Hexagon (target/hexagon) properly set FPINVF bit in sfcmp.uo and dfcmp.uo, Taylor Simpson, 2022/02/06
- [PATCH 7/8] Hexagon (tests/tcg/hexagon) add floating point instructions to usr.c, Taylor Simpson, 2022/02/06
- [PATCH 4/8] Hexagon (target/hexagon) properly handle SNaN in dfmin/dfmax/sfmin/sfmax, Taylor Simpson, 2022/02/06
- [PATCH 2/8] Hexagon HVX (target/hexagon)) fix bug in HVX saturate instructions, Taylor Simpson, 2022/02/06