diff options
Diffstat (limited to 'opcodes/m32c-asm.c')
-rw-r--r-- | opcodes/m32c-asm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c index 1bfa926efd..235b0b7ad9 100644 --- a/opcodes/m32c-asm.c +++ b/opcodes/m32c-asm.c @@ -407,6 +407,26 @@ parse_unsigned24 (CGEN_CPU_DESC cd, const char **strp, return 0; } +/* This should only be used for #imm->reg. */ +static const char * +parse_signed24 (CGEN_CPU_DESC cd, const char **strp, + int opindex, signed long *valuep) +{ + const char *errmsg = 0; + signed long value; + + PARSE_SIGNED; + + if (value <= 0xffffff && value > 0x7fffff) + value -= 0x1000000; + + if (value > 0xffffff) + return _("dsp:24 immediate is out of range"); + + *valuep = value; + return 0; +} + static const char * parse_signed32 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) @@ -1038,6 +1058,9 @@ m32c_cgen_parse_operand (CGEN_CPU_DESC cd, case M32C_OPERAND_DSP_48_U8 : errmsg = parse_unsigned8 (cd, strp, M32C_OPERAND_DSP_48_U8, (unsigned long *) (& fields->f_dsp_48_u8)); break; + case M32C_OPERAND_DSP_8_S24 : + errmsg = parse_signed24 (cd, strp, M32C_OPERAND_DSP_8_S24, (long *) (& fields->f_dsp_8_s24)); + break; case M32C_OPERAND_DSP_8_S8 : errmsg = parse_signed8 (cd, strp, M32C_OPERAND_DSP_8_S8, (long *) (& fields->f_dsp_8_s8)); break; |