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]

patch to insn.scm


Hi -

The following patch fixes a long-standing bug that I introduced into cgen.
It silently ignored duplicate sets of instructions during sim decoder
generation instead of reporting an ambiguity.  Committing, enjoy, sorry.


2001-07-12  Frank Ch. Eigler  <fche@redhat.com>

	* insn.scm (filter-harmlessly-ambiguous-insns): Fix msg typo.
	(mask-superset?): Look for strict supersets to allow rejection of
	duplicate insns.

Index: insn.scm
===================================================================
RCS file: /cvs/src/src/cgen/insn.scm,v
retrieving revision 1.2
diff -u -r1.2 insn.scm
--- insn.scm	2000/10/27 02:28:06	1.2
+++ insn.scm	2001/07/12 11:40:03
@@ -729,22 +729,25 @@
 		 (keep? (not superset-insn)))
 	    (if (not keep?) 
 		(logit 2
-		       "Instruction " (obj:name insn) "ambiguity-filtered by "
+		       "Instruction " (obj:name insn) " ambiguity-filtered by "
 		       (obj:name superset-insn) "\n"))
 	    keep?))
 	insn-list)
 )
 
 
-; Helper function for above: does (m1,v1) match a superset of (m2,v2) ?
+; Helper function for above: does (m1,v1) match a STRICT superset of (m2,v2) ?
 ;
 ; eg> mask-superset? #b1100 #b1000 #b1110 #b1010 -> #t
 ; eg> mask-superset? #b1100 #b1000 #b1010 #b1010 -> #f
 ; eg> mask-superset? #b1100 #b1000 #b1110 #b1100 -> #f
+; eg> mask-superset? #b1100 #b1000 #b1100 #b1000 -> #f
+; 
 (define (mask-superset? m1 v1 m2 v2)
   (let ((result
 	 (and (= (cg-logand m1 m2) m1)
-	      (= (cg-logand m1 v1) (cg-logand m1 v2)))))
+	      (= (cg-logand m1 v1) (cg-logand m1 v2))
+	      (not (and (= m1 m2) (= v1 v2))))))
     (if result (logit 4
 		      "(" (number->string m1 16) "," (number->string v1 16) ")"
 		      " contains "


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