From: William Tambe <tambewilliam@gmail.com>
To: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: prevent zero-extension when using a memory load instruction
Date: Sat, 18 Apr 2020 14:36:29 -0400 [thread overview]
Message-ID: <CAF8i9mP561YKueuSf0z1GYODLS_zJpK36+SDek5snX890cP1HA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2004181727100.30434@stedding.saclay.inria.fr>
On Sat, Apr 18, 2020 at 11:32 AM Marc Glisse <marc.glisse@inria.fr> wrote:
>
> On Sat, 18 Apr 2020, William Tambe via Gcc-help wrote:
>
> > In the machine description file, is there a way to tell GCC that a
> > memory load instruction already zero-extend such that it does not try
> > to apply zero-extension ?
>
> I would look at it the other way around: you can tell GCC what asm to
> generate for a zero_extend with a memory operand. Or did you have a
Thanks; tried above, but GCC still prefer a memory load followed by
zero-extension.
The example code used is as follow:
unsigned char var;
int main() {
return var;
}
Also tried x86 and ARM GCC port to see what they produce, and find
that only x86 will not generate a zero-extension when -Os is used.
The version of GCC used is 9.2.0.
Any other suggestions on how to tell GCC not to zero-extend the result
of a memory load ?
> specific example in mind?
>
> --
> Marc Glisse
next prev parent reply other threads:[~2020-04-18 18:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-18 15:12 William Tambe
2020-04-18 15:32 ` Marc Glisse
2020-04-18 18:36 ` William Tambe [this message]
2020-04-18 18:45 ` Jeff Law
2020-04-20 9:50 ` Segher Boessenkool
2020-04-20 14:36 ` William Tambe
2020-04-20 15:47 ` Segher Boessenkool
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=CAF8i9mP561YKueuSf0z1GYODLS_zJpK36+SDek5snX890cP1HA@mail.gmail.com \
--to=tambewilliam@gmail.com \
--cc=gcc-help@gcc.gnu.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).