Move CPU softfloat unions to cpu-float.h

The types are no longer used in bswap.h since commit
f930224fff ("bswap.h: Remove unused float-access functions"), there
isn't much sense in keeping it there and having a dependency on fpu/.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220323155743.1585078-29-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-03-23 19:57:39 +04:00 committed by Paolo Bonzini
parent 4e40e89325
commit 69242e7e7e
18 changed files with 80 additions and 62 deletions

View File

@ -19,8 +19,6 @@
extern "C" { extern "C" {
#endif #endif
#include "fpu/softfloat-types.h"
#ifdef BSWAP_FROM_BYTESWAP #ifdef BSWAP_FROM_BYTESWAP
static inline uint16_t bswap16(uint16_t x) static inline uint16_t bswap16(uint16_t x)
{ {
@ -202,64 +200,6 @@ CPU_CONVERT(le, 64, uint64_t)
# define const_le16(_x) (_x) # define const_le16(_x) (_x)
#endif #endif
/* Unions for reinterpreting between floats and integers. */
typedef union {
float32 f;
uint32_t l;
} CPU_FloatU;
typedef union {
float64 d;
#if HOST_BIG_ENDIAN
struct {
uint32_t upper;
uint32_t lower;
} l;
#else
struct {
uint32_t lower;
uint32_t upper;
} l;
#endif
uint64_t ll;
} CPU_DoubleU;
typedef union {
floatx80 d;
struct {
uint64_t lower;
uint16_t upper;
} l;
} CPU_LDoubleU;
typedef union {
float128 q;
#if HOST_BIG_ENDIAN
struct {
uint32_t upmost;
uint32_t upper;
uint32_t lower;
uint32_t lowest;
} l;
struct {
uint64_t upper;
uint64_t lower;
} ll;
#else
struct {
uint32_t lowest;
uint32_t lower;
uint32_t upper;
uint32_t upmost;
} l;
struct {
uint64_t lower;
uint64_t upper;
} ll;
#endif
} CPU_QuadU;
/* unaligned/endian-independent pointer access */ /* unaligned/endian-independent pointer access */
/* /*

64
include/qemu/cpu-float.h Normal file
View File

@ -0,0 +1,64 @@
#ifndef QEMU_CPU_FLOAT_H_
#define QEMU_CPU_FLOAT_H_
#include "fpu/softfloat-types.h"
/* Unions for reinterpreting between floats and integers. */
typedef union {
float32 f;
uint32_t l;
} CPU_FloatU;
typedef union {
float64 d;
#if HOST_BIG_ENDIAN
struct {
uint32_t upper;
uint32_t lower;
} l;
#else
struct {
uint32_t lower;
uint32_t upper;
} l;
#endif
uint64_t ll;
} CPU_DoubleU;
typedef union {
floatx80 d;
struct {
uint64_t lower;
uint16_t upper;
} l;
} CPU_LDoubleU;
typedef union {
float128 q;
#if HOST_BIG_ENDIAN
struct {
uint32_t upmost;
uint32_t upper;
uint32_t lower;
uint32_t lowest;
} l;
struct {
uint64_t upper;
uint64_t lower;
} ll;
#else
struct {
uint32_t lowest;
uint32_t lower;
uint32_t upper;
uint32_t upmost;
} l;
struct {
uint64_t lower;
uint64_t upper;
} ll;
#endif
} CPU_QuadU;
#endif /* QEMU_CPU_FLOAT_H_ */

View File

@ -11,6 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/cpu-float.h"
#include "qemu-file.h" #include "qemu-file.h"
#include "migration.h" #include "migration.h"
#include "migration/vmstate.h" #include "migration/vmstate.h"

View File

@ -22,6 +22,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
/* Alpha processors have a weak memory model */ /* Alpha processors have a weak memory model */
#define TCG_GUEST_DEFAULT_MO (0) #define TCG_GUEST_DEFAULT_MO (0)

View File

@ -21,6 +21,7 @@
#define ARM_CPU_H #define ARM_CPU_H
#include "kvm-consts.h" #include "kvm-consts.h"
#include "qemu/cpu-float.h"
#include "hw/registerfields.h" #include "hw/registerfields.h"
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"

View File

@ -22,6 +22,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
/* PA-RISC 1.x processors have a strong memory model. */ /* PA-RISC 1.x processors have a strong memory model. */
/* ??? While we do not yet implement PA-RISC 2.0, those processors have /* ??? While we do not yet implement PA-RISC 2.0, those processors have

View File

@ -25,6 +25,7 @@
#include "kvm/hyperv-proto.h" #include "kvm/hyperv-proto.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qapi/qapi-types-common.h" #include "qapi/qapi-types-common.h"
#include "qemu/cpu-float.h"
/* The x86 has a strong memory model with some store-after-load re-ordering */ /* The x86 has a strong memory model with some store-after-load re-ordering */
#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) #define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)

View File

@ -22,6 +22,7 @@
#define M68K_CPU_H #define M68K_CPU_H
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
#include "cpu-qom.h" #include "cpu-qom.h"
#define OS_BYTE 0 #define OS_BYTE 0

View File

@ -22,7 +22,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "fpu/softfloat-types.h" #include "qemu/cpu-float.h"
typedef struct CPUArchState CPUMBState; typedef struct CPUArchState CPUMBState;
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)

View File

@ -21,6 +21,7 @@
#define OPENRISC_CPU_H #define OPENRISC_CPU_H
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "fpu/softfloat-types.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "qom/object.h" #include "qom/object.h"

View File

@ -21,6 +21,7 @@
#define PPC_CPU_H #define PPC_CPU_H
#include "qemu/int128.h" #include "qemu/int128.h"
#include "qemu/cpu-float.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "cpu-qom.h" #include "cpu-qom.h"
#include "qom/object.h" #include "qom/object.h"

View File

@ -23,7 +23,7 @@
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "hw/registerfields.h" #include "hw/registerfields.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "fpu/softfloat-types.h" #include "qemu/cpu-float.h"
#include "qom/object.h" #include "qom/object.h"
#include "qemu/int128.h" #include "qemu/int128.h"
#include "cpu_bits.h" #include "cpu_bits.h"

View File

@ -24,6 +24,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
/* PSW define */ /* PSW define */
REG32(PSW, 0) REG32(PSW, 0)

View File

@ -28,6 +28,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "cpu_models.h" #include "cpu_models.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
#define ELF_MACHINE_UNAME "S390X" #define ELF_MACHINE_UNAME "S390X"

View File

@ -22,6 +22,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
/* CPU Subtypes */ /* CPU Subtypes */
#define SH_CPU_SH7750 (1 << 0) #define SH_CPU_SH7750 (1 << 0)

View File

@ -4,6 +4,7 @@
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
#if !defined(TARGET_SPARC64) #if !defined(TARGET_SPARC64)
#define TARGET_DPREGS 16 #define TARGET_DPREGS 16

View File

@ -22,6 +22,7 @@
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
#include "tricore-defs.h" #include "tricore-defs.h"
struct tricore_boot_info; struct tricore_boot_info;

View File

@ -29,6 +29,7 @@
#define XTENSA_CPU_H #define XTENSA_CPU_H
#include "cpu-qom.h" #include "cpu-qom.h"
#include "qemu/cpu-float.h"
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "xtensa-isa.h" #include "xtensa-isa.h"