start-sanitize-v850
+Sat Aug 31 01:27:26 1996 Jeffrey A Law (law@cygnus.com)
+
+ * v850-opc.c (insert_d22, extract_d22): New functions.
+ (v850_operands): Use insert_d22 and extract_d22 for
+ D22 operands.
+ (insert_d9): Fix range check.
+
Fri Aug 30 18:01:02 1996 J.T. Conklin <jtc@hippo.cygnus.com>
* v850-opc.c (v850_operands): Add V850_OPERAND_SIGNED flag
/* Local insertion and extraction functions. */
static unsigned long insert_d9 PARAMS ((unsigned long, long, const char **));
static long extract_d9 PARAMS ((unsigned long, int *));
+static unsigned long insert_d22 PARAMS ((unsigned long, long, const char **));
+static long extract_d22 PARAMS ((unsigned long, int *));
/* regular opcode */
#define OP(x) ((x & 0x3f) << 5)
/* The DISP22 field in a format 4 insn. */
#define D22 (D16+1)
- { 22, 0, 0, 0, V850_OPERAND_SIGNED },
+ { 22, 0, insert_d22, extract_d22, V850_OPERAND_SIGNED },
#define B3 (D22+1)
/* The 3 bit immediate field in format 8 insn. */
long value;
const char **errmsg;
{
- if (value > 511 || value <= -512)
+ if (value > 255 || value <= -256)
*errmsg = "value out of range";
return (insn | ((value & 0x1f0) << 7) | ((value & 0x0e) << 3));
return ret;
}
+
+static unsigned long
+insert_d22 (insn, value, errmsg)
+ unsigned long insn;
+ long value;
+ const char **errmsg;
+{
+ if (value > 0xfffff || value <= -0x100000)
+ *errmsg = "value out of range";
+
+ return (insn | ((value & 0xfffe) << 16) | ((value & 0x3f0000) >> 16));
+}
+
+static long
+extract_d22 (insn, invalid)
+ unsigned long insn;
+ int *invalid;
+{
+ int ret = ((insn & 0xfffe0000) >> 16) | ((insn & 0x3f) << 16);
+
+ return ((ret << 10) >> 10);
+}