]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Bugfix ICE for RVV intrinisc vfw on _Float16 scalar
authorPan Li <pan2.li@intel.com>
Sat, 11 May 2024 07:25:28 +0000 (15:25 +0800)
committerPan Li <pan2.li@intel.com>
Mon, 13 May 2024 14:58:40 +0000 (22:58 +0800)
commit41b3cf262e61aee9d26380f1c820e0eaae740f50
treed887460d0cbf547ea63d683478781c872df6201c
parent6d31a370e26eeb950c326332633b3e8e84b6630b
RISC-V: Bugfix ICE for RVV intrinisc vfw on _Float16 scalar

For the vfw vx format RVV intrinsic, the scalar type _Float16 also
requires the zvfh extension.  Unfortunately,  we only check the
vector tree type and miss the scalar _Float16 type checking.  For
example:

vfloat32mf2_t test_vfwsub_wf_f32mf2(vfloat32mf2_t vs2, _Float16 rs1, size_t vl)
{
  return __riscv_vfwsub_wf_f32mf2(vs2, rs1, vl);
}

It should report some error message like zvfh extension is required
instead of ICE for unreg insn.

This patch would like to make up such kind of validation for _Float16
in the RVV intrinsic API.  It will report some error like below when
there is no zvfh enabled.

error: built-in function '__riscv_vfwsub_wf_f32mf2(vs2,  rs1,  vl)'
  requires the zvfhmin or zvfh ISA extension

Passed the rv64gcv fully regression tests, included c/c++/fortran.

PR target/114988

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins.cc
(validate_instance_type_required_extensions): New func impl to
validate the intrinisc func type ops.
(expand_builtin): Validate instance type before expand.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr114988-1.c: New test.
* gcc.target/riscv/rvv/base/pr114988-2.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/config/riscv/riscv-vector-builtins.cc
gcc/testsuite/gcc.target/riscv/rvv/base/pr114988-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/base/pr114988-2.c [new file with mode: 0644]