aboutsummaryrefslogtreecommitdiff
path: root/sim/sh/gencode.c
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2003-11-03 14:14:15 +0000
committerJoern Rennecke <joern.rennecke@embecosm.com>2003-11-03 14:14:15 +0000
commit794cd17b2840c7b3b1d994f46d04845b91ea8104 (patch)
tree058cb8bda0149201bfbd21314e58f8c7bf67f226 /sim/sh/gencode.c
parentd36d13b0e1a771c8db490a27d8ebc7e470c635b4 (diff)
downloadgdb-794cd17b2840c7b3b1d994f46d04845b91ea8104.zip
gdb-794cd17b2840c7b3b1d994f46d04845b91ea8104.tar.gz
gdb-794cd17b2840c7b3b1d994f46d04845b91ea8104.tar.bz2
* interp.c (fsca_s, fsrra_s): New functions.
* gencode.c (tab): Add entries for fsca and fsrra. (expand_opcode): Allow variable length n / m fields.
Diffstat (limited to 'sim/sh/gencode.c')
-rw-r--r--sim/sh/gencode.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index a4a1c2d..07d62a9 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -449,6 +449,17 @@ op tab[] =
},
/* sh4 */
+ { "", "", "fsca", "1111nnn011111101",
+ "if (FPSCR_PR)",
+ " RAISE_EXCEPTION (SIGILL);",
+ "else",
+ " {",
+ " SET_FR (n, fsca_s (FPUL, &sin));",
+ " SET_FR (n+1, fsca_s (FPUL, &cos));",
+ " }",
+ },
+
+ /* sh4 */
{ "", "", "fschg", "1111001111111101",
"SET_FPSCR (GET_FPSCR() ^ FPSCR_MASK_SZ);",
},
@@ -458,6 +469,14 @@ op tab[] =
"FP_UNARY(n, sqrt);",
},
+ /* sh4 */
+ { "", "", "fsrra", "1111nnnn01111101",
+ "if (FPSCR_PR)",
+ " RAISE_EXCEPTION (SIGILL);",
+ "else",
+ " SET_FR (n, fsrra_s (FR (n)));",
+ },
+
/* sh2e */
{ "", "", "fsub <FREG_M>,<FREG_N>", "1111nnnnmmmm0001",
"FP_OP(n, -, m);",
@@ -1979,6 +1998,8 @@ expand_opcode (shift, val, i, s)
{
int m, mv;
+ if (s[1] - '0' > 1U || !s[2] || ! s[3])
+ expand_opcode (shift - 1, val + s[0] - '0', i, s + 1);
val |= bton (s) << shift;
if (s[2] == '0' || s[2] == '1')
expand_opcode (shift - 4, val, i, s + 4);
@@ -2003,12 +2024,17 @@ expand_opcode (shift, val, i, s)
}
case 'n':
case 'm':
- for (j = 0; j < 16; j++)
- {
- expand_opcode (shift - 4, val | (j << shift), i, s + 4);
-
- }
- break;
+ {
+ int digits = 1;
+ while (s[digits] == s[0])
+ digits++;
+ for (j = 0; j < (1 << digits); j++)
+ {
+ expand_opcode (shift - digits, val | (j << shift), i,
+ s + digits);
+ }
+ break;
+ }
case 'M':
/* A1, A0,X0,X1,Y0,Y1,M0,A1G,M1,M1G */
for (j = 5; j < 16; j++)