From e909ec2f11550804d1a6c16ffa0e50acc4c1c077 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Wed, 17 Oct 2007 17:37:13 +0000 Subject: [PATCH] Use ldq and stq for 8 byte accesses (original patch by Robert Reif) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3405 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-sparc/op_helper.c | 43 ++++++++++++++++++++-------------------- target-sparc/op_mem.h | 12 +++++++---- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index da4c18d2d0..ab456e30c3 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -170,6 +170,7 @@ static void dump_mxcc(CPUState *env) void helper_ld_asi(int asi, int size, int sign) { uint32_t ret = 0; + uint64_t tmp; #ifdef DEBUG_MXCC uint32_t last_T0 = T0; #endif @@ -244,8 +245,9 @@ void helper_ld_asi(int asi, int size, int sign) ret = ldl_code(T0 & ~3); break; case 8: - ret = ldl_code(T0 & ~3); - T0 = ldl_code((T0 + 4) & ~3); + tmp = ldq_code(T0 & ~7); + ret = tmp >> 32; + T0 = tmp & 0xffffffff; break; } break; @@ -262,8 +264,9 @@ void helper_ld_asi(int asi, int size, int sign) ret = ldl_user(T0 & ~3); break; case 8: - ret = ldl_user(T0 & ~3); - T0 = ldl_user((T0 + 4) & ~3); + tmp = ldq_user(T0 & ~7); + ret = tmp >> 32; + T0 = tmp & 0xffffffff; break; } break; @@ -280,8 +283,9 @@ void helper_ld_asi(int asi, int size, int sign) ret = ldl_kernel(T0 & ~3); break; case 8: - ret = ldl_kernel(T0 & ~3); - T0 = ldl_kernel((T0 + 4) & ~3); + tmp = ldq_kernel(T0 & ~7); + ret = tmp >> 32; + T0 = tmp & 0xffffffff; break; } break; @@ -303,8 +307,9 @@ void helper_ld_asi(int asi, int size, int sign) ret = ldl_phys(T0 & ~3); break; case 8: - ret = ldl_phys(T0 & ~3); - T0 = ldl_phys((T0 + 4) & ~3); + tmp = ldq_phys(T0 & ~7); + ret = tmp >> 32; + T0 = tmp & 0xffffffff; break; } break; @@ -325,10 +330,10 @@ void helper_ld_asi(int asi, int size, int sign) | ((target_phys_addr_t)(asi & 0xf) << 32)); break; case 8: - ret = ldl_phys((target_phys_addr_t)(T0 & ~3) - | ((target_phys_addr_t)(asi & 0xf) << 32)); - T0 = ldl_phys((target_phys_addr_t)((T0 + 4) & ~3) + tmp = ldq_phys((target_phys_addr_t)(T0 & ~7) | ((target_phys_addr_t)(asi & 0xf) << 32)); + ret = tmp >> 32; + T0 = tmp & 0xffffffff; break; } break; @@ -515,8 +520,7 @@ void helper_st_asi(int asi, int size) stl_user(T0 & ~3, T1); break; case 8: - stl_user(T0 & ~3, T1); - stl_user((T0 + 4) & ~3, T2); + stq_user(T0 & ~7, ((uint64_t)T1 << 32) | T2); break; } break; @@ -533,8 +537,7 @@ void helper_st_asi(int asi, int size) stl_kernel(T0 & ~3, T1); break; case 8: - stl_kernel(T0 & ~3, T1); - stl_kernel((T0 + 4) & ~3, T2); + stq_kernel(T0 & ~7, ((uint64_t)T1 << 32) | T2); break; } break; @@ -591,8 +594,7 @@ void helper_st_asi(int asi, int size) stl_phys(T0 & ~3, T1); break; case 8: - stl_phys(T0 & ~3, T1); - stl_phys((T0 + 4) & ~3, T2); + stq_phys(T0 & ~7, ((uint64_t)T1 << 32) | T2); break; } } @@ -615,10 +617,9 @@ void helper_st_asi(int asi, int size) | ((target_phys_addr_t)(asi & 0xf) << 32), T1); break; case 8: - stl_phys((target_phys_addr_t)(T0 & ~3) - | ((target_phys_addr_t)(asi & 0xf) << 32), T1); - stl_phys((target_phys_addr_t)((T0 + 4) & ~3) - | ((target_phys_addr_t)(asi & 0xf) << 32), T2); + stq_phys((target_phys_addr_t)(T0 & ~7) + | ((target_phys_addr_t)(asi & 0xf) << 32), + ((uint64_t)T1 << 32) | T2); break; } } diff --git a/target-sparc/op_mem.h b/target-sparc/op_mem.h index 96ad716839..4af00b3711 100644 --- a/target-sparc/op_mem.h +++ b/target-sparc/op_mem.h @@ -36,8 +36,9 @@ SPARC_ST_OP(sth, stw); void OPPROTO glue(op_std, MEMSUFFIX)(void) { - glue(stl, MEMSUFFIX)(ADDR(T0), T1); - glue(stl, MEMSUFFIX)((ADDR(T0 + 4)), T2); + uint64_t tmp = ((uint64_t)T1 << 32) | (uint64_t)(T2 & 0xffffffff); + + glue(stq, MEMSUFFIX)(ADDR(T0), tmp); } void OPPROTO glue(op_ldstub, MEMSUFFIX)(void) @@ -55,8 +56,11 @@ void OPPROTO glue(op_swap, MEMSUFFIX)(void) void OPPROTO glue(op_ldd, MEMSUFFIX)(void) { - T1 = glue(ldl, MEMSUFFIX)(ADDR(T0)); - T0 = glue(ldl, MEMSUFFIX)((ADDR(T0 + 4))); + uint64_t tmp; + + tmp = glue(ldq, MEMSUFFIX)(ADDR(T0)); + T1 = tmp >> 32; + T0 = tmp & 0xffffffff; } /*** Floating-point store ***/