public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jemarch@gnu.org>
To: "Guillermo E. Martinez via Cgen" <cgen@sourceware.org>
Subject: Re: [PATCH CGEN v1] cgen: Compute correct mask and values when offset in define-ifield is not 0.
Date: Tue, 14 Sep 2021 23:34:09 +0200	[thread overview]
Message-ID: <87v932suy6.fsf@gnu.org> (raw)
In-Reply-To: <20210820023254.2575757-1-guillermo.e.martinez@oracle.com> (Guillermo E. Martinez via Cgen's message of "Thu, 19 Aug 2021 21:32:54 -0500")


Hi Guillermo.

> diff --git a/utils.scm b/utils.scm
> index 29b72ff..3573eff 100644
> --- a/utils.scm
> +++ b/utils.scm
> @@ -804,14 +804,14 @@
>  ; Otherwise START denotes the most significant bit.
>  ; N is assumed to fit in the field.
>  
> -(define (word-value start length size lsb0? start-lsb? value)
> +(define (word-value start length size offset lsb0? start-lsb? value)
>    (if lsb0?
>        (if start-lsb?
>  	  (logsll value start)
> -	  (logsll value (+ (- start length) 1)))
> +	  (logsll value (+ (- start length) offset 1)))
>        (if start-lsb?
>  	  (logsll value (- size start 1))
> -	  (logsll value (- size (+ start length)))))
> +	  (logsll value (- size (+ start length offset)))))
>  )
>  
>  ; Return a bit mask of LENGTH bits in a word of SIZE bits starting at START.
> @@ -820,14 +820,14 @@
>  ; START-LSB? is non-#f if START denotes the least significant bit.
>  ; Otherwise START denotes the most significant bit.
>  
> -(define (word-mask start length size lsb0? start-lsb?)
> +(define (word-mask start length size offset lsb0? start-lsb?)
>    (if lsb0?
>        (if start-lsb?
>  	  (logsll (mask length) start)
> -	  (logsll (mask length) (+ (- start length) 1)))
> +	  (logsll (mask length) (+ (- start length) offset 1)))
>        (if start-lsb?
>  	  (logsll (mask length) (- size start 1))
> -	  (logsll (mask length) (- size (+ start length)))))
> +	  (logsll (mask length) (- size (+ start length offset)))))
>  )
>  
>  ; Extract LENGTH bits at bit number START in a word of SIZE bits from VALUE.

I just noticed that you forgot to add entries for OFFSET to the comment
blocks of word-value and word-mask.

  parent reply	other threads:[~2021-09-14 21:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20  2:32 Guillermo E. Martinez
2021-09-02 13:22 ` Guillermo Martinez
2021-09-10  1:23   ` Frank Ch. Eigler
2021-09-10  2:29     ` Jose E. Marchesi
2021-09-10  2:36       ` Jose E. Marchesi
2021-09-14 21:34 ` Jose E. Marchesi [this message]
2021-09-15 16:32 ` [PATCH v2] " Guillermo E. Martinez
2021-09-15 16:49   ` Jose E. Marchesi
2021-09-15 18:04     ` Guillermo Martinez
2021-11-25 23:02       ` Alan Modra
2021-11-25 23:28         ` Guillermo Martinez
2021-11-26  0:46           ` Alan Modra

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=87v932suy6.fsf@gnu.org \
    --to=jemarch@gnu.org \
    --cc=cgen@sourceware.org \
    /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).