Skip to content

Commit

Permalink
Move CPU softfloat unions to cpu-float.h
Browse files Browse the repository at this point in the history
The types are no longer used in bswap.h since commit
f930224 ("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>
  • Loading branch information
elmarco authored and bonzini committed Apr 6, 2022
1 parent 4e40e89 commit 69242e7
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 62 deletions.
60 changes: 0 additions & 60 deletions include/qemu/bswap.h
Expand Up @@ -19,8 +19,6 @@
extern "C" {
#endif

#include "fpu/softfloat-types.h"

#ifdef BSWAP_FROM_BYTESWAP
static inline uint16_t bswap16(uint16_t x)
{
Expand Down Expand Up @@ -202,64 +200,6 @@ CPU_CONVERT(le, 64, uint64_t)
# define const_le16(_x) (_x)
#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 */

/*
Expand Down
64 changes: 64 additions & 0 deletions include/qemu/cpu-float.h
@@ -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_ */
1 change: 1 addition & 0 deletions migration/vmstate-types.c
Expand Up @@ -11,6 +11,7 @@
*/

#include "qemu/osdep.h"
#include "qemu/cpu-float.h"
#include "qemu-file.h"
#include "migration.h"
#include "migration/vmstate.h"
Expand Down
1 change: 1 addition & 0 deletions target/alpha/cpu.h
Expand Up @@ -22,6 +22,7 @@

#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"

/* Alpha processors have a weak memory model */
#define TCG_GUEST_DEFAULT_MO (0)
Expand Down
1 change: 1 addition & 0 deletions target/arm/cpu.h
Expand Up @@ -21,6 +21,7 @@
#define ARM_CPU_H

#include "kvm-consts.h"
#include "qemu/cpu-float.h"
#include "hw/registerfields.h"
#include "cpu-qom.h"
#include "exec/cpu-defs.h"
Expand Down
1 change: 1 addition & 0 deletions target/hppa/cpu.h
Expand Up @@ -22,6 +22,7 @@

#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"

/* PA-RISC 1.x processors have a strong memory model. */
/* ??? While we do not yet implement PA-RISC 2.0, those processors have
Expand Down
1 change: 1 addition & 0 deletions target/i386/cpu.h
Expand Up @@ -25,6 +25,7 @@
#include "kvm/hyperv-proto.h"
#include "exec/cpu-defs.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 */
#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)
Expand Down
1 change: 1 addition & 0 deletions target/m68k/cpu.h
Expand Up @@ -22,6 +22,7 @@
#define M68K_CPU_H

#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
#include "cpu-qom.h"

#define OS_BYTE 0
Expand Down
2 changes: 1 addition & 1 deletion target/microblaze/cpu.h
Expand Up @@ -22,7 +22,7 @@

#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "fpu/softfloat-types.h"
#include "qemu/cpu-float.h"

typedef struct CPUArchState CPUMBState;
#if !defined(CONFIG_USER_ONLY)
Expand Down
1 change: 1 addition & 0 deletions target/openrisc/cpu.h
Expand Up @@ -21,6 +21,7 @@
#define OPENRISC_CPU_H

#include "exec/cpu-defs.h"
#include "fpu/softfloat-types.h"
#include "hw/core/cpu.h"
#include "qom/object.h"

Expand Down
1 change: 1 addition & 0 deletions target/ppc/cpu.h
Expand Up @@ -21,6 +21,7 @@
#define PPC_CPU_H

#include "qemu/int128.h"
#include "qemu/cpu-float.h"
#include "exec/cpu-defs.h"
#include "cpu-qom.h"
#include "qom/object.h"
Expand Down
2 changes: 1 addition & 1 deletion target/riscv/cpu.h
Expand Up @@ -23,7 +23,7 @@
#include "hw/core/cpu.h"
#include "hw/registerfields.h"
#include "exec/cpu-defs.h"
#include "fpu/softfloat-types.h"
#include "qemu/cpu-float.h"
#include "qom/object.h"
#include "qemu/int128.h"
#include "cpu_bits.h"
Expand Down
1 change: 1 addition & 0 deletions target/rx/cpu.h
Expand Up @@ -24,6 +24,7 @@
#include "cpu-qom.h"

#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"

/* PSW define */
REG32(PSW, 0)
Expand Down
1 change: 1 addition & 0 deletions target/s390x/cpu.h
Expand Up @@ -28,6 +28,7 @@
#include "cpu-qom.h"
#include "cpu_models.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"

#define ELF_MACHINE_UNAME "S390X"

Expand Down
1 change: 1 addition & 0 deletions target/sh4/cpu.h
Expand Up @@ -22,6 +22,7 @@

#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"

/* CPU Subtypes */
#define SH_CPU_SH7750 (1 << 0)
Expand Down
1 change: 1 addition & 0 deletions target/sparc/cpu.h
Expand Up @@ -4,6 +4,7 @@
#include "qemu/bswap.h"
#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"

#if !defined(TARGET_SPARC64)
#define TARGET_DPREGS 16
Expand Down
1 change: 1 addition & 0 deletions target/tricore/cpu.h
Expand Up @@ -22,6 +22,7 @@

#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
#include "tricore-defs.h"

struct tricore_boot_info;
Expand Down
1 change: 1 addition & 0 deletions target/xtensa/cpu.h
Expand Up @@ -29,6 +29,7 @@
#define XTENSA_CPU_H

#include "cpu-qom.h"
#include "qemu/cpu-float.h"
#include "exec/cpu-defs.h"
#include "xtensa-isa.h"

Expand Down

0 comments on commit 69242e7

Please sign in to comment.