public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113625] New: Interesting behavior with and without -mcpu=generic
@ 2024-01-27  1:36 pinskia at gcc dot gnu.org
  2024-01-29  7:58 ` [Bug target/113625] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-27  1:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113625
           Summary: Interesting behavior with and without -mcpu=generic
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Take:
```
void f(unsigned short * __restrict a, long long * __restrict b)
{
        int t = 0;
        t += a[0];
        t += a[1];
        t += a[2];
        t += a[3];
        b[0] = t;
}
```
Compile this with `-O3 -fno-vect-cost-model` (no extra configure options), GCC
produces:
```
f:
        ldr     d31, [x0]
        sub     sp, sp, #16
        uaddlv  s31, v31.4h
        str     s31, [sp, 12]
        ldrsw   x0, [sp, 12]
        str     x0, [x1]
        add     sp, sp, 16
```

And then add -mcpu=generic (or -mtune=generic), GCC produces:
```
f:
        ldr     d31, [x0]
        uaddlv  s31, v31.4h
        fmov    w0, s31
        sxtw    x0, w0
        str     x0, [x1]
        ret
```

I would have expected -mtune=generic be the same as without it but nope.

Maybe I don't understand what the default tuning settings are now vs what
-mtune=generic is supposed to do but also it is not obvious from documentation
either.  So this is at min a documentation issue.

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

* [Bug target/113625] Interesting behavior with and without -mcpu=generic
  2024-01-27  1:36 [Bug target/113625] New: Interesting behavior with and without -mcpu=generic pinskia at gcc dot gnu.org
@ 2024-01-29  7:58 ` rguenth at gcc dot gnu.org
  2024-01-29  8:02 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-29  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Other targets (x86_64) default to -mtune=generic.  Maybe configure time
selection somehow interferes with this on aarch64?

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

* [Bug target/113625] Interesting behavior with and without -mcpu=generic
  2024-01-27  1:36 [Bug target/113625] New: Interesting behavior with and without -mcpu=generic pinskia at gcc dot gnu.org
  2024-01-29  7:58 ` [Bug target/113625] " rguenth at gcc dot gnu.org
@ 2024-01-29  8:02 ` pinskia at gcc dot gnu.org
  2024-02-11 19:16 ` pinskia at gcc dot gnu.org
  2024-04-18 16:56 ` tnfchris at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-29  8:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Just FYI this is how I configured GCC:
```
Configured with: ../configure --target=aarch64-linux-gnu
--prefix=/home/apinski/src/upstream-full-cross/install
--enable-languages=c,c++,fortran,go
--with-sysroot=/home/apinski/src/upstream-full-cross/install//sysroot
```

Nothing special even.

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

* [Bug target/113625] Interesting behavior with and without -mcpu=generic
  2024-01-27  1:36 [Bug target/113625] New: Interesting behavior with and without -mcpu=generic pinskia at gcc dot gnu.org
  2024-01-29  7:58 ` [Bug target/113625] " rguenth at gcc dot gnu.org
  2024-01-29  8:02 ` pinskia at gcc dot gnu.org
@ 2024-02-11 19:16 ` pinskia at gcc dot gnu.org
  2024-04-18 16:56 ` tnfchris at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-11 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I should note that gcc.target/aarch64 tests are explicitly tested with
-mtune=generic ...

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

* [Bug target/113625] Interesting behavior with and without -mcpu=generic
  2024-01-27  1:36 [Bug target/113625] New: Interesting behavior with and without -mcpu=generic pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-02-11 19:16 ` pinskia at gcc dot gnu.org
@ 2024-04-18 16:56 ` tnfchris at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-04-18 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tnfchris at gcc dot gnu.org

--- Comment #4 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Generic is not the default for aarch64 and the default depends on the
architecture revision.

The documentation patch got stuck on bike shedding on the list.

I'll resubmit it tomorrow.

Generic was kept around for backwards compatibility reasons.

That said, both codegen below are suboptimal...

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

end of thread, other threads:[~2024-04-18 16:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-27  1:36 [Bug target/113625] New: Interesting behavior with and without -mcpu=generic pinskia at gcc dot gnu.org
2024-01-29  7:58 ` [Bug target/113625] " rguenth at gcc dot gnu.org
2024-01-29  8:02 ` pinskia at gcc dot gnu.org
2024-02-11 19:16 ` pinskia at gcc dot gnu.org
2024-04-18 16:56 ` tnfchris 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).