public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Brown <david.brown@hesbynett.no>
To: Stefan Franke <stefan@franke.ms>, gcc-help@gcc.gnu.org
Subject: Re: AW: optimizer discards sign information
Date: Wed, 10 Apr 2024 18:51:50 +0200	[thread overview]
Message-ID: <09c5a13a-b131-46b5-ac56-892bb5e54309@hesbynett.no> (raw)
In-Reply-To: <51BFC92A-35A4-4287-8FB0-F8258DAF0D9D@franke.ms>

On 10/04/2024 16:25, Stefan Franke wrote:

> 
> Thank you for the detailed explanation.

I'm glad if it helped you a little.

> It still doesn't fit together, since if the compiler knows that it's unsigned, why does it emit code for sign extension on the m68k target?
> 

It's nothing more than a sub-optimal code generation issue, since sign 
extension and zero extension are equally correct.  gcc's code generation 
is pretty good by any standard, but it is not always perfectly optimal. 
Maybe it's hard to improve this one without a lot of effort or knock-on 
effects.  Maybe the circumstances occur so rarely it is not worth the 
effort.  Maybe the sign extension is actually faster (or no slower) on 
some targets - sometimes real-world speeds are not what we expect by 
looking at the assembly.

(I thought you were using x86-64, not m68k?  The m68k target is not 
nearly as popular as it used to be in the early days of gcc.  My first 
use of gcc was building a cross-compiler of gcc 2.7 to run on DOS for a 
68332 target.  Happy days :-) )

> Well. Since there are enough explanations and my expectations are simply wrong consider this as closed.
> 
> Kind regards
> 
> Stefan
> 
> 


  reply	other threads:[~2024-04-10 17:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10  8:52 stefan
2024-04-10  9:16 ` Alexander Monakov
2024-04-10  9:19   ` Xi Ruoyao
2024-04-10  9:40     ` LIU Hao
2024-04-10  9:44       ` Xi Ruoyao
2024-04-10  9:51         ` LIU Hao
2024-04-10  9:52           ` Xi Ruoyao
2024-04-10 10:07             ` LIU Hao
2024-04-10 10:17               ` Xi Ruoyao
2024-04-10 10:03           ` AW: " stefan
2024-04-10 10:34             ` Xi Ruoyao
2024-04-10  9:24   ` stefan
2024-04-10  9:49     ` stefan
2024-04-10  9:54       ` Xi Ruoyao
2024-04-10  9:57       ` LIU Hao
2024-04-10 10:03         ` Xi Ruoyao
2024-04-10 11:52     ` David Brown
2024-04-10 14:25       ` Stefan Franke
2024-04-10 16:51         ` David Brown [this message]
2024-04-11  0:32         ` Oleg Endo

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=09c5a13a-b131-46b5-ac56-892bb5e54309@hesbynett.no \
    --to=david.brown@hesbynett.no \
    --cc=gcc-help@gcc.gnu.org \
    --cc=stefan@franke.ms \
    /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).