[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 20/67] target-ppc: move ppc_vsr_t to common header
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 20/67] target-ppc: move ppc_vsr_t to common header |
Date: |
Thu, 12 Jan 2017 13:02:40 +1100 |
From: Nikunj A Dadhania <address@hidden>
The structure and corresponding defines and functions need to be used
outside of fpu_helper.c as well.
Add u8, u16, u32 and Int128 to the structure.
Signed-off-by: Nikunj A Dadhania <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/fpu_helper.c | 37 -------------------------------------
target/ppc/internal.h | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 37 deletions(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 696f537..3b867cf 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -1777,43 +1777,6 @@ uint32_t helper_efdcmpeq(CPUPPCState *env, uint64_t op1,
uint64_t op2)
return helper_efdtsteq(env, op1, op2);
}
-typedef union _ppc_vsr_t {
- uint64_t u64[2];
- uint32_t u32[4];
- float32 f32[4];
- float64 f64[2];
-} ppc_vsr_t;
-
-#if defined(HOST_WORDS_BIGENDIAN)
-#define VsrW(i) u32[i]
-#define VsrD(i) u64[i]
-#else
-#define VsrW(i) u32[3-(i)]
-#define VsrD(i) u64[1-(i)]
-#endif
-
-static void getVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env)
-{
- if (n < 32) {
- vsr->VsrD(0) = env->fpr[n];
- vsr->VsrD(1) = env->vsr[n];
- } else {
- vsr->u64[0] = env->avr[n-32].u64[0];
- vsr->u64[1] = env->avr[n-32].u64[1];
- }
-}
-
-static void putVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env)
-{
- if (n < 32) {
- env->fpr[n] = vsr->VsrD(0);
- env->vsr[n] = vsr->VsrD(1);
- } else {
- env->avr[n-32].u64[0] = vsr->u64[0];
- env->avr[n-32].u64[1] = vsr->u64[1];
- }
-}
-
#define float64_to_float64(x, env) x
diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index e83ea45..66cde46 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -199,4 +199,46 @@ EXTRACT_HELPER(SHW, 8, 2);
EXTRACT_HELPER(SP, 19, 2);
EXTRACT_HELPER(IMM8, 11, 8);
+typedef union _ppc_vsr_t {
+ uint8_t u8[16];
+ uint16_t u16[8];
+ uint32_t u32[4];
+ uint64_t u64[2];
+ float32 f32[4];
+ float64 f64[2];
+ Int128 s128;
+} ppc_vsr_t;
+
+#if defined(HOST_WORDS_BIGENDIAN)
+#define VsrB(i) u8[i]
+#define VsrW(i) u32[i]
+#define VsrD(i) u64[i]
+#else
+#define VsrB(i) u8[15 - (i)]
+#define VsrW(i) u32[3 - (i)]
+#define VsrD(i) u64[1 - (i)]
+#endif
+
+static inline void getVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env)
+{
+ if (n < 32) {
+ vsr->VsrD(0) = env->fpr[n];
+ vsr->VsrD(1) = env->vsr[n];
+ } else {
+ vsr->u64[0] = env->avr[n - 32].u64[0];
+ vsr->u64[1] = env->avr[n - 32].u64[1];
+ }
+}
+
+static inline void putVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env)
+{
+ if (n < 32) {
+ env->fpr[n] = vsr->VsrD(0);
+ env->vsr[n] = vsr->VsrD(1);
+ } else {
+ env->avr[n - 32].u64[0] = vsr->u64[0];
+ env->avr[n - 32].u64[1] = vsr->u64[1];
+ }
+}
+
#endif /* PPC_INTERNAL_H */
--
2.9.3
- [Qemu-ppc] [PULL 16/67] pseries: Make cpu_update during CAS unconditional, (continued)
- [Qemu-ppc] [PULL 16/67] pseries: Make cpu_update during CAS unconditional, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 21/67] target-ppc: implement stop instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 22/67] target-ppc: implement xsabsqp/xsnabsqp instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 14/67] target-ppc: add vextu[bhw][lr]x instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 38/67] qtest: add display-vga-test to ppc64, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 35/67] ppc: Rewrite ppc_get_compat_smt_threads(), David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 36/67] ppc: Validate compatibility modes when setting, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 47/67] target-ppc: Add xxinsertw instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 60/67] pxb: Restrict to x86, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 18/67] ppc: Rename cpu_version to compat_pvr, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 20/67] target-ppc: move ppc_vsr_t to common header,
David Gibson <=
- [Qemu-ppc] [PULL 29/67] target-ppc: implement stxvl instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 45/67] hw/ppc: QOM'ify spapr_vio.c, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 32/67] prep: do not use global variable to access nvram, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 40/67] qtest: convert ivshmem-test to use libqos, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 41/67] qtest: add ivshmem-test for ppc64, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 19/67] ppc/spapr: implement H_SIGNAL_SYS_RESET, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 30/67] target-ppc: implement stxvll instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 26/67] target-ppc: Add xxperm and xxpermr instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 46/67] target-ppc: Add xxextractuw instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 67/67] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro, David Gibson, 2017/01/11