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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul-Antoine Arras <par...@gcc.gnu.org>:

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

commit r16-1071-gb437418bc9547073ec2704398c85c52e060e1fab
Author: Paul-Antoine Arras <par...@baylibre.com>
Date:   Mon May 12 14:42:24 2025 +0200

    RISC-V: Add pattern for vector-scalar multiply-add/sub [PR119100]

    This pattern enables the combine pass (or late-combine, depending on the
case)
    to merge a vec_duplicate into a plus-mult or minus-mult RTL instruction.

    Before this patch, we have two instructions, e.g.:
      vfmv.v.f        v6,fa0
      vfmadd.vv       v9,v6,v7

    After, we get only one:
      vfmadd.vf       v9,fa0,v7

    On SPEC2017's 503.bwaves_r, depending on the workload, the reduction in
dynamic
    instruction count varies from -4.66% to -4.75%.

            PR target/119100

    gcc/ChangeLog:

            * config/riscv/autovec-opt.md (*<optab>_vf_<mode>): Add new pattern
to
            combine vec_duplicate + vfm{add,sub}.vv into vfm{add,sub}.vf.
            * config/riscv/riscv-opts.h (FPR2VR_COST_UNPROVIDED): Define.
            * config/riscv/riscv-protos.h (get_fr2vr_cost): Declare function.
            * config/riscv/riscv.cc (riscv_rtx_costs): Add cost model for MULT
with
            VEC_DUPLICATE.
            (get_fr2vr_cost): New function.
            * config/riscv/riscv.opt: Add new option --param=fpr2vr-cost.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_data.h: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_run.h: New test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f16.c: New
test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f32.c: New
test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmadd-run-1-f64.c: New
test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f16.c: New
test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f32.c: New
test.
            * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfmsub-run-1-f64.c: New
test.

Reply via email to