public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111835] New: Suboptimal codegen: zero extended load instead of sign extended one
@ 2023-10-16 14:46 lis8215 at gmail dot com
  2023-10-16 17:35 ` [Bug rtl-optimization/111835] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lis8215 at gmail dot com @ 2023-10-16 14:46 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-01 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-16 14:46 [Bug middle-end/111835] New: Suboptimal codegen: zero extended load instead of sign extended one lis8215 at gmail dot com
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

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).