aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2003-07-25 23:52:43 +0000
committerMichael Snyder <msnyder@vmware.com>2003-07-25 23:52:43 +0000
commit437b0e60a1f18ff96cfcaee5dff1b47a593da537 (patch)
treeb44ba5592c88bb034bc6e04365c4de8635990d06
parent8e8c182c831852d49827b896af80277242c89d59 (diff)
downloadgdb-437b0e60a1f18ff96cfcaee5dff1b47a593da537.zip
gdb-437b0e60a1f18ff96cfcaee5dff1b47a593da537.tar.gz
gdb-437b0e60a1f18ff96cfcaee5dff1b47a593da537.tar.bz2
2003-07-25 Michael Snyder <msnyder@redhat.com>
* gencode.c (pshl): Change < to <= (shift by 16 is allowed). Cast argument of >> to unsigned to prevent sign extension. (psha): Change < to <= (shift by 32 is allowed).
-rw-r--r--sim/sh/ChangeLog6
-rw-r--r--sim/sh/gencode.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 4e75706..b34adb5 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-25 Michael Snyder <msnyder@redhat.com>
+
+ * gencode.c (pshl): Change < to <= (shift by 16 is allowed).
+ Cast argument of >> to unsigned to prevent sign extension.
+ (psha): Change < to <= (shift by 32 is allowed).
+
2003-07-24 Michael Snyder <msnyder@redhat.com>
* gencode.c: Fix typo in comment.
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index 495cb66..d078fc6 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -1306,10 +1306,10 @@ op ppi_tab[] =
{ "","", "pshl #<imm>,dz", "00000iiim16.zzzz",
"int Sz = DSP_R (z) & 0xffff0000;",
"",
- "if (i < 16)",
+ "if (i <= 16)",
" res = Sz << i;",
"else if (i >= 128 - 16)",
- " res = Sz >> 128 - i;",
+ " res = (unsigned) Sz >> 128 - i; /* no sign extension */",
"else",
" {",
" RAISE_EXCEPTION (SIGILL);",
@@ -1323,7 +1323,7 @@ op ppi_tab[] =
"int Sz = DSP_R (z);",
"int Sz_grd = GET_DSP_GRD (z);",
"",
- "if (i < 32)",
+ "if (i <= 32)",
" {",
" if (i == 32)",
" {",
@@ -1525,10 +1525,10 @@ op ppi_tab[] =
"int Sx = DSP_R (x) & 0xffff0000;",
"int Sy = DSP_R (y) >> 16 & 0x7f;",
"",
- "if (Sy < 16)",
+ "if (Sy <= 16)",
" res = Sx << Sy;",
"else if (Sy >= 128 - 16)",
- " res = Sx >> 128 - Sy;",
+ " res = (unsigned) Sx >> 128 - Sy; /* no sign extension */",
"else",
" {",
" RAISE_EXCEPTION (SIGILL);",
@@ -1541,7 +1541,7 @@ op ppi_tab[] =
"int Sx_grd = GET_DSP_GRD (x);",
"int Sy = DSP_R (y) >> 16 & 0x7f;",
"",
- "if (Sy < 32)",
+ "if (Sy <= 32)",
" {",
" if (Sy == 32)",
" {",