[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 13/25] qemu/bswap: Use LDST_CONVERT macro to emit 64-bit load
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 13/25] qemu/bswap: Use LDST_CONVERT macro to emit 64-bit load/store functions |
Date: |
Tue, 18 May 2021 20:36:43 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/qemu/bswap.h | 33 +--------------------------------
1 file changed, 1 insertion(+), 32 deletions(-)
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index a041be94a7a..4cd120ca014 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -336,38 +336,6 @@ static inline void stb_p(void *ptr, uint8_t v)
* of good performance.
*/
-static inline uint64_t ldq_he_p(const void *ptr)
-{
- uint64_t r;
- __builtin_memcpy(&r, ptr, sizeof(r));
- return r;
-}
-
-static inline void stq_he_p(void *ptr, uint64_t v)
-{
- __builtin_memcpy(ptr, &v, sizeof(v));
-}
-
-static inline uint64_t ldq_le_p(const void *ptr)
-{
- return le_bswap(ldq_he_p(ptr), 64);
-}
-
-static inline void stq_le_p(void *ptr, uint64_t v)
-{
- stq_he_p(ptr, le_bswap(v, 64));
-}
-
-static inline uint64_t ldq_be_p(const void *ptr)
-{
- return be_bswap(ldq_he_p(ptr), 64);
-}
-
-static inline void stq_be_p(void *ptr, uint64_t v)
-{
- stq_he_p(ptr, be_bswap(v, 64));
-}
-
#define LD_CONVERT_UNALIGNED(bits, rtype, vtype, size)\
static inline rtype ld ## size ## _he_p(const void *ptr)\
{\
@@ -412,6 +380,7 @@ ST_CONVERT(16, uint16_t, w)
LD_CONVERT(16, int, int16_t, sw)
LD_CONVERT(16, int, uint16_t, uw)
LDST_CONVERT(32, int, uint32_t, l)
+LDST_CONVERT(64, uint64_t, uint64_t, q)
static inline unsigned long leul_to_cpu(unsigned long v)
{
--
2.26.3
- [RFC PATCH 05/25] exec/memory_ldst_cached: Use correct type size, (continued)
- [RFC PATCH 05/25] exec/memory_ldst_cached: Use correct type size, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 06/25] exec/memory: Use correct type size, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 08/25] qemu/bswap: Use ST_CONVERT() macro to emit 16-bit load/store functions, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 07/25] qemu/bswap: Introduce ST_CONVERT() macro, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 09/25] qemu/bswap: Introduce LD_CONVERT() macro, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 10/25] qemu/bswap: Use LD_CONVERT macro to emit 16-bit signed load/store code, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 11/25] qemu/bswap: Use LD_CONVERT macro to emit 16-bit unsigned load/store code, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 12/25] qemu/bswap: Use LDST_CONVERT macro to emit 32-bit load/store functions, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 13/25] qemu/bswap: Use LDST_CONVERT macro to emit 64-bit load/store functions,
Philippe Mathieu-Daudé <=
- [RFC PATCH 14/25] qemu/bswap: Introduce load/store for aligned pointer, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 16/25] exec/memory: Add methods for aligned pointer access (physical memory), Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 15/25] exec/memory: Add methods for aligned pointer access (address space), Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 17/25] hw/virtio: Use correct type sizes, Philippe Mathieu-Daudé, 2021/05/18
- [RFC PATCH 18/25] hw/virtio: Introduce VIRTIO_LD_CONVERT() macro, Philippe Mathieu-Daudé, 2021/05/18