Re: [PATCH] aarch64: Canonicalize halving-add builtins [PR122715]

Andrea Pinski <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <CALvbMcCgNN1q1Cco8bam8Q=2=50dWZWJt++Ab8e_fSys5kbHBQ@mail.gmail.com>
On Fri, Aug 14, 2026 at 5:33 PM Odysseas Georgoudis <[email protected]> wrote:
>
> The first two patches for PR122715 have been committed.  This patch
> handles the remaining AArch64 case.
>
> Advanced SIMD halving-add intrinsics remain target builtins in GIMPLE,
> preventing generic average simplifications from seeing them.  Canonicalize
> SHADD and UHADD to IFN_AVG_FLOOR, and SRHADD and URHADD to
> IFN_AVG_CEIL.
>
> This allows equal operands to be folded by the existing match.pd rule
> while retaining optab-based instruction selection for other operands.
>
> Tested with an aarch64-linux-gnu cross compiler.  The targeted tests
> pass.

This does not fully work.
In fact is is the same as Eikansh's patch (except adding the signed ones):
https://inbox.sourceware.org/gcc-patches/[email protected]/

The reason why it does not work is mentioned here:
https://inbox.sourceware.org/gcc-patches/CALvbMcAPZu5dupGfA=3GtS8avmzzPScYMy8SrRRQxTQhakhpKw@mail.gmail.com/
Basically gcc.target/aarch64/sme/arm_neon_1.c is no longer rejected
when it should be.

Eikansh was still looking into how to fix the issue mentioned but has
not yet come up with a patch. He has been busy working on other
things.
If you want to look into how to resolve that issue that would be nice.

Note the compile farm has a few aarch64 machines which you can use to
do a bootstrap test.
See https://gcc.gnu.org/wiki/CompileFarm on how to sign up (this is
seperate from GCC but is used by many GCC developers and had been
associated with GCC development for a long time now).

Thanks,
Andrea


>
> Thanks,
> Odysseas
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.