From: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
To: cgen@sources.redhat.com
Subject: [RFA:] Fix for lsb0? in -gen-extract-word, take 3.
Date: Tue, 25 Jun 2002 04:37:00 -0000 [thread overview]
Message-ID: <200206251137.NAA29644@ignucius.axis.se> (raw)
Bummer, I forgot to change (current-arch-insn-lsb0?) to lsb0? as
per Doug Evans's recommendation. That and comment tweaks are
the only changes. Sending the patch in unified format this
time, just for fun. (This particular patch is *slightly* more
readable in that format, IMHO).
This patch is supposed to only *fix a bug* in the lsb0? == #t
case. It doesn't change the (IMHO) unfortunate choice to have
different internal bitfield representations that depends on
"lsb0?" or anything like that. I like to think that to be a
good reason to review it. Perhaps it can let some of those
unknown ports which currently must kludge "lsb0? == #f" to now
define "lsb0? == #t"?
I'll set up build trees for the CGEN-generated sim targets in
the sourceware tree and check generated files for diffs if I
find reason to fix more bugs.
Ok to commit?
* utils-gen.scm (-gen-extract-word): Handle lsb0?.
Index: utils-gen.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils-gen.scm,v
retrieving revision 1.6
diff -p -c -u -p -r1.6 utils-gen.scm
cvs server: conflicting specifications of output style
--- utils-gen.scm 14 Nov 2001 19:46:43 -0000 1.6
+++ utils-gen.scm 25 Jun 2002 11:13:21 -0000
@@ -114,33 +114,45 @@
; Subroutine of -gen-ifld-extract-beyond to extract the relevant value
; from WORD-NAME and move it into place.
-(define (-gen-extract-word word-name word-start word-length start length
+(define (-gen-extract-word word-name word-start word-length
+ field-start field-length
unsigned? lsb0?)
- ; ??? lsb0?
- (let ((word-end (+ word-start word-length))
- (end (+ start length))
- (base (if (< start word-start) word-start start)))
+ (let* ((word-end (+ word-start word-length))
+ (start (if lsb0? (+ 1 (- field-start field-length)) field-start))
+ (end (+ start field-length))
+ (base (if (< start word-start) word-start start)))
(string-append "("
"EXTRACT_"
- (if (current-arch-insn-lsb0?) "LSB0" "MSB0")
+ (if lsb0? "LSB0" "MSB0")
(if (and (not unsigned?)
; Only want sign extension for word with sign bit.
- (bitrange-overlap? start 1 word-start word-length
+ (bitrange-overlap? field-start 1
+ word-start word-length
lsb0?))
"_INT ("
"_UINT (")
+ ; What to extract from.
word-name
", "
+ ; Size of this chunk.
(number->string word-length)
", "
- (number->string (if (< start word-start)
- 0
- (- start word-start)))
+ ; MSB of this chunk.
+ (number->string
+ (if lsb0?
+ (if (> end word-end)
+ (- word-end 1)
+ (- end word-start 1))
+ (if (< start word-start)
+ 0
+ (- start word-start))))
", "
+ ; Length of field within this chunk.
(number->string (if (< end word-end)
(- end base)
(- word-end base)))
") << "
+ ; Adjustment for this chunk within a full field.
(number->string (if (> end word-end)
(- end word-end)
0))
brgds, H-P
next reply other threads:[~2002-06-25 11:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-25 4:37 Hans-Peter Nilsson [this message]
2002-06-27 12:07 ` Doug Evans
2002-06-27 15:02 ` Frank Ch. Eigler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200206251137.NAA29644@ignucius.axis.se \
--to=hans-peter.nilsson@axis.com \
--cc=cgen@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).