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>
This commit is contained in:
parent
2479540fff
commit
8576e7ecae
|
@ -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
|
* 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
|
* 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;
|
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;
|
jmp_buf jmp_env;
|
||||||
int usr_overflow;
|
int usr_overflow;
|
||||||
|
@ -82,6 +96,49 @@ static void sig_segv(int sig, siginfo_t *info, void *puc)
|
||||||
longjmp(jmp_env, 1);
|
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()
|
int main()
|
||||||
{
|
{
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
@ -102,6 +159,8 @@ int main()
|
||||||
|
|
||||||
check(usr_overflow, 0);
|
check(usr_overflow, 0);
|
||||||
|
|
||||||
|
test_packet();
|
||||||
|
|
||||||
puts(err ? "FAIL" : "PASS");
|
puts(err ? "FAIL" : "PASS");
|
||||||
return err ? EXIT_FAILURE : EXIT_SUCCESS;
|
return err ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue