All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code
@ 2021-02-08 11:34 Peter Maydell
  2021-02-08 11:34 ` [PATCH 1/5] target/sh4: Drop use of gdb_get_float32() and ldfl_p() Peter Maydell
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Peter Maydell @ 2021-02-08 11:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, Laurent Vivier, qemu-ppc,
	Alex Bennée, David Gibson

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 special gdb_get_float64() and
gdb_get_float32() functions to write float64 or float32 values to the
GDB protocol buffer; we can just use gdb_get_reg64() and
gdb_get_reg32().

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

This patchseries drops the use of the gdb_get_float* and ldf*
functions from the three targets that were using them, and then
removes the now-unused functions from gdbstub.h and bswap.h.

thanks
-- PMM

Peter Maydell (5):
  target/sh4: Drop use of gdb_get_float32() and ldfl_p()
  target/m68k: Drop use of gdb_get_float64() and ldfq_p()
  target/ppc: Drop use of gdb_get_float64() and ldfq_p()
  gdbstub: Remove unused gdb_get_float32() and gdb_get_float64()
  bswap.h: Remove unused float-access functions

 docs/devel/loads-stores.rst     | 14 +++-----
 include/exec/cpu-all.h          |  8 -----
 include/exec/gdbstub.h          | 20 -----------
 include/qemu/bswap.h            | 60 ---------------------------------
 target/m68k/helper.c            |  5 ++-
 target/ppc/gdbstub.c            |  8 ++---
 target/sh4/gdbstub.c            |  8 ++---
 target/ppc/translate_init.c.inc |  4 +--
 8 files changed, 17 insertions(+), 110 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] target/sh4: Drop use of gdb_get_float32() and ldfl_p()
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
@ 2021-02-08 11:34 ` Peter Maydell
  2021-02-08 11:34 ` [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p() Peter Maydell
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2021-02-08 11:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, Laurent Vivier, qemu-ppc,
	Alex Bennée, David Gibson

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_float32()
function to write a float32 value to the GDB protocol buffer; we can
just use gdb_get_reg32().

Similarly, for reading a value out of the GDB buffer into a float32
we can use ldl_p() and need not use ldfl_p().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/sh4/gdbstub.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/sh4/gdbstub.c b/target/sh4/gdbstub.c
index 34ad3ca0508..3488f68e326 100644
--- a/target/sh4/gdbstub.c
+++ b/target/sh4/gdbstub.c
@@ -58,9 +58,9 @@ int superh_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
         return gdb_get_regl(mem_buf, env->fpscr);
     case 25 ... 40:
         if (env->fpscr & FPSCR_FR) {
-            return gdb_get_float32(mem_buf, env->fregs[n - 9]);
+            return gdb_get_reg32(mem_buf, env->fregs[n - 9]);
         }
-        return gdb_get_float32(mem_buf, env->fregs[n - 25]);
+        return gdb_get_reg32(mem_buf, env->fregs[n - 25]);
     case 41:
         return gdb_get_regl(mem_buf, env->ssr);
     case 42:
@@ -119,9 +119,9 @@ int superh_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
         break;
     case 25 ... 40:
         if (env->fpscr & FPSCR_FR) {
-            env->fregs[n - 9] = ldfl_p(mem_buf);
+            env->fregs[n - 9] = ldl_p(mem_buf);
         } else {
-            env->fregs[n - 25] = ldfl_p(mem_buf);
+            env->fregs[n - 25] = ldl_p(mem_buf);
         }
         break;
     case 41:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p()
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
  2021-02-08 11:34 ` [PATCH 1/5] target/sh4: Drop use of gdb_get_float32() and ldfl_p() Peter Maydell
@ 2021-02-08 11:34 ` Peter Maydell
  2021-02-09 19:41   ` Laurent Vivier
  2021-02-08 11:34 ` [PATCH 3/5] target/ppc: " Peter Maydell
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2021-02-08 11:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, Laurent Vivier, qemu-ppc,
	Alex Bennée, David Gibson

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



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] target/ppc: Drop use of gdb_get_float64() and ldfq_p()
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
  2021-02-08 11:34 ` [PATCH 1/5] target/sh4: Drop use of gdb_get_float32() and ldfl_p() Peter Maydell
  2021-02-08 11:34 ` [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p() Peter Maydell
@ 2021-02-08 11:34 ` Peter Maydell
  2021-02-09  5:10   ` David Gibson
  2021-02-08 11:34 ` [PATCH 4/5] gdbstub: Remove unused gdb_get_float32() and gdb_get_float64() Peter Maydell
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2021-02-08 11:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, Laurent Vivier, qemu-ppc,
	Alex Bennée, David Gibson

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/ppc/gdbstub.c            | 8 ++++----
 target/ppc/translate_init.c.inc | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
index 01459dd31d2..c28319fb974 100644
--- a/target/ppc/gdbstub.c
+++ b/target/ppc/gdbstub.c
@@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray *buf, int n)
         gdb_get_regl(buf, env->gpr[n]);
     } else if (n < 64) {
         /* fprs */
-        gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32));
+        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32));
     } else {
         switch (n) {
         case 64:
@@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, GByteArray *buf, int n)
         gdb_get_reg64(buf, env->gpr[n]);
     } else if (n < 64) {
         /* fprs */
-        gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32));
+        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32));
     } else if (n < 96) {
         /* Altivec */
         gdb_get_reg64(buf, n - 64);
@@ -241,7 +241,7 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
         env->gpr[n] = ldtul_p(mem_buf);
     } else if (n < 64) {
         /* fprs */
-        *cpu_fpr_ptr(env, n - 32) = ldfq_p(mem_buf);
+        *cpu_fpr_ptr(env, n - 32) = ldq_p(mem_buf);
     } else {
         switch (n) {
         case 64:
@@ -291,7 +291,7 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint8_t *mem_buf, int n)
         env->gpr[n] = ldq_p(mem_buf);
     } else if (n < 64) {
         /* fprs */
-        *cpu_fpr_ptr(env, n - 32) = ldfq_p(mem_buf);
+        *cpu_fpr_ptr(env, n - 32) = ldq_p(mem_buf);
     } else {
         switch (n) {
         case 64 + 32:
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
index 9867d0a6e4a..7bd111d905e 100644
--- a/target/ppc/translate_init.c.inc
+++ b/target/ppc/translate_init.c.inc
@@ -9907,7 +9907,7 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n)
 {
     uint8_t *mem_buf;
     if (n < 32) {
-        gdb_get_float64(buf, *cpu_fpr_ptr(env, n));
+        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n));
         mem_buf = gdb_get_reg_ptr(buf, 8);
         ppc_maybe_bswap_register(env, mem_buf, 8);
         return 8;
@@ -9925,7 +9925,7 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
 {
     if (n < 32) {
         ppc_maybe_bswap_register(env, mem_buf, 8);
-        *cpu_fpr_ptr(env, n) = ldfq_p(mem_buf);
+        *cpu_fpr_ptr(env, n) = ldq_p(mem_buf);
         return 8;
     }
     if (n == 32) {
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] gdbstub: Remove unused gdb_get_float32() and gdb_get_float64()
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
                   ` (2 preceding siblings ...)
  2021-02-08 11:34 ` [PATCH 3/5] target/ppc: " Peter Maydell
@ 2021-02-08 11:34 ` Peter Maydell
  2021-02-08 11:34 ` [PATCH 5/5] bswap.h: Remove unused float-access functions Peter Maydell
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2021-02-08 11:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, Laurent Vivier, qemu-ppc,
	Alex Bennée, David Gibson

The functions gdb_get_float32() and gdb_get_float64() are now unused;
remove them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/exec/gdbstub.h | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index ff0b7bc45ec..a024a0350df 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -135,26 +135,6 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi,
     return 16;
 }
 
-static inline int gdb_get_float32(GByteArray *array, float32 val)
-{
-    uint8_t buf[sizeof(CPU_FloatU)];
-
-    stfl_p(buf, val);
-    g_byte_array_append(array, buf, sizeof(buf));
-
-    return sizeof(buf);
-}
-
-static inline int gdb_get_float64(GByteArray *array, float64 val)
-{
-    uint8_t buf[sizeof(CPU_DoubleU)];
-
-    stfq_p(buf, val);
-    g_byte_array_append(array, buf, sizeof(buf));
-
-    return sizeof(buf);
-}
-
 static inline int gdb_get_zeroes(GByteArray *array, size_t len)
 {
     guint oldlen = array->len;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] bswap.h: Remove unused float-access functions
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
                   ` (3 preceding siblings ...)
  2021-02-08 11:34 ` [PATCH 4/5] gdbstub: Remove unused gdb_get_float32() and gdb_get_float64() Peter Maydell
@ 2021-02-08 11:34 ` Peter Maydell
  2021-02-08 11:57 ` [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Philippe Mathieu-Daudé
  2021-02-09 20:55 ` Alex Bennée
  6 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2021-02-08 11:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, Laurent Vivier, qemu-ppc,
	Alex Bennée, David Gibson

The float-access functions stfl_*, stfq*, ldfl* and ldfq* are now
unused; remove them.  (Accesses to float64 and float32 types can be
made with the ldl/stl/ldq/stq functions, as float64 and float32 are
guaranteed to be typedefs for normal integer types.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 docs/devel/loads-stores.rst | 14 ++++-----
 include/exec/cpu-all.h      |  8 -----
 include/qemu/bswap.h        | 60 -------------------------------------
 3 files changed, 5 insertions(+), 77 deletions(-)

diff --git a/docs/devel/loads-stores.rst b/docs/devel/loads-stores.rst
index ee43f5dfee2..568274baec0 100644
--- a/docs/devel/loads-stores.rst
+++ b/docs/devel/loads-stores.rst
@@ -24,16 +24,12 @@ potentially unaligned pointer values.
 
 Function names follow the pattern:
 
-load: ``ld{type}{sign}{size}_{endian}_p(ptr)``
+load: ``ld{sign}{size}_{endian}_p(ptr)``
 
-store: ``st{type}{size}_{endian}_p(ptr, val)``
-
-``type``
- - (empty) : integer access
- - ``f`` : float access
+store: ``st{size}_{endian}_p(ptr, val)``
 
 ``sign``
- - (empty) : for 32 or 64 bit sizes (including floats and doubles)
+ - (empty) : for 32 or 64 bit sizes
  - ``u`` : unsigned
  - ``s`` : signed
 
@@ -67,8 +63,8 @@ of size ``sz`` bytes.
 
 
 Regexes for git grep
- - ``\<ldf\?[us]\?[bwlq]\(_[hbl]e\)\?_p\>``
- - ``\<stf\?[bwlq]\(_[hbl]e\)\?_p\>``
+ - ``\<ld[us]\?[bwlq]\(_[hbl]e\)\?_p\>``
+ - ``\<st[bwlq]\(_[hbl]e\)\?_p\>``
  - ``\<ldn_\([hbl]e\)?_p\>``
  - ``\<stn_\([hbl]e\)?_p\>``
 
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index cfb1d793311..babf0a8959f 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -125,13 +125,9 @@ static inline void tswap64s(uint64_t *s)
 #define ldsw_p(p) ldsw_be_p(p)
 #define ldl_p(p) ldl_be_p(p)
 #define ldq_p(p) ldq_be_p(p)
-#define ldfl_p(p) ldfl_be_p(p)
-#define ldfq_p(p) ldfq_be_p(p)
 #define stw_p(p, v) stw_be_p(p, v)
 #define stl_p(p, v) stl_be_p(p, v)
 #define stq_p(p, v) stq_be_p(p, v)
-#define stfl_p(p, v) stfl_be_p(p, v)
-#define stfq_p(p, v) stfq_be_p(p, v)
 #define ldn_p(p, sz) ldn_be_p(p, sz)
 #define stn_p(p, sz, v) stn_be_p(p, sz, v)
 #else
@@ -139,13 +135,9 @@ static inline void tswap64s(uint64_t *s)
 #define ldsw_p(p) ldsw_le_p(p)
 #define ldl_p(p) ldl_le_p(p)
 #define ldq_p(p) ldq_le_p(p)
-#define ldfl_p(p) ldfl_le_p(p)
-#define ldfq_p(p) ldfq_le_p(p)
 #define stw_p(p, v) stw_le_p(p, v)
 #define stl_p(p, v) stl_le_p(p, v)
 #define stq_p(p, v) stq_le_p(p, v)
-#define stfl_p(p, v) stfl_le_p(p, v)
-#define stfq_p(p, v) stfq_le_p(p, v)
 #define ldn_p(p, sz) ldn_le_p(p, sz)
 #define stn_p(p, sz, v) stn_le_p(p, sz, v)
 #endif
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index 8b01c38040c..4aaf992b5d7 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -400,36 +400,6 @@ static inline void stq_le_p(void *ptr, uint64_t v)
     stq_he_p(ptr, le_bswap(v, 64));
 }
 
-/* float access */
-
-static inline float32 ldfl_le_p(const void *ptr)
-{
-    CPU_FloatU u;
-    u.l = ldl_le_p(ptr);
-    return u.f;
-}
-
-static inline void stfl_le_p(void *ptr, float32 v)
-{
-    CPU_FloatU u;
-    u.f = v;
-    stl_le_p(ptr, u.l);
-}
-
-static inline float64 ldfq_le_p(const void *ptr)
-{
-    CPU_DoubleU u;
-    u.ll = ldq_le_p(ptr);
-    return u.d;
-}
-
-static inline void stfq_le_p(void *ptr, float64 v)
-{
-    CPU_DoubleU u;
-    u.d = v;
-    stq_le_p(ptr, u.ll);
-}
-
 static inline int lduw_be_p(const void *ptr)
 {
     return (uint16_t)be_bswap(lduw_he_p(ptr), 16);
@@ -465,36 +435,6 @@ static inline void stq_be_p(void *ptr, uint64_t v)
     stq_he_p(ptr, be_bswap(v, 64));
 }
 
-/* float access */
-
-static inline float32 ldfl_be_p(const void *ptr)
-{
-    CPU_FloatU u;
-    u.l = ldl_be_p(ptr);
-    return u.f;
-}
-
-static inline void stfl_be_p(void *ptr, float32 v)
-{
-    CPU_FloatU u;
-    u.f = v;
-    stl_be_p(ptr, u.l);
-}
-
-static inline float64 ldfq_be_p(const void *ptr)
-{
-    CPU_DoubleU u;
-    u.ll = ldq_be_p(ptr);
-    return u.d;
-}
-
-static inline void stfq_be_p(void *ptr, float64 v)
-{
-    CPU_DoubleU u;
-    u.d = v;
-    stq_be_p(ptr, u.ll);
-}
-
 static inline unsigned long leul_to_cpu(unsigned long v)
 {
 #if HOST_LONG_BITS == 32
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
                   ` (4 preceding siblings ...)
  2021-02-08 11:34 ` [PATCH 5/5] bswap.h: Remove unused float-access functions Peter Maydell
@ 2021-02-08 11:57 ` Philippe Mathieu-Daudé
  2021-02-09 20:55 ` Alex Bennée
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-08 11:57 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Yoshinori Sato, Richard Henderson, Greg Kurz, Laurent Vivier,
	qemu-ppc, Alex Bennée, David Gibson

On 2/8/21 12:34 PM, Peter Maydell wrote:
> 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 special gdb_get_float64() and
> gdb_get_float32() functions to write float64 or float32 values to the
> GDB protocol buffer; we can just use gdb_get_reg64() and
> gdb_get_reg32().
> 
> Similarly, for reading a value out of the GDB buffer into a float64
> or float32 we can use ldq_p() or ldl_p() and need not use ldfq_p()
> or ldfl_p().
> 
> This patchseries drops the use of the gdb_get_float* and ldf*
> functions from the three targets that were using them, and then
> removes the now-unused functions from gdbstub.h and bswap.h.
> 
> thanks
> -- PMM
> 
> Peter Maydell (5):
>   target/sh4: Drop use of gdb_get_float32() and ldfl_p()
>   target/m68k: Drop use of gdb_get_float64() and ldfq_p()
>   target/ppc: Drop use of gdb_get_float64() and ldfq_p()
>   gdbstub: Remove unused gdb_get_float32() and gdb_get_float64()
>   bswap.h: Remove unused float-access functions
> 
>  docs/devel/loads-stores.rst     | 14 +++-----
>  include/exec/cpu-all.h          |  8 -----
>  include/exec/gdbstub.h          | 20 -----------
>  include/qemu/bswap.h            | 60 ---------------------------------
>  target/m68k/helper.c            |  5 ++-
>  target/ppc/gdbstub.c            |  8 ++---
>  target/sh4/gdbstub.c            |  8 ++---
>  target/ppc/translate_init.c.inc |  4 +--
>  8 files changed, 17 insertions(+), 110 deletions(-)

Series:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Thanks for the cleanup!



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] target/ppc: Drop use of gdb_get_float64() and ldfq_p()
  2021-02-08 11:34 ` [PATCH 3/5] target/ppc: " Peter Maydell
@ 2021-02-09  5:10   ` David Gibson
  0 siblings, 0 replies; 10+ messages in thread
From: David Gibson @ 2021-02-09  5:10 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, qemu-devel, qemu-ppc,
	Alex Bennée, Laurent Vivier

[-- Attachment #1: Type: text/plain, Size: 3813 bytes --]

On Mon, Feb 08, 2021 at 11:34:26AM +0000, Peter Maydell wrote:
> 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>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/gdbstub.c            | 8 ++++----
>  target/ppc/translate_init.c.inc | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
> index 01459dd31d2..c28319fb974 100644
> --- a/target/ppc/gdbstub.c
> +++ b/target/ppc/gdbstub.c
> @@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray *buf, int n)
>          gdb_get_regl(buf, env->gpr[n]);
>      } else if (n < 64) {
>          /* fprs */
> -        gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32));
> +        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32));
>      } else {
>          switch (n) {
>          case 64:
> @@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, GByteArray *buf, int n)
>          gdb_get_reg64(buf, env->gpr[n]);
>      } else if (n < 64) {
>          /* fprs */
> -        gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32));
> +        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32));
>      } else if (n < 96) {
>          /* Altivec */
>          gdb_get_reg64(buf, n - 64);
> @@ -241,7 +241,7 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>          env->gpr[n] = ldtul_p(mem_buf);
>      } else if (n < 64) {
>          /* fprs */
> -        *cpu_fpr_ptr(env, n - 32) = ldfq_p(mem_buf);
> +        *cpu_fpr_ptr(env, n - 32) = ldq_p(mem_buf);
>      } else {
>          switch (n) {
>          case 64:
> @@ -291,7 +291,7 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint8_t *mem_buf, int n)
>          env->gpr[n] = ldq_p(mem_buf);
>      } else if (n < 64) {
>          /* fprs */
> -        *cpu_fpr_ptr(env, n - 32) = ldfq_p(mem_buf);
> +        *cpu_fpr_ptr(env, n - 32) = ldq_p(mem_buf);
>      } else {
>          switch (n) {
>          case 64 + 32:
> diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
> index 9867d0a6e4a..7bd111d905e 100644
> --- a/target/ppc/translate_init.c.inc
> +++ b/target/ppc/translate_init.c.inc
> @@ -9907,7 +9907,7 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n)
>  {
>      uint8_t *mem_buf;
>      if (n < 32) {
> -        gdb_get_float64(buf, *cpu_fpr_ptr(env, n));
> +        gdb_get_reg64(buf, *cpu_fpr_ptr(env, n));
>          mem_buf = gdb_get_reg_ptr(buf, 8);
>          ppc_maybe_bswap_register(env, mem_buf, 8);
>          return 8;
> @@ -9925,7 +9925,7 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
>  {
>      if (n < 32) {
>          ppc_maybe_bswap_register(env, mem_buf, 8);
> -        *cpu_fpr_ptr(env, n) = ldfq_p(mem_buf);
> +        *cpu_fpr_ptr(env, n) = ldq_p(mem_buf);
>          return 8;
>      }
>      if (n == 32) {

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p()
  2021-02-08 11:34 ` [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p() Peter Maydell
@ 2021-02-09 19:41   ` Laurent Vivier
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-02-09 19:41 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Yoshinori Sato, Philippe Mathieu-Daudé,
	Richard Henderson, Greg Kurz, qemu-ppc, Alex Bennée,
	David Gibson

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>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code
  2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
                   ` (5 preceding siblings ...)
  2021-02-08 11:57 ` [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Philippe Mathieu-Daudé
@ 2021-02-09 20:55 ` Alex Bennée
  6 siblings, 0 replies; 10+ messages in thread
From: Alex Bennée @ 2021-02-09 20:55 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Laurent Vivier, Yoshinori Sato, Richard Henderson, Greg Kurz,
	qemu-devel, qemu-ppc, Philippe Mathieu-Daudé,
	David Gibson


Peter Maydell <peter.maydell@linaro.org> writes:

> 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 special gdb_get_float64() and
> gdb_get_float32() functions to write float64 or float32 values to the
> GDB protocol buffer; we can just use gdb_get_reg64() and
> gdb_get_reg32().
>
> Similarly, for reading a value out of the GDB buffer into a float64
> or float32 we can use ldq_p() or ldl_p() and need not use ldfq_p()
> or ldfl_p().
>
> This patchseries drops the use of the gdb_get_float* and ldf*
> functions from the three targets that were using them, and then
> removes the now-unused functions from gdbstub.h and bswap.h.

Queued to gdbstub/next, thanks.

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-09 20:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 11:34 [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Peter Maydell
2021-02-08 11:34 ` [PATCH 1/5] target/sh4: Drop use of gdb_get_float32() and ldfl_p() Peter Maydell
2021-02-08 11:34 ` [PATCH 2/5] target/m68k: Drop use of gdb_get_float64() and ldfq_p() Peter Maydell
2021-02-09 19:41   ` Laurent Vivier
2021-02-08 11:34 ` [PATCH 3/5] target/ppc: " Peter Maydell
2021-02-09  5:10   ` David Gibson
2021-02-08 11:34 ` [PATCH 4/5] gdbstub: Remove unused gdb_get_float32() and gdb_get_float64() Peter Maydell
2021-02-08 11:34 ` [PATCH 5/5] bswap.h: Remove unused float-access functions Peter Maydell
2021-02-08 11:57 ` [PATCH 0/5] Drop float32/float64 accessors used by gdbstub code Philippe Mathieu-Daudé
2021-02-09 20:55 ` Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.