public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114528] New: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions
@ 2024-03-29  2:17 pinskia at gcc dot gnu.org
  2024-05-10  4:47 ` [Bug target/114528] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-29  2:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114528
           Summary: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming
                    could be done in 2 instructions
           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:
```
long long f()
{
        return 0xFFFFFFFF0001FFFF;// - 0x00123000;
}

long long g(long long a)
{
        return a - 0x00123000;
}

long long x()
{
        return 0xFFFFFFFF0001FFFF - 0x00123000;
}


long long x1()
{
        return g(f());
}
```

As you can see x and x1 produces 3 instructions forming the constant but GCC
should be able to do it in 2 as shown via `g` and `f` are one instruction each.

Noticed from reading the LLVM issue
https://github.com/llvm/llvm-project/issues/87028 .

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

* [Bug target/114528] (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions
  2024-03-29  2:17 [Bug target/114528] New: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions pinskia at gcc dot gnu.org
@ 2024-05-10  4:47 ` pinskia at gcc dot gnu.org
  2024-06-16  1:14 ` pinskia at gcc dot gnu.org
  2024-06-16  9:27 ` xry111 at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-10  4:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am going to have someone work on this so self-assigning for now.

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

* [Bug target/114528] (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions
  2024-03-29  2:17 [Bug target/114528] New: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions pinskia at gcc dot gnu.org
  2024-05-10  4:47 ` [Bug target/114528] " pinskia at gcc dot gnu.org
@ 2024-06-16  1:14 ` pinskia at gcc dot gnu.org
  2024-06-16  9:27 ` xry111 at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-16  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-06-16

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

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

* [Bug target/114528] (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions
  2024-03-29  2:17 [Bug target/114528] New: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions pinskia at gcc dot gnu.org
  2024-05-10  4:47 ` [Bug target/114528] " pinskia at gcc dot gnu.org
  2024-06-16  1:14 ` pinskia at gcc dot gnu.org
@ 2024-06-16  9:27 ` xry111 at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-06-16  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

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

--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Note that on some uarch the naive implementation may have 1 cycle latency while
the "clever" implementation has 2 due to fusion.  Maybe we need a tune
parameter.

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

end of thread, other threads:[~2024-06-16  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-29  2:17 [Bug target/114528] New: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions pinskia at gcc dot gnu.org
2024-05-10  4:47 ` [Bug target/114528] " pinskia at gcc dot gnu.org
2024-06-16  1:14 ` pinskia at gcc dot gnu.org
2024-06-16  9:27 ` xry111 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).