Skip to content

Commit

Permalink
PPC: e500: Merge 32 and 64 bit SPE emulation
Browse files Browse the repository at this point in the history
Today we have a lot of conditional code in the SPE emulation depending on
whether we have 64bit GPRs or not.

Unfortunately the assumption that we can just recycle the 64bit GPR
implementation is wrong. Normal SPE implementations maintain the upper 32 bits
on all non-SPE instructions which then only modify the low 32 bits. However
all instructions we model that adhere to the normal SF based switching don't
care whether they operate on 32 or 64 bit registers and just always use the full
64 bits.

So let's remove that dubious SPE optimization and revert everything to the same
code path the 32bit target code was taking. That way we get rid of differences
between the two implementations, but will get a slight performance hit when
emulating SPE instructions.

This fixes SPE emulation with qemu-system-ppc64 for me.

Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
agraf committed Jun 16, 2014
1 parent f7d6914 commit 13b6a45
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 583 deletions.
4 changes: 0 additions & 4 deletions target-ppc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,8 @@ struct CPUPPCState {
*/
/* general purpose registers */
target_ulong gpr[32];
#if !defined(TARGET_PPC64)
/* Storage for GPR MSB, used by the SPE extension */
target_ulong gprh[32];
#endif
/* LR */
target_ulong lr;
/* CTR */
Expand Down Expand Up @@ -1164,15 +1162,13 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)
uint64_t gprv;

gprv = env->gpr[gprn];
#if !defined(TARGET_PPC64)
if (env->flags & POWERPC_FLAG_SPE) {
/* If the CPU implements the SPE extension, we have to get the
* high bits of the GPR from the gprh storage area
*/
gprv &= 0xFFFFFFFFULL;
gprv |= (uint64_t)env->gprh[gprn] << 32;
}
#endif

return gprv;
}
Expand Down
Loading

0 comments on commit 13b6a45

Please sign in to comment.