[PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p()

Peter Maydell posted 5 patches 5 years ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Yoshinori Sato <ysato@users.sourceforge.jp>, Laurent Vivier <laurent@vivier.eu>, David Gibson <david@gibson.dropbear.id.au>, Paolo Bonzini <pbonzini@redhat.com>, Greg Kurz <groug@kaod.org>
[PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p()
Posted by Peter Maydell 5 years ago
We used to make a distinction between 'float64'/'float32' types and
the 'uint64_t'/'uint32_t' types, requiring special conversion
operations to go between them.  We've now dropped this distinction as
unnecessary, and the 'float*' types remain primarily for
documentation purposes when used in places like the function
prototypes of TCG helper functions.

This means that there's no need for a special gdb_get_float64()
function to write a float64 value to the GDB protocol buffer; we can
just use gdb_get_reg64().

Similarly, for reading a value out of the GDB buffer into a float64
we can use ldq_p() and need not use ldfq_p().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/m68k/helper.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 3ff57657958..09f0391d508 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -72,8 +72,7 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         float_status s;
-        return gdb_get_float64(mem_buf,
-                               floatx80_to_float64(env->fregs[n].d, &s));
+        return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s));
     }
     switch (n) {
     case 8: /* fpcontrol */
@@ -90,7 +89,7 @@ static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
 {
     if (n < 8) {
         float_status s;
-        env->fregs[n].d = float64_to_floatx80(ldfq_p(mem_buf), &s);
+        env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s);
         return 8;
     }
     switch (n) {
-- 
2.20.1


Re: [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p()
Posted by Laurent Vivier 5 years ago
Le 08/02/2021 à 12:34, Peter Maydell a écrit :
> We used to make a distinction between 'float64'/'float32' types and
> the 'uint64_t'/'uint32_t' types, requiring special conversion
> operations to go between them.  We've now dropped this distinction as
> unnecessary, and the 'float*' types remain primarily for
> documentation purposes when used in places like the function
> prototypes of TCG helper functions.
> 
> This means that there's no need for a special gdb_get_float64()
> function to write a float64 value to the GDB protocol buffer; we can
> just use gdb_get_reg64().
> 
> Similarly, for reading a value out of the GDB buffer into a float64
> we can use ldq_p() and need not use ldfq_p().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target/m68k/helper.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index 3ff57657958..09f0391d508 100644
> --- a/target/m68k/helper.c
> +++ b/target/m68k/helper.c
> @@ -72,8 +72,7 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
>  {
>      if (n < 8) {
>          float_status s;
> -        return gdb_get_float64(mem_buf,
> -                               floatx80_to_float64(env->fregs[n].d, &s));
> +        return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s));
>      }
>      switch (n) {
>      case 8: /* fpcontrol */
> @@ -90,7 +89,7 @@ static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
>  {
>      if (n < 8) {
>          float_status s;
> -        env->fregs[n].d = float64_to_floatx80(ldfq_p(mem_buf), &s);
> +        env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s);
>          return 8;
>      }
>      switch (n) {
> 

Acked-by: Laurent Vivier <laurent@vivier.eu>