linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Dibyendu Majumdar <mobile@majumdar.org.uk>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Interaction between bitfields and casts
Date: Wed, 9 Aug 2017 23:10:01 +0200	[thread overview]
Message-ID: <CAMHZB6HbGqheOpd1PyrQEiJs4rwrnFTnJDeP8EWRJLdiuYoGmA@mail.gmail.com> (raw)
In-Reply-To: <CACXZuxfUC1DostLzrB2nk9eOvDox1oxG-HjHm+nrWqtyRWEGVQ@mail.gmail.com>

On Wed, Aug 9, 2017 at 10:41 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> Hi,
>
> When assigning values to bitfields I have noticed that some times
> Sparse generates a CAST instruction with an odd bit size - i.e. not a
> standard integer size. I was wondering if there are specific scenarios
> that lead to this. While LLVM handles the odd cast - I am working with
> another backend (Nanojit) that doesn't.

Yes, I know. There is already one less with:
    [PATCH v4 5/9] change the masking when loading bitfields"

Otherwise, it's really a question of translating then into the right
instruction(s) to truncate/zero extend/sign extend part of a word
(but the casts instructions in sparse's IR are a bit strange and
need special care when the src or the dest is not an integer but
a float or a pointer).

I have an unfinished series that clean this a bit but
it will be after the currently pending series.

-- Luc

  reply	other threads:[~2017-08-09 21:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 20:41 Interaction between bitfields and casts Dibyendu Majumdar
2017-08-09 21:10 ` Luc Van Oostenryck [this message]
2017-08-09 21:27 ` Linus Torvalds
2017-08-09 22:06   ` Luc Van Oostenryck
2017-08-09 22:44     ` Linus Torvalds
2017-08-09 22:56       ` Luc Van Oostenryck
2017-11-25 16:18       ` [SPARSE] cast rework (was: Re: Interaction between bitfields and casts) Luc Van Oostenryck

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=CAMHZB6HbGqheOpd1PyrQEiJs4rwrnFTnJDeP8EWRJLdiuYoGmA@mail.gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    /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 NNTP newsgroup(s).