public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/115749] Non optimal assembly for integer modulo by a constant on x86-64 CPUs
Date: Tue, 02 Jul 2024 18:14:28 +0000	[thread overview]
Message-ID: <bug-115749-4-5GIm9jnJQh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115749-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-07-02
         Depends on|                            |115756
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> For the original testcase, the imul vs shift can be reduced down to just:
> ```
> unsigned long func(unsigned long x)
> {
>   return x * 240;
> }
> 
> ```
> 
> GCC produces:
> ```
>         movq    %rdi, %rax
>         salq    $4, %rax
>         subq    %rdi, %rax
>         salq    $4, %rax
> ```
> vs:
> ```
>         imulq   $240, %rdi, %rax
> ```
> 
> -mtune=skylake  produces the imul.

I split out the tuning issue for imul to PR 115756 .


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115756
[Bug 115756] default tuning for x86_64 produces shifts for `*240`

  parent reply	other threads:[~2024-07-02 18:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02  9:31 [Bug c++/115749] New: Missed BMI2 optimization on x86-64 kim.walisch at gmail dot com
2024-07-02 11:36 ` [Bug c++/115749] " kim.walisch at gmail dot com
2024-07-02 11:44 ` [Bug target/115749] Non optimal assembly for integer modulo by a constant on x86-64 CPUs pinskia at gcc dot gnu.org
2024-07-02 11:59 ` kim.walisch at gmail dot com
2024-07-02 12:17 ` kim.walisch at gmail dot com
2024-07-02 17:21 ` pinskia at gcc dot gnu.org
2024-07-02 17:58 ` pinskia at gcc dot gnu.org
2024-07-02 18:14 ` pinskia at gcc dot gnu.org [this message]
2024-07-02 18:41 ` pinskia at gcc dot gnu.org
2024-07-03 17:29 ` kim.walisch at gmail dot com
2024-07-04  1:17 ` liuhongt at gcc dot gnu.org
2024-07-16  8:18 ` lingling.kong7 at gmail dot com
2024-07-16 21:29 ` roger at nextmovesoftware dot com
2024-07-25  1:45 ` cvs-commit at gcc dot gnu.org
2024-08-15  5:11 ` liuhongt at gcc dot gnu.org
2024-08-15  5:35 ` liuhongt at gcc dot gnu.org
2024-08-16  5:00 ` sjames 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-115749-4-5GIm9jnJQh@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).