public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roger at nextmovesoftware dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/113560] Strange code generated when optimizing a multiplication on x86_64
Date: Wed, 24 Jan 2024 10:53:52 +0000	[thread overview]
Message-ID: <bug-113560-4-tJUrrgnRfF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113560-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Roger Sayle <roger at nextmovesoftware dot com> ---
In the .optimized dump, we have:
  __int128 unsigned __res;
  __int128 unsigned _12;
  ...
  __res_11 = in_2(D) w* 184467440738;
  _12 = __res_11 & 18446744073709551615;
  __res_7 = _12 * 100;

So the first multiplication is a widening multiplication and expanded using
mulx, but the second multiplication is a full width TImode multiplication,
which is why it has the same RTL expansion as "x * 100".  This is looking like
a tree-level issue and (perhaps) not a target-specific problem.

In fact, it looks like this operation is actually a highpart_multiplication as
only the highpart of the result is required (which should still generate mulx,
but  has a different representation at the tree-level).

  parent reply	other threads:[~2024-01-24 10:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 13:37 [Bug c++/113560] New: " accelerator0099 at gmail dot com
2024-01-23 15:06 ` [Bug target/113560] " rguenth at gcc dot gnu.org
2024-01-24  8:32 ` roger at nextmovesoftware dot com
2024-01-24  9:03 ` amonakov at gcc dot gnu.org
2024-01-24  9:04 ` accelerator0099 at gmail dot com
2024-01-24  9:11 ` accelerator0099 at gmail dot com
2024-01-24 10:53 ` roger at nextmovesoftware dot com [this message]
2024-01-28  9:17 ` roger at nextmovesoftware dot com
2024-02-01  6:12 ` cvs-commit 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-113560-4-tJUrrgnRfF@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).