This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Support SIGN-OPT attribute.



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 <geoffk@redhat.com>

===File ~/patches/cgen-signopt.patch========================
2001-06-30  Geoffrey Keating  <geoffk@redhat.com>

	* 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;
       
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]