public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114577] New: Inefficient codegen for SVE/NEON bridge
@ 2024-04-03 19:27 tnfchris at gcc dot gnu.org
  2024-04-04 13:17 ` [Bug target/114577] " cvs-commit at gcc dot gnu.org
  2024-04-04 13:18 ` rsandifo at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-04-03 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114577
           Summary: Inefficient codegen for SVE/NEON bridge
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*

The following sequence:

#include <arm_neon_sve_bridge.h>

svint32_t f (int *a, int *b)
{
  int32x4_t va = vld1q_s32 (a);
  svint32_t za = svset_neonq_s32 (svundef_s32 (), va);
  return za;
}

-O2 -march=armv9-a

is expected to be a simple load but generates:

f:
        ldr     q31, [x0]
        ptrue   p3.s, vl4
        sel     z0.s, p3, z31.s, z0.s
        ret

instead of the expected (from clang):

f:                                      // @f
        ldr     q0, [x0]
        ret

it looks like GCC's implementation of svset_neonq_s32 with svundef does not
become a view_convert/subreg.

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

* [Bug target/114577] Inefficient codegen for SVE/NEON bridge
  2024-04-03 19:27 [Bug target/114577] New: Inefficient codegen for SVE/NEON bridge tnfchris at gcc dot gnu.org
@ 2024-04-04 13:17 ` cvs-commit at gcc dot gnu.org
  2024-04-04 13:18 ` rsandifo at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-04 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:86dce005a1d440154dbf585dde5a2dd4cfac7a05

commit r14-9787-g86dce005a1d440154dbf585dde5a2dd4cfac7a05
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Thu Apr 4 14:15:49 2024 +0100

    aarch64: Recognise svundef idiom [PR114577]

    GCC 14 adds the header file arm_neon_sve_bridge.h to help interface
    SVE and Advanced SIMD code.  One of the defined idioms is:

      svset_neonq (svundef_TYPE (), advsimd_vector)

    which simply reinterprets advsimd_vector as an SVE vector without
    regard for what's in the upper bits.

    GCC was failing to recognise this idiom, which was likely to
    significantly hamper adoption.

    There is (AFAIK) no good way of representing an extension with
    undefined bits in gimple.  We could add an internal-only builtin
    to represent it, but the current framework makes that somewhat
    awkward.  It also doesn't seem very forward-looking.

    This patch instead goes for the simpler approach of recognising
    undefined arguments at expansion time.

    gcc/
            PR target/114577
            * config/aarch64/aarch64-sve-builtins.h
(aarch64_sve::lookup_fndecl):
            Declare.
            * config/aarch64/aarch64-sve-builtins.cc
(aarch64_sve::lookup_fndecl):
            New function.
            * config/aarch64/aarch64-sve-builtins-base.cc (is_undef): Likewise.
            (svset_neonq_impl::expand): Optimise expansions whose first
argument
            is undefined.

    gcc/testsuite/
            PR target/114577
            * gcc.target/aarch64/sve/acle/general/pr114577_1.c: New test.
            * gcc.target/aarch64/sve/acle/general/pr114577_2.c: Likewise.

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

* [Bug target/114577] Inefficient codegen for SVE/NEON bridge
  2024-04-03 19:27 [Bug target/114577] New: Inefficient codegen for SVE/NEON bridge tnfchris at gcc dot gnu.org
  2024-04-04 13:17 ` [Bug target/114577] " cvs-commit at gcc dot gnu.org
@ 2024-04-04 13:18 ` rsandifo at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2024-04-04 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #2 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-04-04 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 19:27 [Bug target/114577] New: Inefficient codegen for SVE/NEON bridge tnfchris at gcc dot gnu.org
2024-04-04 13:17 ` [Bug target/114577] " cvs-commit at gcc dot gnu.org
2024-04-04 13:18 ` rsandifo 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).