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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Robin Dapp <rd...@gcc.gnu.org>:

https://gcc.gnu.org/g:2664964b2f695e947faea4c29dbddd3615cc4b0b

commit r14-6340-g2664964b2f695e947faea4c29dbddd3615cc4b0b
Author: Robin Dapp <rd...@ventanamicro.com>
Date:   Fri Dec 1 09:57:15 2023 +0100

    RISC-V: Add vectorized strlen.

    This patch implements a vectorized strlen by re-using and slightly
    adjusting the rawmemchr implementation.  Rawmemchr returns the address
    of the needle while strlen returns the difference between needle address
    and start address.

    As before, strlen expansion is guarded by -minline-strlen.

    While testing with -minline-strlen I encountered a vsetvl problem in
    memcpy-chk.c where we didn't insert a vsetvl at the proper spot (after
    a setjmp).  This needs to be fixed separately and I figured I'd post
    this patch as-is.

    gcc/ChangeLog:

            PR target/112109

            * config/riscv/riscv-protos.h (expand_rawmemchr): Add strlen
            parameter.
            * config/riscv/riscv-string.cc (riscv_expand_strlen): Call
            rawmemchr.
            (expand_rawmemchr): Add strlen handling.
            * config/riscv/riscv.md: Add TARGET_VECTOR to strlen expander.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/autovec/builtin/strlen-run.c: New test.
            * gcc.target/riscv/rvv/autovec/builtin/strlen.c: New test.

Reply via email to