From 8174f6c694d304db8f6c2f45ccca5319670dfe48 Mon Sep 17 00:00:00 2001 From: geoffk Date: Sun, 1 Jul 2001 02:48:45 +0000 Subject: [PATCH] * cgen-ibld.in (insert_normal): Support CGEN_IFLD_SIGN_OPT. --- opcodes/ChangeLog | 4 ++++ opcodes/cgen-ibld.in | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d7dc563fa2..c6af91e3a5 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2001-06-30 Geoffrey Keating + + * cgen-ibld.in (insert_normal): Support CGEN_IFLD_SIGN_OPT. + 2001-06-28 Geoffrey Keating * cgen-asm.c (cgen_parse_keyword): Allow any first character. diff --git a/opcodes/cgen-ibld.in b/opcodes/cgen-ibld.in index ca2f1e5fcc..0ca4200aa2 100644 --- a/opcodes/cgen-ibld.in +++ b/opcodes/cgen-ibld.in @@ -145,7 +145,22 @@ insert_normal (cd, value, attrs, word_offset, start, length, word_length, } /* Ensure VALUE will fit. */ - if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)) + if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT)) + { + long minval = - (1L << (length - 1)); + unsigned long maxval = mask; + + if ((value > 0 && (unsigned long) value > maxval) + || value < minval) + { + /* xgettext:c-format */ + sprintf (errbuf, + _("operand out of range (%ld not between %ld and %lu)"), + value, minval, maxval); + return errbuf; + } + } + else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)) { unsigned long maxval = mask; -- 2.11.0