public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/77579] Missed multiple add (int) for CSEd case
       [not found] <bug-77579-4@http.gcc.gnu.org/bugzilla/>
@ 2023-05-16 20:06 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2023-05-16 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|pinskia at gcc dot gnu.org         |unassigned at gcc dot gnu.org

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Thinking about this some more, doing the multiply multiple times is actually
slower on most cores.
So this is not something you want to do normally but with a constant multiply
you do for small power of 2 constant.

E.g.:
```
void f(int x, int y, int z, int *s)
{
   int t = y * 2;
   s[0] = t + x;
   s[1] = x - t;
}
```
You should get:

        add     w2, w0, w1 lsl 1
        sub     w0, w0, w1 lsl 1
        stp     w2, w0, [x3]

And no seperate lsl instruction as the cost to do the lsl is free in this case.

Anyways I am not working on this any more.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-16 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-77579-4@http.gcc.gnu.org/bugzilla/>
2023-05-16 20:06 ` [Bug target/77579] Missed multiple add (int) for CSEd case 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).