int dialect ATTRIBUTE_UNUSED,
int *invalid)
{
- if (invalid != NULL
- && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
+ if (((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
*invalid = 1;
return 0;
}
int dialect ATTRIBUTE_UNUSED,
int *invalid)
{
- if (invalid != NULL
- && ((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
+ if (((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
*invalid = 1;
return 0;
}
int dialect,
int *invalid)
{
- if (invalid != NULL)
+ if ((dialect & PPC_OPCODE_POWER4) == 0)
{
- if ((dialect & PPC_OPCODE_POWER4) == 0)
- {
- if (((insn & (1 << 21)) == 0) != ((insn & (1 << 15)) == 0))
- *invalid = 1;
- }
- else
- {
- if ((insn & (0x17 << 21)) != (0x06 << 21)
- && (insn & (0x1d << 21)) != (0x18 << 21))
- *invalid = 1;
- }
+ if (((insn & (1 << 21)) == 0) != ((insn & (1 << 15)) == 0))
+ *invalid = 1;
}
+ else
+ {
+ if ((insn & (0x17 << 21)) != (0x06 << 21)
+ && (insn & (0x1d << 21)) != (0x18 << 21))
+ *invalid = 1;
+ }
+
return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
}
int dialect,
int *invalid)
{
- if (invalid != NULL)
+ if ((dialect & PPC_OPCODE_POWER4) == 0)
{
- if ((dialect & PPC_OPCODE_POWER4) == 0)
- {
- if (((insn & (1 << 21)) == 0) == ((insn & (1 << 15)) == 0))
- *invalid = 1;
- }
- else
- {
- if ((insn & (0x17 << 21)) != (0x07 << 21)
- && (insn & (0x1d << 21)) != (0x19 << 21))
- *invalid = 1;
- }
+ if (((insn & (1 << 21)) == 0) == ((insn & (1 << 15)) == 0))
+ *invalid = 1;
+ }
+ else
+ {
+ if ((insn & (0x17 << 21)) != (0x07 << 21)
+ && (insn & (0x1d << 21)) != (0x19 << 21))
+ *invalid = 1;
}
+
return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
}
int dialect,
const char **errmsg)
{
- if (errmsg != NULL
- && ! valid_bo (value, dialect))
+ if (!valid_bo (value, dialect))
*errmsg = _("invalid conditional option");
return insn | ((value & 0x1f) << 21);
}
long value;
value = (insn >> 21) & 0x1f;
- if (invalid != NULL
- && ! valid_bo (value, dialect))
+ if (!valid_bo (value, dialect))
*invalid = 1;
return value;
}
int dialect,
const char **errmsg)
{
- if (errmsg != NULL)
- {
- if (! valid_bo (value, dialect))
- *errmsg = _("invalid conditional option");
- else if ((value & 1) != 0)
- *errmsg = _("attempt to set y bit when using + or - modifier");
- }
+ if (!valid_bo (value, dialect))
+ *errmsg = _("invalid conditional option");
+ else if ((value & 1) != 0)
+ *errmsg = _("attempt to set y bit when using + or - modifier");
+
return insn | ((value & 0x1f) << 21);
}
long value;
value = (insn >> 21) & 0x1f;
- if (invalid != NULL
- && ! valid_bo (value, dialect))
+ if (!valid_bo (value, dialect))
*invalid = 1;
return value & 0x1e;
}
- /* The DQ field in a DQ form instruction. This is like D, but the
- lower four bits are forced to zero. */
+/* The DQ field in a DQ form instruction. This is like D, but the
+ lower four bits are forced to zero. */
/*ARGSUSED*/
static unsigned long
insert_dq (unsigned long insn,
long value,
int dialect ATTRIBUTE_UNUSED,
- const char ** errmsg ATTRIBUTE_UNUSED)
+ const char **errmsg)
{
- if ((value & 0xf) != 0 && errmsg != NULL)
+ if ((value & 0xf) != 0)
*errmsg = _("offset not a multiple of 16");
return insn | (value & 0xfff0);
}
insert_ev2 (unsigned long insn,
long value,
int dialect ATTRIBUTE_UNUSED,
- const char ** errmsg ATTRIBUTE_UNUSED)
+ const char **errmsg)
{
- if ((value & 1) != 0 && errmsg != NULL)
+ if ((value & 1) != 0)
*errmsg = _("offset not a multiple of 2");
- if ((value > 62) != 0 && errmsg != NULL)
+ if ((value > 62) != 0)
*errmsg = _("offset greater than 62");
return insn | ((value & 0x3e) << 10);
}
insert_ev4 (unsigned long insn,
long value,
int dialect ATTRIBUTE_UNUSED,
- const char **errmsg ATTRIBUTE_UNUSED)
+ const char **errmsg)
{
- if ((value & 3) != 0 && errmsg != NULL)
+ if ((value & 3) != 0)
*errmsg = _("offset not a multiple of 4");
- if ((value > 124) != 0 && errmsg != NULL)
+ if ((value > 124) != 0)
*errmsg = _("offset greater than 124");
return insn | ((value & 0x7c) << 9);
}
insert_ev8 (unsigned long insn,
long value,
int dialect ATTRIBUTE_UNUSED,
- const char **errmsg ATTRIBUTE_UNUSED)
+ const char **errmsg)
{
- if ((value & 7) != 0 && errmsg != NULL)
+ if ((value & 7) != 0)
*errmsg = _("offset not a multiple of 8");
- if ((value > 248) != 0 && errmsg != NULL)
+ if ((value > 248) != 0)
*errmsg = _("offset greater than 248");
return insn | ((value & 0xf8) << 8);
}
static long
extract_ev8 (unsigned long insn,
int dialect ATTRIBUTE_UNUSED,
- int * invalid ATTRIBUTE_UNUSED)
+ int *invalid ATTRIBUTE_UNUSED)
{
return (insn >> 8) & 0xf8;
}
int dialect ATTRIBUTE_UNUSED,
const char **errmsg)
{
- if ((value & 3) != 0 && errmsg != NULL)
+ if ((value & 3) != 0)
*errmsg = _("offset not a multiple of 4");
return insn | (value & 0xfffc);
}
int dialect ATTRIBUTE_UNUSED,
const char **errmsg)
{
- if ((value > 2047 || value < -2048) && errmsg != NULL)
+ if (value > 2047 || value < -2048)
*errmsg = _("offset not between -2048 and 2047");
return insn | ((value << 4) & 0xfff0);
}
int dialect ATTRIBUTE_UNUSED,
const char **errmsg)
{
- if ((value > 8191 || value < -8192) && errmsg != NULL)
+ if (value > 8191 || value < -8192)
*errmsg = _("offset not between -8192 and 8191");
- else if ((value & 3) != 0 && errmsg != NULL)
+ else if ((value & 3) != 0)
*errmsg = _("offset not a multiple of 4");
return insn | ((value << 2) & 0xfff0);
}
/* Any other value on mfcr is an error. */
else if ((insn & (0x3ff << 1)) == 19 << 1)
{
- if (errmsg != NULL)
- *errmsg = _("ignoring invalid mfcr mask");
+ *errmsg = _("ignoring invalid mfcr mask");
value = 0;
}
if ((insn & (1 << 20)) != 0)
{
if ((dialect & PPC_OPCODE_POWER4) == 0)
- {
- if (invalid != NULL)
- *invalid = 1;
- }
+ *invalid = 1;
else
{
/* Exactly one bit of MASK should be set. */
- if ((mask == 0 || (mask & -mask) != mask) && invalid != NULL)
+ if (mask == 0 || (mask & -mask) != mask)
*invalid = 1;
}
}
/* Check that non-power4 form of mfcr has a zero MASK. */
else if ((insn & (0x3ff << 1)) == 19 << 1)
{
- if (mask != 0 && invalid != NULL)
+ if (mask != 0)
*invalid = 1;
}
int dialect ATTRIBUTE_UNUSED,
const char **errmsg)
{
- if ((value & 3) != 0 && errmsg != NULL)
+ if ((value & 3) != 0)
*errmsg = _("ignoring least significant bits in branch offset");
return insn | (value & 0x3fffffc);
}
if (uval == 0)
{
- if (errmsg != NULL)
- *errmsg = _("illegal bitmask");
+ *errmsg = _("illegal bitmask");
return insn;
}
me = 32;
if (count != 2 && (count != 0 || ! last))
- {
- if (errmsg != NULL)
- *errmsg = _("illegal bitmask");
- }
+ *errmsg = _("illegal bitmask");
return insn | (mb << 6) | ((me - 1) << 1);
}
int mb, me;
int i;
- if (invalid != NULL)
- *invalid = 1;
+ *invalid = 1;
mb = (insn >> 6) & 0x1f;
me = (insn >> 1) & 0x1f;
ret |= 1 << (31 - i);
}
else if (mb == me + 1)
- ret = -1;
+ ret = ~0;
else /* (mb > me + 1) */
{
ret = ~0;
for (i = me + 1; i < mb; i++)
- ret &= ~ (1 << (31 - i));
+ ret &= ~(1 << (31 - i));
}
return ret;
}
int dialect ATTRIBUTE_UNUSED,
int *invalid)
{
- if (invalid != NULL)
- *invalid = 1;
+ *invalid = 1;
return -(((insn & 0xffff) ^ 0x8000) - 0x8000);
}
return insn | ((value & 0x1f) << 16);
}
- /* The RA field in the DQ form lq instruction, which has special
- value restrictions. */
+/* The RA field in the DQ form lq instruction, which has special
+ value restrictions. */
/*ARGSUSED*/
static unsigned long
{
long rtvalue = (insn & RT_MASK) >> 21;
- if (value == rtvalue && errmsg != NULL)
+ if (value == rtvalue)
*errmsg = _("source and target register operands must be different");
return insn | ((value & 0x1f) << 16);
}
int dialect ATTRIBUTE_UNUSED,
int *invalid)
{
- if (invalid != NULL
- && ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
+ if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
*invalid = 1;
return 0;
}
- /* The RT field of the DQ form lq instruction, which has special
- value restrictions. */
+/* The RT field of the DQ form lq instruction, which has special
+ value restrictions. */
/*ARGSUSED*/
static unsigned long
int dialect ATTRIBUTE_UNUSED,
const char **errmsg)
{
- if ((value & 1) != 0 && errmsg != NULL)
+ if ((value & 1) != 0)
*errmsg = _("target register operand must be even");
return insn | ((value & 0x1f) << 21);
}
- /* The RS field of the DS form stq instruction, which has special
- value restrictions. */
+/* The RS field of the DS form stq instruction, which has special
+ value restrictions. */
/*ARGSUSED*/
static unsigned long
int dialect ATTRIBUTE_UNUSED,
const char **errmsg)
{
- if ((value & 1) != 0 && errmsg != NULL)
+ if ((value & 1) != 0)
*errmsg = _("source register operand must be even");
return insn | ((value & 0x1f) << 21);
}