/* -- assembler routines inserted here. */
/* -- asm.c */
-
static const char * MISSING_CLOSING_PARENTHESIS = N_("missing `)'");
/* Handle '#' prefixes (i.e. skip over them). */
++*strp;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- value >>= 16;
+ {
+ value >>= 16;
+ value &= 0xffff;
+ }
*valuep = value;
return errmsg;
}
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{
- value = value + (value & 0x8000 ? 0x10000 : 0);
+ value += 0x8000;
value >>= 16;
+ value &= 0xffff;
}
*valuep = value;
return errmsg;
handles the case where low() isn't present. */
static const char *
-parse_slo16 (CGEN_CPU_DESC cd, const char ** strp, int opindex, long * valuep)
+parse_slo16 (CGEN_CPU_DESC cd,
+ const char ** strp,
+ int opindex,
+ long * valuep)
{
const char *errmsg;
enum cgen_parse_operand_result result_type;
++*strp;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value &= 0xffff;
- if (value & 0x8000)
- value |= 0xffff0000;
- }
+ value = ((value & 0xffff) ^ 0x8000) - 0x8000;
*valuep = value;
return errmsg;
}