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]
Other format: [Raw text]

[RFA:] Fix lsb? bug with insn fields beyond base insn size.


Not something of your making, but one thing that can be cleaned
up in -gen-extract-word is it's use of current-arch-insn-lsb0?.
Either it should use the lsb0? argument, or the lsb0? argument
should be removed.  I don't have a strong preference which.

[grep for >>>]

(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")
		   (if (and (not unsigned?)
			    ; Only want sign extension for word with sign bit.
			    (bitrange-overlap? start 1 word-start word-length
					       lsb0?))
		       "_INT ("
		       "_UINT (")
		   word-name
		   ", "
		   (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))
		   ")"))
)


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