summaryrefslogtreecommitdiff
path: root/opcodes/cgen-ibld.in
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@geoffk.org>2001-07-01 02:48:46 +0000
committerGeoffrey Keating <geoffk@geoffk.org>2001-07-01 02:48:46 +0000
commitb3f85b4e5fcbcfec60f62556f053b50eab9a20c6 (patch)
tree6d44656271bbabd0a6488a61ec1251d9152dae3b /opcodes/cgen-ibld.in
parent689d9d5fc374699e12eff8e7696fd379da2063c1 (diff)
downloadbinutils-redhat-b3f85b4e5fcbcfec60f62556f053b50eab9a20c6.tar.gz
* cgen-ibld.in (insert_normal): Support CGEN_IFLD_SIGN_OPT.
Diffstat (limited to 'opcodes/cgen-ibld.in')
-rw-r--r--opcodes/cgen-ibld.in17
1 files changed, 16 insertions, 1 deletions
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;