]> sourceware.org Git - cgen.git/commitdiff
* utils-gen.scm (-gen-extract-word): Handle lsb0?.
authorHans-Peter Nilsson <hans-peter.nilsson@axis.com>
Sun, 30 Jun 2002 22:48:48 +0000 (22:48 +0000)
committerHans-Peter Nilsson <hans-peter.nilsson@axis.com>
Sun, 30 Jun 2002 22:48:48 +0000 (22:48 +0000)
ChangeLog
utils-gen.scm

index 1e0b8cc7a81344f360be14bc409a73628187d066..9b415f5fdede6a5d63cd9ee99433090dd8f6b453 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-01  Hans-Peter Nilsson  <hp@axis.com>
+
+       * utils-gen.scm (-gen-extract-word): Handle lsb0?.
+
 2002-06-25  J"orn Rennecke <joern.rennecke@superh.com>
 
        * cpu/sh64-compact.cpu (movw5): Use Correct operand field for reg.
index 8f1ea776fb625cb4f77bda272edd0738b1787ca7..e51900ac58998e1fd213db07e161468aa2d9c09a 100644 (file)
 ; 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))
This page took 0.035057 seconds and 5 git commands to generate.