diff mbox series

[v5,23/28] fpu/softfloat: Make is_nan et al available to softfloat-specialize.h

Message ID 20180514221219.7091-24-richard.henderson@linaro.org
State Superseded
Headers show
Series softfloat patch roundup | expand

Commit Message

Richard Henderson May 14, 2018, 10:12 p.m. UTC
We will need these helpers within softfloat-specialize.h, so move
the definitions above the include.  After specialization, they will
not always be used so mark them to avoid the Werror.

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

---
 fpu/softfloat.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

-- 
2.17.0

Comments

Peter Maydell May 15, 2018, 10:59 a.m. UTC | #1
On 14 May 2018 at 23:12, Richard Henderson <richard.henderson@linaro.org> wrote:
> We will need these helpers within softfloat-specialize.h, so move

> the definitions above the include.  After specialization, they will

> not always be used so mark them to avoid the Werror.

>

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

> ---

>  fpu/softfloat.c | 30 ++++++++++++++++--------------

>  1 file changed, 16 insertions(+), 14 deletions(-)


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


thanks
-- PMM
Alex Bennée May 15, 2018, 1:51 p.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> writes:

> We will need these helpers within softfloat-specialize.h, so move

> the definitions above the include.  After specialization, they will

> not always be used so mark them to avoid the Werror.

>

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


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


> ---

>  fpu/softfloat.c | 30 ++++++++++++++++--------------

>  1 file changed, 16 insertions(+), 14 deletions(-)

>

> diff --git a/fpu/softfloat.c b/fpu/softfloat.c

> index e9e421728b..9934adbae5 100644

> --- a/fpu/softfloat.c

> +++ b/fpu/softfloat.c

> @@ -181,6 +181,22 @@ typedef enum __attribute__ ((__packed__)) {

>      float_class_snan,

>  } FloatClass;

>

> +/* Simple helpers for checking if, or what kind of, NaN we have */

> +static inline __attribute__((unused)) bool is_nan(FloatClass c)

> +{

> +    return unlikely(c >= float_class_qnan);

> +}

> +

> +static inline __attribute__((unused)) bool is_snan(FloatClass c)

> +{

> +    return c == float_class_snan;

> +}

> +

> +static inline __attribute__((unused)) bool is_qnan(FloatClass c)

> +{

> +    return c == float_class_qnan;

> +}

> +

>  /*

>   * Structure holding all of the decomposed parts of a float. The

>   * exponent is unbiased and the fraction is normalized. All

> @@ -536,20 +552,6 @@ static float64 float64_round_pack_canonical(FloatParts p, float_status *s)

>      return float64_pack_raw(round_canonical(p, s, &float64_params));

>  }

>

> -/* Simple helpers for checking if what NaN we have */

> -static bool is_nan(FloatClass c)

> -{

> -    return unlikely(c >= float_class_qnan);

> -}

> -static bool is_snan(FloatClass c)

> -{

> -    return c == float_class_snan;

> -}

> -static bool is_qnan(FloatClass c)

> -{

> -    return c == float_class_qnan;

> -}

> -

>  static FloatParts return_nan(FloatParts a, float_status *s)

>  {

>      switch (a.cls) {



--
Alex Bennée
diff mbox series

Patch

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index e9e421728b..9934adbae5 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -181,6 +181,22 @@  typedef enum __attribute__ ((__packed__)) {
     float_class_snan,
 } FloatClass;
 
+/* Simple helpers for checking if, or what kind of, NaN we have */
+static inline __attribute__((unused)) bool is_nan(FloatClass c)
+{
+    return unlikely(c >= float_class_qnan);
+}
+
+static inline __attribute__((unused)) bool is_snan(FloatClass c)
+{
+    return c == float_class_snan;
+}
+
+static inline __attribute__((unused)) bool is_qnan(FloatClass c)
+{
+    return c == float_class_qnan;
+}
+
 /*
  * Structure holding all of the decomposed parts of a float. The
  * exponent is unbiased and the fraction is normalized. All
@@ -536,20 +552,6 @@  static float64 float64_round_pack_canonical(FloatParts p, float_status *s)
     return float64_pack_raw(round_canonical(p, s, &float64_params));
 }
 
-/* Simple helpers for checking if what NaN we have */
-static bool is_nan(FloatClass c)
-{
-    return unlikely(c >= float_class_qnan);
-}
-static bool is_snan(FloatClass c)
-{
-    return c == float_class_snan;
-}
-static bool is_qnan(FloatClass c)
-{
-    return c == float_class_qnan;
-}
-
 static FloatParts return_nan(FloatParts a, float_status *s)
 {
     switch (a.cls) {