public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "lis8215 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/111835] New: Suboptimal codegen: zero extended load instead of sign extended one
Date: Mon, 16 Oct 2023 14:46:49 +0000	[thread overview]
Message-ID: <bug-111835-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111835

            Bug ID: 111835
           Summary: Suboptimal codegen: zero extended load instead of sign
                    extended one
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lis8215 at gmail dot com
  Target Milestone: ---

In this simplified example:

int test (const uint8_t * src, uint8_t * dst)
{
    int8_t tmp = (int8_t)*src;
    *dst = tmp;
    return tmp;
}

GCC prefers to use load with zero extension instead of more rational sign
extended load.
Then it needs to do explicit sign extension for making return value.

I know there's a lot of bugs related to zero/sign ext, but I guessed it's rare
special case, and it reproduces in any GCC version available at godbolt and any
architecture except x86-64.

             reply	other threads:[~2023-10-16 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 14:46 lis8215 at gmail dot com [this message]
2023-10-16 17:35 ` [Bug rtl-optimization/111835] " pinskia at gcc dot gnu.org
2023-10-31 22:07 ` pinskia at gcc dot gnu.org
2023-11-01  6:36 ` lis8215 at gmail dot com
2023-11-01 15:40 ` pinskia at gcc dot gnu.org

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=bug-111835-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).