public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109734] New: ARM64 support for __builtin_popcountll
@ 2023-05-04 13:09 rohan at garg dot io
  2023-05-04 13:22 ` [Bug target/109734] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rohan at garg dot io @ 2023-05-04 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109734
           Summary: ARM64 support for __builtin_popcountll
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rohan at garg dot io
  Target Milestone: ---

Hi
I noticed that ARM32 & ARM64 has native support for popcnt [1], but gcc only
outputs the native instruction for ARM32 [2].

I was hoping that someone could add native support for ARM64 too.

[1]
https://developer.arm.com/documentation/ddi0602/2022-12/Base-Instructions/CNT--Count-bits-?lang=en
[2] https://godbolt.org/z/aG8Mx4o6W

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

* [Bug target/109734] ARM64 support for __builtin_popcountll
  2023-05-04 13:09 [Bug c/109734] New: ARM64 support for __builtin_popcountll rohan at garg dot io
@ 2023-05-04 13:22 ` pinskia at gcc dot gnu.org
  2023-05-04 13:25 ` pinskia at gcc dot gnu.org
  2023-05-04 13:35 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-04 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

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

You need to enable it with -march=armv8-a+cssc .

I don't know of an arm64 core that implements cssc yet. It was added part of
armv8.7-a IIRC.

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

* [Bug target/109734] ARM64 support for __builtin_popcountll
  2023-05-04 13:09 [Bug c/109734] New: ARM64 support for __builtin_popcountll rohan at garg dot io
  2023-05-04 13:22 ` [Bug target/109734] " pinskia at gcc dot gnu.org
@ 2023-05-04 13:25 ` pinskia at gcc dot gnu.org
  2023-05-04 13:35 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-04 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh cssc feature support is only in gcc 13 and above too.

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

* [Bug target/109734] ARM64 support for __builtin_popcountll
  2023-05-04 13:09 [Bug c/109734] New: ARM64 support for __builtin_popcountll rohan at garg dot io
  2023-05-04 13:22 ` [Bug target/109734] " pinskia at gcc dot gnu.org
  2023-05-04 13:25 ` pinskia at gcc dot gnu.org
@ 2023-05-04 13:35 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-04 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also you read the assembly incorrectly. Aarch64 gcc is producing the simd cnt
instruction to do the popcount and not the scalar instruction. Arm(32) is doing
the call. I am not 100% sure but you should try to enable neon with arm and see
if it produces it for aarch32. Anyways this bug report is a wrong in the first
place because you point to cssc feature scalar cnt instruction which is
implemented in gcc 13 already but I suspect you can't use that either.

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

end of thread, other threads:[~2023-05-04 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04 13:09 [Bug c/109734] New: ARM64 support for __builtin_popcountll rohan at garg dot io
2023-05-04 13:22 ` [Bug target/109734] " pinskia at gcc dot gnu.org
2023-05-04 13:25 ` pinskia at gcc dot gnu.org
2023-05-04 13:35 ` 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).