diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-07-04 08:20:26 -0600 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2025-07-04 15:52:22 +0100 |
| commit | 9a7d445c09aa79a14bc4c5eede635b043622cbf0 (patch) | |
| tree | a913233f24fd747899fd67eefd8e09b53b100b97 /target/arm/tcg/vec_internal.h | |
| parent | a3a019c0efc06e63c648c416484ed5083678c93d (diff) | |
| download | focaccia-qemu-9a7d445c09aa79a14bc4c5eede635b043622cbf0.tar.gz focaccia-qemu-9a7d445c09aa79a14bc4c5eede635b043622cbf0.zip | |
target/arm: Move do_urshr, do_srshr to vec_internal.h
Unify two copies of these inline functions. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20250704142112.1018902-64-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to '')
| -rw-r--r-- | target/arm/tcg/vec_internal.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/target/arm/tcg/vec_internal.h b/target/arm/tcg/vec_internal.h index a1c10c60a1..5efd257c50 100644 --- a/target/arm/tcg/vec_internal.h +++ b/target/arm/tcg/vec_internal.h @@ -230,6 +230,27 @@ int64_t do_sqrdmlah_d(int64_t, int64_t, int64_t, bool, bool); #define do_usat_h(val) MIN(MAX(val, 0), UINT16_MAX) #define do_usat_s(val) MIN(MAX(val, 0), UINT32_MAX) +static inline uint64_t do_urshr(uint64_t x, unsigned sh) +{ + if (likely(sh < 64)) { + return (x >> sh) + ((x >> (sh - 1)) & 1); + } else if (sh == 64) { + return x >> 63; + } else { + return 0; + } +} + +static inline int64_t do_srshr(int64_t x, unsigned sh) +{ + if (likely(sh < 64)) { + return (x >> sh) + ((x >> (sh - 1)) & 1); + } else { + /* Rounding the sign bit always produces 0. */ + return 0; + } +} + /** * bfdotadd: * @sum: addend |