public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109632] Inefficient codegen when complex numbers are emulated with structs Date: Thu, 27 Apr 2023 07:52:04 +0000 [thread overview] Message-ID: <bug-109632-4-OSsl5awA6n@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109632-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109632 rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- Maybe worth noting that if the complex arguments are passed by value, to give: struct complx_t { float re; float im; }; complx_t add(const complx_t a, const complx_t b) { return {a.re + b.re, a.im + b.im}; } and SLP is disabled, we get: fmov w4, s1 fmov w3, s3 fmov x0, d0 fmov x1, d2 mov x2, 0 bfi x0, x4, 32, 32 bfi x1, x3, 32, 32 fmov d0, x0 fmov d1, x1 sbfx x3, x0, 0, 32 sbfx x0, x1, 0, 32 ushr d1, d1, 32 fmov d3, x0 fmov d2, x3 ushr d0, d0, 32 fadd s2, s2, s3 fadd s0, s0, s1 fmov w1, s2 fmov w0, s0 bfi x2, x1, 0, 32 bfi x2, x0, 32, 32 lsr x0, x2, 32 lsr w2, w2, 0 fmov s1, w0 fmov s0, w2 ret which is almost impressive, in its way. I think we need a way in gimple of “SRA-ing” the arguments and return value, in cases where that's forced by the ABI. I.e. provide separate incoming values of a.re and a.im, and store them to “a” on entry. Then similarly make the return stmt return RETURN_DECL.re and RETURN_DECL.im separately.
next prev parent reply other threads:[~2023-04-27 7:52 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-26 13:03 [Bug target/109632] New: " tnfchris at gcc dot gnu.org 2023-04-26 14:14 ` [Bug target/109632] " rguenth at gcc dot gnu.org 2023-04-26 14:40 ` tnfchris at gcc dot gnu.org 2023-04-26 15:23 ` tnfchris at gcc dot gnu.org 2023-04-27 7:52 ` rsandifo at gcc dot gnu.org [this message] 2023-04-27 11:17 ` rsandifo at gcc dot gnu.org 2023-04-27 11:24 ` tnfchris at gcc dot gnu.org 2023-04-27 13:33 ` rsandifo at gcc dot gnu.org 2023-04-27 17:50 ` rsandifo at gcc dot gnu.org 2023-04-27 19:11 ` tnfchris at gcc dot gnu.org 2023-05-02 15:00 ` rsandifo at gcc dot gnu.org 2023-05-23 10:34 ` cvs-commit at gcc dot gnu.org 2023-05-23 19:16 ` rsandifo 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-109632-4-OSsl5awA6n@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).