mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
Hexagon (target/hexagon) add A4_addp_c/A4_subp_c
Rdd32 = add(Rss32, Rtt32, Px4):carry Add with carry Rdd32 = sub(Rss32, Rtt32, Px4):carry Sub with carry Test cases in tests/tcg/hexagon/multi_result.c Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <1617930474-31979-22-git-send-email-tsimpson@quicinc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
0a65d28693
commit
57d352ac29
5 changed files with 147 additions and 0 deletions
|
@ -85,6 +85,38 @@ static long long vminub(long long Rtt, long long Rss,
|
|||
return result;
|
||||
}
|
||||
|
||||
static long long add_carry(long long Rss, long long Rtt,
|
||||
int pred_in, int *pred_result)
|
||||
{
|
||||
long long result;
|
||||
int predval = pred_in;
|
||||
|
||||
asm volatile("p0 = %1\n\t"
|
||||
"%0 = add(%2, %3, p0):carry\n\t"
|
||||
"%1 = p0\n\t"
|
||||
: "=r"(result), "+r"(predval)
|
||||
: "r"(Rss), "r"(Rtt)
|
||||
: "p0");
|
||||
*pred_result = predval;
|
||||
return result;
|
||||
}
|
||||
|
||||
static long long sub_carry(long long Rss, long long Rtt,
|
||||
int pred_in, int *pred_result)
|
||||
{
|
||||
long long result;
|
||||
int predval = pred_in;
|
||||
|
||||
asm volatile("p0 = !cmp.eq(%1, #0)\n\t"
|
||||
"%0 = sub(%2, %3, p0):carry\n\t"
|
||||
"%1 = p0\n\t"
|
||||
: "=r"(result), "+r"(predval)
|
||||
: "r"(Rss), "r"(Rtt)
|
||||
: "p0");
|
||||
*pred_result = predval;
|
||||
return result;
|
||||
}
|
||||
|
||||
int err;
|
||||
|
||||
static void check_ll(long long val, long long expect)
|
||||
|
@ -188,12 +220,62 @@ static void test_vminub()
|
|||
check_p(pred_result, 0xaa);
|
||||
}
|
||||
|
||||
static void test_add_carry()
|
||||
{
|
||||
long long res64;
|
||||
int pred_result;
|
||||
|
||||
res64 = add_carry(0x0000000000000000LL,
|
||||
0xffffffffffffffffLL,
|
||||
1, &pred_result);
|
||||
check_ll(res64, 0x0000000000000000LL);
|
||||
check_p(pred_result, 0xff);
|
||||
|
||||
res64 = add_carry(0x0000000100000000LL,
|
||||
0xffffffffffffffffLL,
|
||||
0, &pred_result);
|
||||
check_ll(res64, 0x00000000ffffffffLL);
|
||||
check_p(pred_result, 0xff);
|
||||
|
||||
res64 = add_carry(0x0000000100000000LL,
|
||||
0xffffffffffffffffLL,
|
||||
0, &pred_result);
|
||||
check_ll(res64, 0x00000000ffffffffLL);
|
||||
check_p(pred_result, 0xff);
|
||||
}
|
||||
|
||||
static void test_sub_carry()
|
||||
{
|
||||
long long res64;
|
||||
int pred_result;
|
||||
|
||||
res64 = sub_carry(0x0000000000000000LL,
|
||||
0x0000000000000000LL,
|
||||
1, &pred_result);
|
||||
check_ll(res64, 0x0000000000000000LL);
|
||||
check_p(pred_result, 0xff);
|
||||
|
||||
res64 = sub_carry(0x0000000100000000LL,
|
||||
0x0000000000000000LL,
|
||||
0, &pred_result);
|
||||
check_ll(res64, 0x00000000ffffffffLL);
|
||||
check_p(pred_result, 0xff);
|
||||
|
||||
res64 = sub_carry(0x0000000100000000LL,
|
||||
0x0000000000000000LL,
|
||||
0, &pred_result);
|
||||
check_ll(res64, 0x00000000ffffffffLL);
|
||||
check_p(pred_result, 0xff);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_sfrecipa();
|
||||
test_sfinvsqrta();
|
||||
test_vacsh();
|
||||
test_vminub();
|
||||
test_add_carry();
|
||||
test_sub_carry();
|
||||
|
||||
puts(err ? "FAIL" : "PASS");
|
||||
return err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue