diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-09-20 16:30:41 +0200 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-11-06 18:49:34 -0800 |
commit | 10c9e58d5c317d8bc6a0a2b36e2f130bad6b8cea (patch) | |
tree | 3f2974306f3b34ac366138c167345c760b98c30b /target/hppa/op_helper.c | |
parent | 0843563f3ef42db0ccaa1ac219439413f8083d34 (diff) |
target/hppa: Implement HSUB
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/hppa/op_helper.c')
-rw-r--r-- | target/hppa/op_helper.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index d93801ca47..de51905428 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -409,3 +409,35 @@ uint64_t HELPER(hadd_us)(uint64_t r1, uint64_t r2) } return ret; } + +uint64_t HELPER(hsub_ss)(uint64_t r1, uint64_t r2) +{ + uint64_t ret = 0; + + for (int i = 0; i < 64; i += 16) { + int f1 = sextract64(r1, i, 16); + int f2 = sextract64(r2, i, 16); + int fr = f1 - f2; + + fr = MIN(fr, INT16_MAX); + fr = MAX(fr, INT16_MIN); + ret = deposit64(ret, i, 16, fr); + } + return ret; +} + +uint64_t HELPER(hsub_us)(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 = sextract64(r2, i, 16); + int fr = f1 - f2; + + fr = MIN(fr, UINT16_MAX); + fr = MAX(fr, 0); + ret = deposit64(ret, i, 16, fr); + } + return ret; +} |