public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109885] gcc does not generate movmskps and testps instructions (clang does) Date: Wed, 17 May 2023 14:51:59 +0000 [thread overview] Message-ID: <bug-109885-4-WS5TQwRTNM@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109885-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109885 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Just FYI, GCC does better on aarch64 with sum. GCC: ldp q29, q30, [x0] movi v31.4s, 0x1 fcmeq v29.4s, v29.4s, 0 fcmeq v30.4s, v30.4s, 0 and v31.16b, v31.16b, v29.16b sub v31.4s, v31.4s, v30.4s addv s31, v31.4s fmov w0, s31 ret vs this mess: sub sp, sp, #16 ldp q1, q0, [x0] adrp x8, .LCPI0_0 fcmeq v1.4s, v1.4s, #0.0 fcmeq v0.4s, v0.4s, #0.0 uzp1 v0.8h, v1.8h, v0.8h ldr q1, [x8, :lo12:.LCPI0_0] and v0.16b, v0.16b, v1.16b addv h0, v0.8h fmov w8, s0 and w8, w8, #0xff fmov s0, w8 cnt v0.8b, v0.8b uaddlv h0, v0.8b fmov w0, s0 add sp, sp, #16 ret The reason is it looks like clang/LLVM is tuned to try to use movmskps/testps while GCC is tuned to do just a sum reduction in general. Though I think GCC could be slightly better here too. ldp q29, q30, [x0] fcmeq v29.4s, v29.4s, 0 fcmeq v30.4s, v30.4s, 0 add v31.16b, v29.16b, v30.16b addv s31, v31.4s fmov w0, s31 neg w0, w0 ret I think might be the best code for aarch64 reduction of bools
next prev parent reply other threads:[~2023-05-17 14:52 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-17 7:40 [Bug tree-optimization/109885] New: " vincenzo.innocente at cern dot ch 2023-05-17 7:44 ` [Bug target/109885] " pinskia at gcc dot gnu.org 2023-05-17 14:51 ` pinskia at gcc dot gnu.org [this message] 2023-05-17 15:31 ` pinskia at gcc dot gnu.org 2024-02-10 9:53 ` [Bug tree-optimization/109885] " pinskia at gcc dot gnu.org 2024-02-18 3:09 ` liuhongt at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109885-4-WS5TQwRTNM@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).