diff mbox series

[16/72] softfloat: Move type-specific pack/unpack routines

Message ID 20210508014802.892561-17-richard.henderson@linaro.org (mailing list archive)
State New, archived
Headers show
Series Convert floatx80 and float128 to FloatParts | expand

Commit Message

Richard Henderson May 8, 2021, 1:47 a.m. UTC
In preparation from moving sf_canonicalize.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 fpu/softfloat.c | 109 +++++++++++++++++++++++++-----------------------
 1 file changed, 56 insertions(+), 53 deletions(-)

Comments

Philippe Mathieu-Daudé May 9, 2021, 8:46 a.m. UTC | #1
On 5/8/21 3:47 AM, Richard Henderson wrote:
> In preparation from moving sf_canonicalize.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  fpu/softfloat.c | 109 +++++++++++++++++++++++++-----------------------
>  1 file changed, 56 insertions(+), 53 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
David Hildenbrand May 11, 2021, 10:17 a.m. UTC | #2
On 08.05.21 03:47, Richard Henderson wrote:
> In preparation from moving sf_canonicalize.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   fpu/softfloat.c | 109 +++++++++++++++++++++++++-----------------------
>   1 file changed, 56 insertions(+), 53 deletions(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index 27b51659c9..398a068b58 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -837,59 +837,6 @@ static FloatParts64 round_canonical(FloatParts64 p, float_status *s,
>       return p;
>   }
>   
> -/* Explicit FloatFmt version */
> -static FloatParts64 float16a_unpack_canonical(float16 f, float_status *s,
> -                                            const FloatFmt *params)
> -{
> -    return sf_canonicalize(float16_unpack_raw(f), params, s);
> -}
> -
> -static FloatParts64 float16_unpack_canonical(float16 f, float_status *s)
> -{
> -    return float16a_unpack_canonical(f, s, &float16_params);
> -}
> -
> -static FloatParts64 bfloat16_unpack_canonical(bfloat16 f, float_status *s)
> -{
> -    return sf_canonicalize(bfloat16_unpack_raw(f), &bfloat16_params, s);
> -}
> -
> -static float16 float16a_round_pack_canonical(FloatParts64 p, float_status *s,
> -                                             const FloatFmt *params)
> -{
> -    return float16_pack_raw(round_canonical(p, s, params));
> -}
> -
> -static float16 float16_round_pack_canonical(FloatParts64 p, float_status *s)
> -{
> -    return float16a_round_pack_canonical(p, s, &float16_params);
> -}
> -
> -static bfloat16 bfloat16_round_pack_canonical(FloatParts64 p, float_status *s)
> -{
> -    return bfloat16_pack_raw(round_canonical(p, s, &bfloat16_params));
> -}
> -
> -static FloatParts64 float32_unpack_canonical(float32 f, float_status *s)
> -{
> -    return sf_canonicalize(float32_unpack_raw(f), &float32_params, s);
> -}
> -
> -static float32 float32_round_pack_canonical(FloatParts64 p, float_status *s)
> -{
> -    return float32_pack_raw(round_canonical(p, s, &float32_params));
> -}
> -
> -static FloatParts64 float64_unpack_canonical(float64 f, float_status *s)
> -{
> -    return sf_canonicalize(float64_unpack_raw(f), &float64_params, s);
> -}
> -
> -static float64 float64_round_pack_canonical(FloatParts64 p, float_status *s)
> -{
> -    return float64_pack_raw(round_canonical(p, s, &float64_params));
> -}
> -
>   static FloatParts64 return_nan(FloatParts64 a, float_status *s)
>   {
>       g_assert(is_nan(a.cls));
> @@ -964,6 +911,62 @@ static FloatParts64 pick_nan_muladd(FloatParts64 a, FloatParts64 b, FloatParts64
>       return a;
>   }
>   
> +/*
> + * Pack/unpack routines with a specific FloatFmt.
> + */
> +
> +static FloatParts64 float16a_unpack_canonical(float16 f, float_status *s,
> +                                            const FloatFmt *params)
> +{
> +    return sf_canonicalize(float16_unpack_raw(f), params, s);
> +}
> +
> +static FloatParts64 float16_unpack_canonical(float16 f, float_status *s)
> +{
> +    return float16a_unpack_canonical(f, s, &float16_params);
> +}
> +
> +static FloatParts64 bfloat16_unpack_canonical(bfloat16 f, float_status *s)
> +{
> +    return sf_canonicalize(bfloat16_unpack_raw(f), &bfloat16_params, s);
> +}
> +
> +static float16 float16a_round_pack_canonical(FloatParts64 p, float_status *s,
> +                                             const FloatFmt *params)
> +{
> +    return float16_pack_raw(round_canonical(p, s, params));
> +}
> +
> +static float16 float16_round_pack_canonical(FloatParts64 p, float_status *s)
> +{
> +    return float16a_round_pack_canonical(p, s, &float16_params);
> +}
> +
> +static bfloat16 bfloat16_round_pack_canonical(FloatParts64 p, float_status *s)
> +{
> +    return bfloat16_pack_raw(round_canonical(p, s, &bfloat16_params));
> +}
> +
> +static FloatParts64 float32_unpack_canonical(float32 f, float_status *s)
> +{
> +    return sf_canonicalize(float32_unpack_raw(f), &float32_params, s);
> +}
> +
> +static float32 float32_round_pack_canonical(FloatParts64 p, float_status *s)
> +{
> +    return float32_pack_raw(round_canonical(p, s, &float32_params));
> +}
> +
> +static FloatParts64 float64_unpack_canonical(float64 f, float_status *s)
> +{
> +    return sf_canonicalize(float64_unpack_raw(f), &float64_params, s);
> +}
> +
> +static float64 float64_round_pack_canonical(FloatParts64 p, float_status *s)
> +{
> +    return float64_pack_raw(round_canonical(p, s, &float64_params));
> +}
> +
>   /*
>    * Returns the result of adding or subtracting the values of the
>    * floating-point values `a' and `b'. The operation is performed
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 27b51659c9..398a068b58 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -837,59 +837,6 @@  static FloatParts64 round_canonical(FloatParts64 p, float_status *s,
     return p;
 }
 
-/* Explicit FloatFmt version */
-static FloatParts64 float16a_unpack_canonical(float16 f, float_status *s,
-                                            const FloatFmt *params)
-{
-    return sf_canonicalize(float16_unpack_raw(f), params, s);
-}
-
-static FloatParts64 float16_unpack_canonical(float16 f, float_status *s)
-{
-    return float16a_unpack_canonical(f, s, &float16_params);
-}
-
-static FloatParts64 bfloat16_unpack_canonical(bfloat16 f, float_status *s)
-{
-    return sf_canonicalize(bfloat16_unpack_raw(f), &bfloat16_params, s);
-}
-
-static float16 float16a_round_pack_canonical(FloatParts64 p, float_status *s,
-                                             const FloatFmt *params)
-{
-    return float16_pack_raw(round_canonical(p, s, params));
-}
-
-static float16 float16_round_pack_canonical(FloatParts64 p, float_status *s)
-{
-    return float16a_round_pack_canonical(p, s, &float16_params);
-}
-
-static bfloat16 bfloat16_round_pack_canonical(FloatParts64 p, float_status *s)
-{
-    return bfloat16_pack_raw(round_canonical(p, s, &bfloat16_params));
-}
-
-static FloatParts64 float32_unpack_canonical(float32 f, float_status *s)
-{
-    return sf_canonicalize(float32_unpack_raw(f), &float32_params, s);
-}
-
-static float32 float32_round_pack_canonical(FloatParts64 p, float_status *s)
-{
-    return float32_pack_raw(round_canonical(p, s, &float32_params));
-}
-
-static FloatParts64 float64_unpack_canonical(float64 f, float_status *s)
-{
-    return sf_canonicalize(float64_unpack_raw(f), &float64_params, s);
-}
-
-static float64 float64_round_pack_canonical(FloatParts64 p, float_status *s)
-{
-    return float64_pack_raw(round_canonical(p, s, &float64_params));
-}
-
 static FloatParts64 return_nan(FloatParts64 a, float_status *s)
 {
     g_assert(is_nan(a.cls));
@@ -964,6 +911,62 @@  static FloatParts64 pick_nan_muladd(FloatParts64 a, FloatParts64 b, FloatParts64
     return a;
 }
 
+/*
+ * Pack/unpack routines with a specific FloatFmt.
+ */
+
+static FloatParts64 float16a_unpack_canonical(float16 f, float_status *s,
+                                            const FloatFmt *params)
+{
+    return sf_canonicalize(float16_unpack_raw(f), params, s);
+}
+
+static FloatParts64 float16_unpack_canonical(float16 f, float_status *s)
+{
+    return float16a_unpack_canonical(f, s, &float16_params);
+}
+
+static FloatParts64 bfloat16_unpack_canonical(bfloat16 f, float_status *s)
+{
+    return sf_canonicalize(bfloat16_unpack_raw(f), &bfloat16_params, s);
+}
+
+static float16 float16a_round_pack_canonical(FloatParts64 p, float_status *s,
+                                             const FloatFmt *params)
+{
+    return float16_pack_raw(round_canonical(p, s, params));
+}
+
+static float16 float16_round_pack_canonical(FloatParts64 p, float_status *s)
+{
+    return float16a_round_pack_canonical(p, s, &float16_params);
+}
+
+static bfloat16 bfloat16_round_pack_canonical(FloatParts64 p, float_status *s)
+{
+    return bfloat16_pack_raw(round_canonical(p, s, &bfloat16_params));
+}
+
+static FloatParts64 float32_unpack_canonical(float32 f, float_status *s)
+{
+    return sf_canonicalize(float32_unpack_raw(f), &float32_params, s);
+}
+
+static float32 float32_round_pack_canonical(FloatParts64 p, float_status *s)
+{
+    return float32_pack_raw(round_canonical(p, s, &float32_params));
+}
+
+static FloatParts64 float64_unpack_canonical(float64 f, float_status *s)
+{
+    return sf_canonicalize(float64_unpack_raw(f), &float64_params, s);
+}
+
+static float64 float64_round_pack_canonical(FloatParts64 p, float_status *s)
+{
+    return float64_pack_raw(round_canonical(p, s, &float64_params));
+}
+
 /*
  * Returns the result of adding or subtracting the values of the
  * floating-point values `a' and `b'. The operation is performed