From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geoffrey Keating To: cgen@sources.redhat.com Subject: Support SIGN-OPT attribute. Date: Sat, 30 Jun 2001 18:03:00 -0000 Message-id: <200107010103.f6113sw13115@thief.cygnus.com> X-SW-Source: 2001-q2/msg00109.html The SIGN-OPT field attribute was documented, used in a number of .cpu files, was correctly output to the *_cgen_insert_operand routine... but was never actually _implemented_ anywhere. OK to commit? -- Geoff Keating ===File ~/patches/cgen-signopt.patch======================== 2001-06-30 Geoffrey Keating * cgen-ibld.in (insert_normal): Support CGEN_IFLD_SIGN_OPT. Index: cgen-ibld.in =================================================================== RCS file: /cvs/cvsfiles/devo/opcodes/cgen-ibld.in,v retrieving revision 1.14 diff -p -u -p -r1.14 cgen-ibld.in --- cgen-ibld.in 2001/05/07 17:55:25 1.14 +++ cgen-ibld.in 2001/07/01 00:59:27 @@ -145,7 +145,22 @@ insert_normal (cd, value, attrs, word_of } /* 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; ============================================================