public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106583] New: Suboptimal immediate generation on aarch64
@ 2022-08-11  9:01 ktkachov at gcc dot gnu.org
  2022-10-19 16:14 ` [Bug target/106583] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2022-08-11  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106583
           Summary: Suboptimal immediate generation on aarch64
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

A simple codegen issue:
unsigned long long
foo (void)
{
  return 0x7efefefefefefeff;
}

generates at -O2
foo:
        mov     x0, 65279
        movk    x0, 0xfefe, lsl 16
        movk    x0, 0xfefe, lsl 32
        movk    x0, 0x7efe, lsl 48
        ret

whereas LLVM can do:
foo:                                    // @foo
        mov     x0, #-72340172838076674
        movk    x0, #65279
        movk    x0, #32510, lsl #48
        ret

Should be a matter of just making aarch64_internal_mov_immediate in aarch64.cc
a bit smarter

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

* [Bug target/106583] Suboptimal immediate generation on aarch64
  2022-08-11  9:01 [Bug target/106583] New: Suboptimal immediate generation on aarch64 ktkachov at gcc dot gnu.org
@ 2022-10-19 16:14 ` pinskia at gcc dot gnu.org
  2022-10-19 16:14 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-19 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-10-19
     Ever confirmed|0                           |1

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

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

* [Bug target/106583] Suboptimal immediate generation on aarch64
  2022-08-11  9:01 [Bug target/106583] New: Suboptimal immediate generation on aarch64 ktkachov at gcc dot gnu.org
  2022-10-19 16:14 ` [Bug target/106583] " pinskia at gcc dot gnu.org
@ 2022-10-19 16:14 ` pinskia at gcc dot gnu.org
  2022-10-24 14:36 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-19 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug target/106583] Suboptimal immediate generation on aarch64
  2022-08-11  9:01 [Bug target/106583] New: Suboptimal immediate generation on aarch64 ktkachov at gcc dot gnu.org
  2022-10-19 16:14 ` [Bug target/106583] " pinskia at gcc dot gnu.org
  2022-10-19 16:14 ` pinskia at gcc dot gnu.org
@ 2022-10-24 14:36 ` cvs-commit at gcc dot gnu.org
  2022-10-25 12:05 ` wilco at gcc dot gnu.org
  2022-10-31 19:21 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-24 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Wilco Dijkstra <wilco@gcc.gnu.org>:

https://gcc.gnu.org/g:a096036589d82175a0f729c2dab73c9a527d075d

commit r13-3459-ga096036589d82175a0f729c2dab73c9a527d075d
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Mon Oct 24 15:14:14 2022 +0100

    [AArch64] Improve immediate expansion [PR106583]

    Improve immediate expansion of immediates which can be created from a
    bitmask immediate and 2 MOVKs.  Simplify, refactor and improve efficiency
    of bitmask checks.  Move various immediate handling functions together
    to avoid forward declarations.

    This reduces the number of 4-instruction immediates in SPECINT/FP by
10-15%.

    gcc/

            PR target/106583
            * config/aarch64/aarch64.cc (aarch64_internal_mov_immediate)
            Add support for a bitmask immediate with 2 MOVKs.
            (aarch64_check_bitmask): New function after refactorization.
            (aarch64_bitmask_imm): Simplify replication of small modes.
            Split function into 64-bit only version for efficiency.
            (aarch64_move_imm): Move near other immediate functions.
            (aarch64_uimm12_shift): Likewise.
            (aarch64_clamp_to_uimm12_shift): Likewise.
            (aarch64_movk_shift): Likewise.
            (aarch64_replicate_bitmask_imm): Likewise.
            (aarch64_and_split_imm1): Likewise.
            (aarch64_and_split_imm2): Likewise.
            (aarch64_and_bitmask_imm): Likewise.
            (aarch64_movw_imm): Likewise.

    gcc/testsuite/
            PR target/106583
            * gcc.target/aarch64/pr106583.c: Add new test.

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

* [Bug target/106583] Suboptimal immediate generation on aarch64
  2022-08-11  9:01 [Bug target/106583] New: Suboptimal immediate generation on aarch64 ktkachov at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-10-24 14:36 ` cvs-commit at gcc dot gnu.org
@ 2022-10-25 12:05 ` wilco at gcc dot gnu.org
  2022-10-31 19:21 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: wilco at gcc dot gnu.org @ 2022-10-25 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilco at gcc dot gnu.org
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from Wilco <wilco at gcc dot gnu.org> ---
Fixed

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

* [Bug target/106583] Suboptimal immediate generation on aarch64
  2022-08-11  9:01 [Bug target/106583] New: Suboptimal immediate generation on aarch64 ktkachov at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-10-25 12:05 ` wilco at gcc dot gnu.org
@ 2022-10-31 19:21 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-31 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

end of thread, other threads:[~2022-10-31 19:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  9:01 [Bug target/106583] New: Suboptimal immediate generation on aarch64 ktkachov at gcc dot gnu.org
2022-10-19 16:14 ` [Bug target/106583] " pinskia at gcc dot gnu.org
2022-10-19 16:14 ` pinskia at gcc dot gnu.org
2022-10-24 14:36 ` cvs-commit at gcc dot gnu.org
2022-10-25 12:05 ` wilco at gcc dot gnu.org
2022-10-31 19:21 ` 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).