From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18788 invoked by alias); 13 Aug 2004 19:34:44 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18779 invoked from network); 13 Aug 2004 19:34:43 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 13 Aug 2004 19:34:43 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i7DJYce1005486 for ; Fri, 13 Aug 2004 15:34:43 -0400 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [172.16.52.227]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i7DJYca05695 for ; Fri, 13 Aug 2004 15:34:38 -0400 Received: from greed.delorie.com (dj.cipe.redhat.com [10.0.0.222]) by post-office.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i7DJYc914072 for ; Fri, 13 Aug 2004 15:34:38 -0400 Received: from greed.delorie.com (localhost [127.0.0.1]) by greed.delorie.com (8.12.11/8.12.10) with ESMTP id i7DJYbZF021482; Fri, 13 Aug 2004 15:34:37 -0400 Received: (from dj@localhost) by greed.delorie.com (8.12.11/8.12.11/Submit) id i7DJYbYX021478; Fri, 13 Aug 2004 15:34:37 -0400 Date: Fri, 13 Aug 2004 19:34:00 -0000 Message-Id: <200408131934.i7DJYbYX021478@greed.delorie.com> From: DJ Delorie To: gdb-patches@sources.redhat.com CC: dj@redhat.com Subject: [patch] sim/sh: fix movua for little endian X-SW-Source: 2004-08/txt/msg00492.txt.bz2 The movua opcode was hardcoded for big endian; on little endian targets it would retrieve the word backwards. Note that the global endian compensators are keyed to the HOST endian as well and are not usable for this purpose. The problem and solution are obvious, but my implementation may not be, so I await approval (global maintainers - no sim/sh maintainer). Tested with an ABI testsuite I'm working on which is known to use movua. 2004-08-13 DJ Delorie * gencode.c (movua.l): Compensate for endianness. Index: gencode.c =================================================================== RCS file: /cvs/src/src/sim/sh/gencode.c,v retrieving revision 1.28 diff -p -U1 -r1.28 gencode.c --- gencode.c 13 Feb 2004 00:01:19 -0000 1.28 +++ gencode.c 13 Aug 2004 19:17:00 -0000 @@ -868,5 +868,6 @@ op tab[] = "int regn = R[n];", + "int e = target_little_endian ? 3 : 0;", "MA (1);", - "R[0] = (RBAT (regn) << 24) + (RBAT (regn + 1) << 16) + ", - " (RBAT (regn + 2) << 8) + RBAT (regn + 3);", + "R[0] = (RBAT (regn + (0^e)) << 24) + (RBAT (regn + (1^e)) << 16) + ", + " (RBAT (regn + (2^e)) << 8) + RBAT (regn + (3^e));", "L (0);", @@ -875,5 +876,6 @@ op tab[] = "int regn = R[n];", + "int e = target_little_endian ? 3 : 0;", "MA (1);", - "R[0] = (RBAT (regn) << 24) + (RBAT (regn + 1) << 16) + ", - " (RBAT (regn + 2) << 8) + RBAT (regn + 3);", + "R[0] = (RBAT (regn + (0^e)) << 24) + (RBAT (regn + (1^e)) << 16) + ", + " (RBAT (regn + (2^e)) << 8) + RBAT (regn + (3^e));", "R[n] += 4;",