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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Avinash Jayakar <[email protected]>:

https://gcc.gnu.org/g:d4b9bcaca3f490f777b7815a396df434ba027d9b

commit r17-5474-gd4b9bcaca3f490f777b7815a396df434ba027d9b
Author: Avinash Jayakar <[email protected]>
Date:   Fri Dec 5 15:12:52 2025 +0530

    rs6000: Emit better code for parity in DImode [PR119468]

    This patch aims to fix PR119468 by emitting better code for parity
    builtin. Currently the following code:

    bool parity(unsigned long long l)
    {
        return __builtin_parityll(l);
    }
    with O2 flag and even if the target supports popcntd emits,
      popcntb 3,3
      prtyd 3,3
      extsw 3,3

    With this patch, if there is support for popcntd (2.06) instruction, we
    emit
      popcntd 3,3
      rldicl 3,3,0,63
    Making use of the existing instruction and reducing the latency compared
    to existing code generated.

    2026-10-22  Avinash Jayakar  <[email protected]>

    gcc/ChangeLog:
            PR target/119468
            * config/rs6000/rs6000.cc (rs6000_emit_parity): Add code to
generate
            popcntd if available.

    gcc/testsuite/ChangeLog:
            PR target/119468
            * gcc.target/powerpc/pr119468.c: New test.

    Reviewed-by: Michael Meissner <[email protected]>

Reply via email to