Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] sim/sh: fix movua for little endian
@ 2004-08-13 19:34 DJ Delorie
  2004-08-23 19:48 ` Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: DJ Delorie @ 2004-08-13 19:34 UTC (permalink / raw)
  To: gdb-patches; +Cc: dj


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  <dj@redhat.com>

	* 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;",


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-09-12 15:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-13 19:34 [patch] sim/sh: fix movua for little endian DJ Delorie
2004-08-23 19:48 ` Andrew Cagney
2004-08-23 20:22   ` DJ Delorie
2004-08-23 20:43     ` Andrew Cagney
2004-08-23 21:06       ` DJ Delorie
2004-08-24 13:13         ` Andrew Cagney
2004-08-24 14:55           ` DJ Delorie
2004-09-08 22:35           ` DJ Delorie
2004-09-12 15:02             ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox