}
static unsigned long
-insert_i5div1 (unsigned long insn, long value, const char ** errmsg)
+insert_i5div1 (unsigned long insn, unsigned long value, const char ** errmsg)
{
if (value > 30 || value < 2)
{
}
static unsigned long
-insert_i5div2 (unsigned long insn, long value, const char ** errmsg)
+insert_i5div2 (unsigned long insn, unsigned long value, const char ** errmsg)
{
if (value > 30 || value < 4)
{
}
static unsigned long
-insert_i5div3 (unsigned long insn, long value, const char ** errmsg)
+insert_i5div3 (unsigned long insn, unsigned long value, const char ** errmsg)
{
if (value > 32 || value < 2)
{
}
static unsigned long
-insert_d5_4 (unsigned long insn, long value, const char ** errmsg)
+insert_d5_4 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0x1f || value < 0)
+ if (value > 0x1f)
{
if (value & 1)
* errmsg = _(not_valid);
}
static unsigned long
-insert_d8_6 (unsigned long insn, long value, const char ** errmsg)
+insert_d8_6 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0xff || value < 0)
+ if (value > 0xff)
{
if ((value % 4) != 0)
* errmsg = _(not_valid);
}
static unsigned long
-insert_d8_7 (unsigned long insn, long value, const char ** errmsg)
+insert_d8_7 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0xff || value < 0)
+ if (value > 0xff)
{
if ((value % 2) != 0)
* errmsg = _(not_valid);
}
static unsigned long
-insert_v8 (unsigned long insn, long value, const char ** errmsg)
+insert_v8 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0xff || value < 0)
+ if (value > 0xff)
* errmsg = _(immediate_out_of_range);
return insn | (value & 0x1f) | ((value & 0xe0) << (27-5));
}
static unsigned long
-insert_d9 (unsigned long insn, long value, const char ** errmsg)
+insert_d9 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0xff || value < -0x100)
+ if (value + 0x100 > 0x1ff)
{
if ((value % 2) != 0)
* errmsg = branch_out_of_range_and_odd_offset;
static unsigned long
extract_d9 (unsigned long insn, int * invalid)
{
- signed long ret = ((insn >> 7) & 0x1f0) | ((insn >> 3) & 0x0e);
+ unsigned long ret = ((insn >> 7) & 0x1f0) | ((insn >> 3) & 0x0e);
ret = (ret ^ 0x100) - 0x100;
}
static unsigned long
-insert_u16_loop (unsigned long insn, long value, const char ** errmsg)
+insert_u16_loop (unsigned long insn, unsigned long value, const char ** errmsg)
{
/* Loop displacement is encoded as a positive value,
even though the instruction branches backwards. */
- if (value < 0 || value > 0xffff)
+ if (value > 0xffff)
{
if ((value % 2) != 0)
* errmsg = branch_out_of_range_and_odd_offset;
}
static unsigned long
-insert_d16_15 (unsigned long insn, long value, const char ** errmsg)
+insert_d16_15 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0x7fff || value < -0x8000)
+ if (value + 0x8000 > 0xffff)
{
if ((value % 2) != 0)
* errmsg = _(not_valid);
static unsigned long
extract_d16_15 (unsigned long insn, int * invalid)
{
- signed long ret = (insn >> 16) & 0xfffe;
+ unsigned long ret = (insn >> 16) & 0xfffe;
ret = (ret ^ 0x8000) - 0x8000;
}
static unsigned long
-insert_d16_16 (unsigned long insn, signed long value, const char ** errmsg)
+insert_d16_16 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0x7fff || value < -0x8000)
+ if (value + 0x8000 > 0xffff)
* errmsg = _(out_of_range);
return insn | ((value & 0xfffe) << 16) | ((value & 1) << 5);
static unsigned long
extract_d16_16 (unsigned long insn, int * invalid)
{
- signed long ret = ((insn >> 16) & 0xfffe) | ((insn >> 5) & 1);
+ unsigned long ret = ((insn >> 16) & 0xfffe) | ((insn >> 5) & 1);
ret = (ret ^ 0x8000) - 0x8000;
}
static unsigned long
-insert_d17_16 (unsigned long insn, long value, const char ** errmsg)
+insert_d17_16 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0xffff || value < -0x10000)
+ if (value + 0x10000 > 0x1ffff)
* errmsg = _(out_of_range);
return insn | ((value & 0xfffe) << 16) | ((value & 0x10000) >> (16 - 4));
static unsigned long
extract_d17_16 (unsigned long insn, int * invalid)
{
- signed long ret = ((insn >> 16) & 0xfffe) | ((insn << (16 - 4)) & 0x10000);
+ unsigned long ret = ((insn >> 16) & 0xfffe) | ((insn << (16 - 4)) & 0x10000);
ret = (ret ^ 0x10000) - 0x10000;
if (invalid != 0)
*invalid = 0;
- return (unsigned long)ret;
+ return ret;
}
static unsigned long
-insert_d22 (unsigned long insn, long value, const char ** errmsg)
+insert_d22 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0x1fffff || value < -0x200000)
+ if (value + 0x200000 > 0x3fffff)
{
if ((value % 2) != 0)
* errmsg = branch_out_of_range_and_odd_offset;
static unsigned long
extract_d22 (unsigned long insn, int * invalid)
{
- signed long ret = ((insn >> 16) & 0xfffe) | ((insn << 16) & 0x3f0000);
+ unsigned long ret = ((insn >> 16) & 0xfffe) | ((insn << 16) & 0x3f0000);
ret = (ret ^ 0x200000) - 0x200000;
if (invalid != 0)
*invalid = 0;
- return (unsigned long) ret;
+ return ret;
}
static unsigned long
-insert_d23 (unsigned long insn, long value, const char ** errmsg)
+insert_d23 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0x3fffff || value < -0x400000)
+ if (value + 0x400000 > 0x7fffff)
* errmsg = out_of_range;
return insn | ((value & 0x7f) << 4) | ((value & 0x7fff80) << (16-7));
}
static unsigned long
-insert_d23_align1 (unsigned long insn, long value, const char ** errmsg)
+insert_d23_align1 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0x3fffff || value < -0x400000)
+ if (value + 0x400000 > 0x7fffff)
{
if (value & 0x1)
* errmsg = _(not_valid);
static unsigned long
extract_d23 (unsigned long insn, int * invalid)
{
- signed long ret = ((insn >> 4) & 0x7f) | ((insn >> (16-7)) & 0x7fff80);
+ unsigned long ret = ((insn >> 4) & 0x7f) | ((insn >> (16-7)) & 0x7fff80);
ret = (ret ^ 0x400000) - 0x400000;
if (invalid != 0)
*invalid = 0;
- return (unsigned long) ret;
+ return ret;
}
static unsigned long
-insert_i9 (unsigned long insn, signed long value, const char ** errmsg)
+insert_i9 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- if (value > 0xff || value < -0x100)
+ if (value + 0x100 > 0x1ff)
* errmsg = _(immediate_out_of_range);
return insn | ((value & 0x1e0) << 13) | (value & 0x1f);
static unsigned long
extract_i9 (unsigned long insn, int * invalid)
{
- signed long ret = ((insn >> 13) & 0x1e0) | (insn & 0x1f);
+ unsigned long ret = ((insn >> 13) & 0x1e0) | (insn & 0x1f);
ret = (ret ^ 0x100) - 0x100;
}
static unsigned long
-insert_u9 (unsigned long insn, long v, const char ** errmsg)
+insert_u9 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- unsigned long value = (unsigned long) v;
-
if (value > 0x1ff)
* errmsg = _(immediate_out_of_range);
}
static unsigned long
-insert_spe (unsigned long insn, long v, const char ** errmsg)
+insert_spe (unsigned long insn, unsigned long value, const char ** errmsg)
{
- unsigned long value = (unsigned long) v;
-
if (value != 3)
* errmsg = _("invalid register for stack adjustment");
}
static unsigned long
-insert_r4 (unsigned long insn, long v, const char ** errmsg)
+insert_r4 (unsigned long insn, unsigned long value, const char ** errmsg)
{
- unsigned long value = (unsigned long) v;
-
if (value >= 32)
* errmsg = _("invalid register name");
static unsigned long G_pos;
static unsigned long
-insert_POS (unsigned long insn, long pos, const char ** errmsg)
+insert_POS (unsigned long insn, unsigned long pos, const char ** errmsg)
{
- if (pos > 0x1f || pos < 0)
+ if (pos > 0x1f)
* errmsg = _(pos_out_of_range);
- G_pos = (unsigned long) pos;
+ G_pos = pos;
return insn; /* Not an oparaton until WIDTH. */
}
}
static unsigned long
-insert_WIDTH (unsigned long insn, long width, const char ** errmsg)
+insert_WIDTH (unsigned long insn, unsigned long width, const char ** errmsg)
{
unsigned long msb, lsb, opc, ret;
unsigned long msb_expand, lsb_expand;
- msb = (unsigned long)width + G_pos - 1;
+ msb = width + G_pos - 1;
lsb = G_pos;
opc = 0;
G_pos = 0;
- if (width > 0x20 || width < 0)
+ if (width > 0x20)
* errmsg = _(width_out_of_range);
if ((msb >= 16) && (lsb >= 16))
}
static unsigned long
-insert_SELID (unsigned long insn, long selid, const char ** errmsg)
+insert_SELID (unsigned long insn, unsigned long selid, const char ** errmsg)
{
- if ((unsigned long) selid > 0x1f)
+ if (selid > 0x1f)
* errmsg = _(selid_out_of_range);
return insn | ((selid & 0x1fUL) << 27);
}
static unsigned long
-insert_VECTOR8 (unsigned long insn, long vector8, const char ** errmsg)
+insert_VECTOR8 (unsigned long insn, unsigned long vector8, const char ** errmsg)
{
unsigned long ret;
- unsigned long VVV,vvvvv;
+ unsigned long VVV, vvvvv;
- if (vector8 > 0xff || vector8 < 0)
+ if (vector8 > 0xff)
* errmsg = _(vector8_out_of_range);
VVV = (vector8 & 0xe0) >> 5;
}
static unsigned long
-insert_VECTOR5 (unsigned long insn, long vector5, const char ** errmsg)
+insert_VECTOR5 (unsigned long insn, unsigned long vector5, const char ** errmsg)
{
unsigned long ret;
unsigned long vvvvv;
- if (vector5 > 0x1f || vector5 < 0)
+ if (vector5 > 0x1f)
* errmsg = _(vector5_out_of_range);
vvvvv = (vector5 & 0x1f);
}
static unsigned long
-insert_CACHEOP (unsigned long insn, long cacheop, const char ** errmsg ATTRIBUTE_UNUSED)
+insert_CACHEOP (unsigned long insn, unsigned long cacheop, const char ** errmsg ATTRIBUTE_UNUSED)
{
unsigned long ret;
- unsigned long pp,PPPPP;
+ unsigned long pp, PPPPP;
pp = (cacheop & 0x60) >> 5;
PPPPP = (cacheop & 0x1f);
extract_CACHEOP (unsigned long insn, int * invalid)
{
unsigned long ret;
- unsigned long pp,PPPPP;
+ unsigned long pp, PPPPP;
unsigned long insn2;
insn2 = insn >> 16;
}
static unsigned long
-insert_PREFOP (unsigned long insn, long prefop, const char ** errmsg ATTRIBUTE_UNUSED)
+insert_PREFOP (unsigned long insn, unsigned long prefop, const char ** errmsg ATTRIBUTE_UNUSED)
{
unsigned long ret;
unsigned long PPPPP;
}
static unsigned long
-insert_IMM10U (unsigned long insn, long value, const char ** errmsg)
+insert_IMM10U (unsigned long insn, unsigned long value, const char ** errmsg)
{
unsigned long imm10, ret;
unsigned long iiiii,IIIII;
- if (value > 0x3ff || value < 0)
+ if (value > 0x3ff)
* errmsg = _(imm10_out_of_range);
- imm10 = ((unsigned long) value) & 0x3ff;
+ imm10 = value & 0x3ff;
IIIII = (imm10 >> 5) & 0x1f;
iiiii = imm10 & 0x1f;
}
static unsigned long
-insert_SRSEL1 (unsigned long insn, long value, const char ** errmsg)
+insert_SRSEL1 (unsigned long insn, unsigned long value, const char ** errmsg)
{
unsigned long imm10, ret;
unsigned long sr,selid;
- if (value > 0x3ff || value < 0)
+ if (value > 0x3ff)
* errmsg = _(sr_selid_out_of_range);
- imm10 = (unsigned long) value;
+ imm10 = value;
selid = (imm10 & 0x3e0) >> 5;
sr = imm10 & 0x1f;
}
static unsigned long
-insert_SRSEL2 (unsigned long insn, long value, const char ** errmsg)
+insert_SRSEL2 (unsigned long insn, unsigned long value, const char ** errmsg)
{
unsigned long imm10, ret;
unsigned long sr, selid;
- if (value > 0x3ff || value < 0)
+ if (value > 0x3ff)
* errmsg = _(sr_selid_out_of_range);
- imm10 = (unsigned long) value;
+ imm10 = value;
selid = (imm10 & 0x3e0) >> 5;
sr = imm10 & 0x1f;