[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 41/72] softfloat: Introduce sh[lr]_double primitives
From: |
Alex Bennée |
Subject: |
Re: [PATCH 41/72] softfloat: Introduce sh[lr]_double primitives |
Date: |
Thu, 13 May 2021 11:59:42 +0100 |
User-agent: |
mu4e 1.5.13; emacs 28.0.50 |
Richard Henderson <richard.henderson@linaro.org> writes:
> Have x86_64 assembly for them, with a fallback.
> This avoids shuffling values through %cl in the x86 case.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> include/fpu/softfloat-macros.h | 36 ++++++++++++
> fpu/softfloat.c | 102 +++++++++++++++++++++++++--------
> 2 files changed, 115 insertions(+), 23 deletions(-)
>
> diff --git a/include/fpu/softfloat-macros.h b/include/fpu/softfloat-macros.h
> index 672c1db555..ec4e27a595 100644
> --- a/include/fpu/softfloat-macros.h
> +++ b/include/fpu/softfloat-macros.h
> @@ -85,6 +85,42 @@ this code that are retained.
> #include "fpu/softfloat-types.h"
> #include "qemu/host-utils.h"
>
> +/**
> + * shl_double: double-word merging left shift
> + * @l: left or most-significant word
> + * @r: right or least-significant word
> + * @c: shift count
> + *
> + * Shift @l left by @c bits, shifting in bits from @r.
> + */
> +static inline uint64_t shl_double(uint64_t l, uint64_t r, int c)
> +{
> +#if defined(__x86_64__)
> + asm("shld %b2, %1, %0" : "+r"(l) : "r"(r), "ci"(c));
> + return l;
> +#else
> + return c ? (l << c) | (r >> (64 - c)) : l;
> +#endif
> +}
> +
> +/**
> + * shr_double: double-word merging right shift
> + * @l: left or most-significant word
> + * @r: right or least-significant word
> + * @c: shift count
> + *
> + * Shift @r right by @c bits, shifting in bits from @l.
> + */
> +static inline uint64_t shr_double(uint64_t l, uint64_t r, int c)
> +{
> +#if defined(__x86_64__)
> + asm("shrd %b2, %1, %0" : "+r"(r) : "r"(l), "ci"(c));
> + return r;
> +#else
> + return c ? (r >> c) | (l << (64 - c)) : r;
> +#endif
> +}
> +
I was pondering if these deserve to live in bitops but given they are
softfloat only for the time being and we don't do arch specific hacks in
there:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
- [PATCH 36/72] softfloat: Move mul_floats to softfloat-parts.c.inc, (continued)
- [PATCH 36/72] softfloat: Move mul_floats to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 38/72] softfloat: Use mulu64 for mul64To128, Richard Henderson, 2021/05/07
- [PATCH 40/72] softfloat: Tidy mul128By64To192, Richard Henderson, 2021/05/07
- [PATCH 43/72] softfloat: Split float_to_float, Richard Henderson, 2021/05/07
- [PATCH 44/72] softfloat: Convert float-to-float conversions with float128, Richard Henderson, 2021/05/07
- [PATCH 41/72] softfloat: Introduce sh[lr]_double primitives, Richard Henderson, 2021/05/07
- Re: [PATCH 41/72] softfloat: Introduce sh[lr]_double primitives,
Alex Bennée <=
- [PATCH 42/72] softfloat: Move div_floats to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 48/72] softfloat: Move int_to_float to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 49/72] softfloat: Move uint_to_float to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 54/72] softfloat: Split out parts_uncanon_normal, Richard Henderson, 2021/05/07
- [PATCH 45/72] softfloat: Move round_to_int to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 46/72] softfloat: Move rount_to_int_and_pack to softfloat-parts.c.inc, Richard Henderson, 2021/05/07
- [PATCH 47/72] softfloat: Move rount_to_uint_and_pack to softfloat-parts.c.inc, Richard Henderson, 2021/05/07