diff mbox series

[v2,2/8] softfloat: Use _Generic instead of QEMU_GENERIC

Message ID 20210614233143.1221879-3-richard.henderson@linaro.org (mailing list archive)
State New, archived
Headers show
Series configure: Change to -std=gnu11 | expand

Commit Message

Richard Henderson June 14, 2021, 11:31 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 fpu/softfloat.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Thomas Huth June 15, 2021, 7:48 a.m. UTC | #1
On 15/06/2021 01.31, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   fpu/softfloat.c | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index 4d0160fe9c..6e769f990c 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -686,11 +686,13 @@ static float128 float128_pack_raw(const FloatParts128 *p)
>   #include "softfloat-specialize.c.inc"
>   
>   #define PARTS_GENERIC_64_128(NAME, P) \
> -    QEMU_GENERIC(P, (FloatParts128 *, parts128_##NAME), parts64_##NAME)
> +    _Generic((P), FloatParts64 *: parts64_##NAME, \
> +                  FloatParts128 *: parts128_##NAME)
>   
>   #define PARTS_GENERIC_64_128_256(NAME, P) \
> -    QEMU_GENERIC(P, (FloatParts256 *, parts256_##NAME), \
> -                 (FloatParts128 *, parts128_##NAME), parts64_##NAME)
> +    _Generic((P), FloatParts64 *: parts64_##NAME, \
> +                  FloatParts128 *: parts128_##NAME, \
> +                  FloatParts256 *: parts256_##NAME)
>   
>   #define parts_default_nan(P, S)    PARTS_GENERIC_64_128(default_nan, P)(P, S)
>   #define parts_silence_nan(P, S)    PARTS_GENERIC_64_128(silence_nan, P)(P, S)
> @@ -892,11 +894,13 @@ static void parts128_log2(FloatParts128 *a, float_status *s, const FloatFmt *f);
>    */
>   
>   #define FRAC_GENERIC_64_128(NAME, P) \
> -    QEMU_GENERIC(P, (FloatParts128 *, frac128_##NAME), frac64_##NAME)
> +    _Generic((P), FloatParts64 *: frac64_##NAME, \
> +                  FloatParts128 *: frac128_##NAME)
>   
>   #define FRAC_GENERIC_64_128_256(NAME, P) \
> -    QEMU_GENERIC(P, (FloatParts256 *, frac256_##NAME), \
> -                 (FloatParts128 *, frac128_##NAME), frac64_##NAME)
> +    _Generic((P), FloatParts64 *: frac64_##NAME, \
> +                  FloatParts128 *: frac128_##NAME, \
> +                  FloatParts256 *: frac256_##NAME)
>   
>   static bool frac64_add(FloatParts64 *r, FloatParts64 *a, FloatParts64 *b)
>   {
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>
Alex Bennée June 15, 2021, 10:18 a.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> writes:

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff mbox series

Patch

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 4d0160fe9c..6e769f990c 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -686,11 +686,13 @@  static float128 float128_pack_raw(const FloatParts128 *p)
 #include "softfloat-specialize.c.inc"
 
 #define PARTS_GENERIC_64_128(NAME, P) \
-    QEMU_GENERIC(P, (FloatParts128 *, parts128_##NAME), parts64_##NAME)
+    _Generic((P), FloatParts64 *: parts64_##NAME, \
+                  FloatParts128 *: parts128_##NAME)
 
 #define PARTS_GENERIC_64_128_256(NAME, P) \
-    QEMU_GENERIC(P, (FloatParts256 *, parts256_##NAME), \
-                 (FloatParts128 *, parts128_##NAME), parts64_##NAME)
+    _Generic((P), FloatParts64 *: parts64_##NAME, \
+                  FloatParts128 *: parts128_##NAME, \
+                  FloatParts256 *: parts256_##NAME)
 
 #define parts_default_nan(P, S)    PARTS_GENERIC_64_128(default_nan, P)(P, S)
 #define parts_silence_nan(P, S)    PARTS_GENERIC_64_128(silence_nan, P)(P, S)
@@ -892,11 +894,13 @@  static void parts128_log2(FloatParts128 *a, float_status *s, const FloatFmt *f);
  */
 
 #define FRAC_GENERIC_64_128(NAME, P) \
-    QEMU_GENERIC(P, (FloatParts128 *, frac128_##NAME), frac64_##NAME)
+    _Generic((P), FloatParts64 *: frac64_##NAME, \
+                  FloatParts128 *: frac128_##NAME)
 
 #define FRAC_GENERIC_64_128_256(NAME, P) \
-    QEMU_GENERIC(P, (FloatParts256 *, frac256_##NAME), \
-                 (FloatParts128 *, frac128_##NAME), frac64_##NAME)
+    _Generic((P), FloatParts64 *: frac64_##NAME, \
+                  FloatParts128 *: frac128_##NAME, \
+                  FloatParts256 *: frac256_##NAME)
 
 static bool frac64_add(FloatParts64 *r, FloatParts64 *a, FloatParts64 *b)
 {