From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZovT-0003nr-Ds for qemu-devel@nongnu.org; Fri, 25 Oct 2013 17:28:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZovI-0002Y7-K5 for qemu-devel@nongnu.org; Fri, 25 Oct 2013 17:28:11 -0400 From: Alexander Graf Date: Fri, 25 Oct 2013 23:27:29 +0200 Message-Id: <1382736474-32128-5-git-send-email-agraf@suse.de> In-Reply-To: <1382736474-32128-1-git-send-email-agraf@suse.de> References: <1382736474-32128-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PULL 04/29] target-ppc: Little Endian Correction to Load/Store Vector Element List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Cc: Blue Swirl , Tom Musta , "qemu-ppc@nongnu.org list:PowerPC" , Anthony Liguori , Aurelien Jarno From: Tom Musta The Load Vector Element (lve*x) and Store Vector Element (stve*x) instructions not only byte-swap in Little Endian mode, they also invert the element that is accessed. For example, the RTL for lvehx contains this: eb <-- EA[60:63] if Big-Endian byte ordering then VRT[8*eb:8*eb+15] <-- MEM(EA,2) else VRT[112-(8*eb):127-(8*eb)] <-- MEM(EA,2) This patch adds the element inversion, as described in the last line of the RTL. Signed-off-by: Tom Musta Reviewed-by: Anton Blanchard Signed-off-by: Alexander Graf --- target-ppc/mem_helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target-ppc/mem_helper.c b/target-ppc/mem_helper.c index d8e63ca..f35ed03 100644 --- a/target-ppc/mem_helper.c +++ b/target-ppc/mem_helper.c @@ -212,6 +212,7 @@ target_ulong helper_lscbx(CPUPPCState *env, target_ulong addr, uint32_t reg, int index = (addr & 0xf) >> sh; \ \ if (msr_le) { \ + index = n_elems - index - 1; \ r->element[LO_IDX ? index : (adjust - index)] = \ swap(access(env, addr)); \ } else { \ @@ -236,6 +237,7 @@ LVE(lvewx, cpu_ldl_data, bswap32, u32) int index = (addr & 0xf) >> sh; \ \ if (msr_le) { \ + index = n_elems - index - 1; \ access(env, addr, swap(r->element[LO_IDX ? index : \ (adjust - index)])); \ } else { \ -- 1.8.1.4