From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2207 invoked by alias); 21 Jun 2002 20:54:30 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 2175 invoked from network); 21 Jun 2002 20:54:28 -0000 Received: from unknown (HELO neon-gw.transmeta.com) (63.209.4.196) by sources.redhat.com with SMTP; 21 Jun 2002 20:54:28 -0000 Received: (from root@localhost) by neon-gw.transmeta.com (8.9.3/8.9.3) id NAA20174; Fri, 21 Jun 2002 13:54:24 -0700 Received: from mailhost.transmeta.com(10.1.1.15) by neon-gw.transmeta.com via smap (V2.1) id xma020141; Fri, 21 Jun 02 13:54:07 -0700 Received: from casey.transmeta.com (casey.transmeta.com [10.10.25.22]) by deepthought.transmeta.com (8.11.6/8.11.6) with ESMTP id g5LKsAj20723; Fri, 21 Jun 2002 13:54:10 -0700 (PDT) Received: (from dje@localhost) by casey.transmeta.com (8.9.3/8.7.3) id NAA16637; Fri, 21 Jun 2002 13:54:10 -0700 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15635.37490.634021.373881@casey.transmeta.com> Date: Fri, 21 Jun 2002 13:54:00 -0000 To: Hans-Peter Nilsson Cc: cgen@sources.redhat.com Subject: [RFA:] Fix lsb? bug with insn fields beyond base insn size. In-Reply-To: <200206190111.DAA19613@ignucius.axis.se> References: <200206190111.DAA19613@ignucius.axis.se> X-SW-Source: 2002-q2/txt/msg00033.txt.bz2 Hans-Peter Nilsson writes: > Ok to commit? > > 2002-06-19 Hans-Peter Nilsson > > * types.scm (bitrange-overlap?): Handle lsb0?. > * utils-gen.scm (-gen-extract-word): Ditto. > > Index: utils-gen.scm > =================================================================== > RCS file: /cvs/src/src/cgen/utils-gen.scm,v > retrieving revision 1.6 > diff -p -c -r1.6 utils-gen.scm > *** utils-gen.scm 14 Nov 2001 19:46:43 -0000 1.6 > --- utils-gen.scm 19 Jun 2002 00:10:20 -0000 > *************** > *** 116,125 **** > > (define (-gen-extract-word word-name word-start word-length start length > unsigned? lsb0?) > ! ; ??? lsb0? > ! (let ((word-end (+ word-start word-length)) > ! (end (+ start length)) > ! (base (if (< start word-start) word-start start))) > (string-append "(" > "EXTRACT_" > (if (current-arch-insn-lsb0?) "LSB0" "MSB0") > --- 116,131 ---- > > (define (-gen-extract-word word-name word-start word-length start length > unsigned? lsb0?) > ! ; Canonicalize on the low and high numbered ends of the field; use the > ! ; lsb?-adjusted numbering only when necessary. > ! (let* ((field-low (if lsb0? (- start length) start)) > ! (field-high (if lsb0? start (+ start length))) > ! (word-low word-start) > ! (word-high (+ word-start word-length)) > ! ; The field part within the extracted word. > ! (fieldpart-low (if (< field-low word-low) 0 (- field-low word-low))) > ! (fieldpart-high (if (> field-high word-high) > ! word-length (- field-high word-low)))) > (string-append "(" > "EXTRACT_" > (if (current-arch-insn-lsb0?) "LSB0" "MSB0") > *************** > *** 133,148 **** > ", " > (number->string word-length) > ", " > ! (number->string (if (< start word-start) > ! 0 > ! (- start word-start))) > ", " > ! (number->string (if (< end word-end) > ! (- end base) > ! (- word-end base))) > ") << " > ! (number->string (if (> end word-end) > ! (- end word-end) > 0)) > ")")) > ) > --- 139,150 ---- > ", " > (number->string word-length) > ", " > ! (number->string (if lsb0? fieldpart-high fieldpart-low)) > ", " > ! >>>>>>> (number->string (+ 1 (- fieldpart-high fieldpart-low))) > ") << " > ! (number->string (if (> field-high word-high) > ! (- field-high word-high) > 0)) > ")")) > ) Are you sure you want the +1 here (grep for >>>)? I didn't study the lsb0? = #t case, but for lsb0? = #f I compared the old/new equations on paper and you don't want the +1. I'm guessing the same would be true for lsb0? = #t. [unless of course you rework the fieldpart high/low calculations]