target/hppa: Implement HAVG

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2023-09-20 17:11:06 +02:00
parent 10c9e58d5c
commit 1b3cb7c874
4 changed files with 22 additions and 0 deletions

View file

@ -410,6 +410,20 @@ uint64_t HELPER(hadd_us)(uint64_t r1, uint64_t r2)
return ret;
}
uint64_t HELPER(havg)(uint64_t r1, uint64_t r2)
{
uint64_t ret = 0;
for (int i = 0; i < 64; i += 16) {
int f1 = extract64(r1, i, 16);
int f2 = extract64(r2, i, 16);
int fr = f1 + f2;
ret = deposit64(ret, i, 16, (fr >> 1) | (fr & 1));
}
return ret;
}
uint64_t HELPER(hsub_ss)(uint64_t r1, uint64_t r2)
{
uint64_t ret = 0;