]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Support rounding mode for VFMSAC/VFMSUB autovec
authorPan Li <pan2.li@intel.com>
Thu, 24 Aug 2023 06:49:14 +0000 (14:49 +0800)
committerPan Li <pan2.li@intel.com>
Thu, 31 Aug 2023 13:26:00 +0000 (21:26 +0800)
commit625962440ba5c737d6f35f7a1c9af1e9ef6bef3a
tree47624a0a89cf0ee8c814ef6143f21a94e3591c66
parent3e37e8231849ded7e214042f60f59fdcec75d7d3
RISC-V: Support rounding mode for VFMSAC/VFMSUB autovec

There will be a case like below for intrinsic and autovec combination.

vfadd RTZ   <- intrinisc static rounding
vfmsub      <- autovec/autovec-opt

The autovec generated vfmsub should take DYN mode, and the
frm must be restored before the vfmsub insn. This patch
would like to fix this issue by:

* Add the frm operand to the autovec/autovec-opt pattern.
* Set the frm_mode attr to DYN.

Thus, the frm flow when combine autovec and intrinsic should be.

+------------
| frrm  a5
| ...
| fsrmi 4
| vfadd       <- intrinsic static rounding.
| ...
| fsrm  a5
| vfmsub      <- autovec/autovec-opt
| ...
+------------

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/autovec-opt.md: Add FRM_REGNUM to vfmsac/vfmsub
* config/riscv/autovec.md: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-frm-autovec-2.c: New test.
gcc/config/riscv/autovec-opt.md
gcc/config/riscv/autovec.md
gcc/testsuite/gcc.target/riscv/rvv/base/float-point-frm-autovec-2.c [new file with mode: 0644]