[PATCH v2] RISC-V: Add ZVFHMIN extension to the -march= option

2023-05-28 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to add new sub extension (aka ZVFHMIN) to the -march= option. To make it simple, only the sub extension itself is involved in this patch, and the underlying FP16 related RVV intrinsic API depends on the TARGET_ZVFHMIN. The Zvfhmin extension depends on the Zve32

[committed 1/2] RISC-V: Fix ternary instruction attribute bug

2023-05-28 Thread Pan Li via Gcc-patches
From: Juzhe-Zhong Fix bug of vector.md which generate incorrect information to VSETVL PASS when testing FMA auto vectorization ternop-3.c. Signed-off-by: Juzhe-Zhong gcc/ChangeLog: * config/riscv/vector.md: Fix vimuladd instruction bug. --- gcc/config/riscv/vector.md | 2 +- 1 file c

[committed 2/2] RISC-V: Add RVV FMA auto-vectorization support

2023-05-28 Thread Pan Li via Gcc-patches
From: Juzhe-Zhong This patch support FMA auto-vectorization pattern. Let's RA decide vmacc or vmadd. Signed-off-by: Juzhe-Zhong gcc/ChangeLog: * config/riscv/autovec.md (fma4): New pattern. (*fma): Ditto. * config/riscv/riscv-protos.h (enum insn_type): New enum.

[PATCH v7] RISC-V: Using merge approach to optimize repeating sequence in vec_init

2023-05-29 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to optimize the VLS vector initialization like repeating sequence. From the vslide1down to the vmerge with a simple cost model, aka every instruction only has 1 cost. Given code with -march=rv64gcv_zvl256b --param riscv-autovec-preference=fixed-vlmax typedef i

[PATCH v1] RISC-V: Refactor comments and naming of riscv-v.cc.

2023-05-29 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to remove unnecessary comments of some self explained parameters and try a better name to avoid misleading. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-v.cc (emit_vlmax_insn): Remove unnecessary comments and rename local variabl

[PATCH] RISC-V: Fix unreachable test code for init repeat sequence.

2023-05-30 Thread Pan Li via Gcc-patches
From: Pan Li This patch fix one unreachable test code, which is for debugging purpose without cleanup before commit. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-run-1.c: Remove debug code. Signed-off-by: Pan Li

[PATCH] RISC-V: Add ZVFH extension to the -march= option

2023-05-30 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to add new sub extension (aka ZVFH) to the -march= option. To make it simple, only the sub extension itself is involved in this patch, and the underlying FP16 related RVV intrinsic API depends on the TARGET_ZVFH. The Zvfh extension depends on the Zve32f and Zfh

[PATCH] RISC-V: Introduce vfloat16m{f}*_t and their machine mode.

2023-06-01 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to introduce the built-in type vfloat16m{f}*_t, as well as their machine mode VNx*HF. They depend on architecture zvfhmin or zvfh. When givn the zvfhmin or zvfh, the macro TARGET_VECTOR_ELEN_FP_16 will be true. The underlying PATCH will implement the zvfhmin e

[PATCH] RISC-V: Add test for vfloat16*_t (non tuple) types

2023-06-01 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to add some test cases of vfloat16*_t (non tuple), no 'zvfh' or 'zvfhmin' will meet unknown type. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/abi-16.c: Add test cases. * gcc.target/riscv/rvv/base/user-7.c: Likew

[PATCH] RISC-V: Support RVV zvfh{min} vfloat16*_t mov and spill

2023-06-03 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to allow the mov and spill operation for the RVV vfloat16*_t types. The involved machine mode includes VNx1HF, VNx2HF, VNx4HF, VNx8HF, VNx16HF, VNx32HF and VNx64HF. Signed-off-by: Pan Li Co-Authored by: Juzhe-Zhong gcc/ChangeLog: * config/riscv/risc

[PATCH] RISC-V: Support RVV FP16 ZVFHMIN intrinsic API

2023-06-04 Thread Pan Li via Gcc-patches
From: Pan Li This patch support the 2 intrinsic API of FP16 ZVFHMIN extension. Aka SEW=16 for below instructions vfwcvt.f.f.v vfncvt.f.f.w Then users can leverage the instrinsic APIs to perform the conversion between RVV vector single float point and half float point. Signed-off-by: Pan Li g

[PATCH v1] RISC-V: Support RVV FP16 ZVFH floating-point intrinsic API

2023-06-04 Thread Pan Li via Gcc-patches
From: Pan Li This patch support the intrinsic API of FP16 ZVFH floating-point. Aka SEW=16 for below instructions: vfadd vfsub vfrsub vfwadd vfwsub vfmul vfdiv vfrdiv vfwmul vfmacc vfnmacc vfmsac vfnmsac vfmadd vfnmadd vfmsub vfnmsub vfwmacc vfwnmacc vfwmsac vfwnmsac vfsqrt vfrsqrt7 vfrec7 vfmin

[PATCH v2] RISC-V: Support RVV FP16 ZVFH floating-point intrinsic API

2023-06-05 Thread Pan Li via Gcc-patches
From: Pan Li This patch support the intrinsic API of FP16 ZVFH floating-point. Aka SEW=16 for below instructions: vfadd vfsub vfrsub vfwadd vfwsub vfmul vfdiv vfrdiv vfwmul vfmacc vfnmacc vfmsac vfnmsac vfmadd vfnmadd vfmsub vfnmsub vfwmacc vfwnmacc vfwmsac vfwnmsac vfsqrt vfrsqrt7 vfrec7 vfmin

[PATCH v1] RISC-V: Support RVV FP16 ZVFH Reduction floating-point intrinsic API

2023-06-05 Thread Pan Li via Gcc-patches
From: Pan Li This patch support the intrinsic API of FP16 ZVFH Reduction floating-point. Aka SEW=16 for below instructions: vfredosum vfredusum vfredmax vfredmin vfwredosum vfwredusum Then users can leverage the instrinsic APIs to perform the FP=16 related reduction operations. Please note not

[PATCH v1] RISC-V: Fix some typo in vector-iterators.md

2023-06-05 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to fix some typo in vector-iterators.md, aka: [-"vnx1DI")-]{+"vnx1di")+} [-"vnx2SI")-]{+"vnx2si")+} [-"vnx1SI")-]{+"vnx1si")+} Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/vector-iterators.md: Fix typo in mode attr. --- gcc/config/riscv/vect

[PATCH v1] RISC-V: Refactor ZVFHMIN to separated iterator and pattern

2023-06-06 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the ZVFHMIN implementation by separated iterator and pattern. Thus, we can tell the sub extension between the ZVFHMIN and ZVFH. Please note the ZVFH will cover the ZVFHMIN instructions. This patch add one test for this. Signed-off-by: Pan Li gcc/

[PATCH v2] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-06 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. The related define_insn and iterator will take the requirement based on the ZVFHMIN and ZVFH. Please note the ZVFH will cover the ZVFHMIN instructions. This patch add one test for this. Signed-off-by: P

[PATCH] RISC-V: Fix ICE when include riscv_vector.h with rv64gcv

2023-06-06 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to fix the incorrect requirement of the vector builtin types for the ZVFH/ZVFHMIN extension. The incorrect requirement will result in the ops mismatch with iterators, and then ICE will be triggered if ZVFH/ZVFHMIN is not given. Sorry for inconviensient. Signed

[PATCH v3] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-06 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. The related define_insn and iterator will take the requirement based on the ZVFHMIN and ZVFH. Please note the ZVFH will cover the ZVFHMIN instructions. This patch add one test for this. Signed-off-by: P

[PATCH] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-06 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. The related define_insn and iterator will take the requirement based on the ZVFHMIN and ZVFH. Please note the ZVFH will cover the ZVFHMIN instructions. This patch add one test for this. Signed-off-by: P

[PATCH v5] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-07 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. The related define_insn and iterator will take the requirement based on the ZVFHMIN and ZVFH. Please note the ZVFH will cover the ZVFHMIN instructions. This patch add one test for this. Signed-off-by: P

[PATCH v6] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-07 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. By default, the ZVFHMIN will enable FP16 for all the iterators of RVV. And then the ZVFH will leverage one function as the gate for FP16 supported or not. Please note the ZVFH will cover the ZVFHMIN inst

[PATCH v7] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-07 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. By default, the ZVFHMIN will enable FP16 for all the iterators of RVV. And then the ZVFH will leverage one function as the gate for FP16 supported or not. Please note the ZVFH will cover the ZVFHMIN inst

[PATCH v8] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-07 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. By default, the ZVFHMIN will enable FP16 for all the iterators of RVV. And then the ZVFH will leverage one function as the gate for FP16 supported or not. Please note the ZVFH will cover the ZVFHMIN inst

[PATCH v2] RISC-V: Add more test cases for RVV FP16

2023-06-08 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to add new test cases to make sure the RVV FP16 works well as expected. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/zvfh-intrinsic.c: Add new cases. * gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c: New test. ---

[PATCH v9] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-08 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. By default, the ZVFHMIN will enable FP16 for all the iterators of RVV. And then the ZVFH will leverage one define attr the gate for FP16 supported or not. Please note the ZVFH will cover the ZVFHMIN inst

[PATCH v10] RISC-V: Refactor requirement of ZVFH and ZVFHMIN.

2023-06-09 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to refactor the requirement of both the ZVFH and ZVFHMIN. By default, the ZVFHMIN will enable FP16 for all the iterators of RVV. And then the ZVFH will leverage one define attr as the gate for FP16 supported or not. Please note the ZVFH will cover the ZVFHMIN i

[PATCH v1] RISC-V: Fix one warning of frm enum.

2023-06-09 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to fix one warning similar as below, and add the link for where the values comes from. ./gcc/config/riscv/riscv-protos.h:260:13: warning: binary constants are a C++14 feature or GCC extension FRM_RNE = 0b000, ^ Signed-off-by: Pan

[PATCH v1] RISC-V: Add test cases for RVV FP16 vreinterpret

2023-06-09 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to add more tests for RVV FP16 vreinterpret, aka vfloat16*_t <==> v{u}int16*_t. There we allow FP16 vreinterpret in ZVFHMIN consider we have vle FP16 already. It doesn't break anything in SPEC as there is no such vreinterpret insn. >From the user's perspective

[PATCH v1] RISC-V: Support RVV FP16 MISC vlmul ext intrinsic API

2023-06-10 Thread Pan Li via Gcc-patches
From: Pan Li This patch support the intrinsic API of FP16 ZVFHMIN vlmul ext. Aka: vfloat16*_t <==> vfloat16*_t. >From the user's perspective, it is reasonable to do some type convert between vfloat16*_t and vfloat16*_t when only ZVFHMIN is enabled. Signed-off-by: Pan Li gcc/ChangeLog:

[PATCH v1] RISC-V: Add test cases for RVV FP16 undefined and vlmul trunc

2023-06-11 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to add more tests for RVV FP16 undef and vlmul trunc, aka __riscv_vundefined_f16*(); __riscv_vlmul_trunc_v_f16*_f16*(); >From the user's perspective, it is reasonable to do above operation when only ZVFHMIN is enabled. This patch would like to add new test cas

[PATCH v1] RISC-V: Support RVV FP16 MISC vget/vset intrinsic API

2023-06-12 Thread Pan Li via Gcc-patches
From: Pan Li This patch support the intrinsic API of FP16 ZVFHMIN vget/vset. From the user's perspective, it is reasonable to do some get/set operations for the vfloat16*_t types when only ZVFHMIN is enabled. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vector-builtins-ty

[PATCH v1] RISC-V: Fix one potential test failure for RVV vsetvl

2023-06-12 Thread Pan Li via Gcc-patches
From: Pan Li The test will fail on below command with multi-thread like below. However, it comes from one missed "Oz" option when check vsetvl. make -j $(nproc) report RUNTESTFLAGS="rvv.exp riscv.exp" To some reason, this failure cannot be reproduced by RUNTESTFLAGS="rvv.exp" or make without -

[PATCH v1] RISC-V: Fix one typo in full-vec-movel test

2023-06-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to fix one typo when checking assembly of full-vec-movel. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c: Adjust dg-do to comiple for asm checking. --- .../gcc.target/riscv/rvv/autove

[PATCH v1] RISC-V: Bugfix for vec_init repeating auto vectorization in RV32

2023-06-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to fix one bug exported by RV32 test case multiple_rgroup_run-2.c. The mask should be restricted by elen in vector, and the condition between the vmv.s.x and the vmv.v.x should take inner_bits_size rather than constants. Passed both the rv32 and rv64 riscv/rvv

[PATCH v1] RISC-V: Align the predictor style for define_insn_and_split

2023-06-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch is considered as the follow up of the below PATCH. https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621347.html We aligned the predictor style for the define_insn_and_split suggested by Kito. To avoid potential issues before we hit. Signed-off-by: Pan Li gcc/Change

[PATCH v2] RISC-V: Bugfix for vec_init repeating auto vectorization in RV32

2023-06-14 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to fix one bug exported by RV32 test case multiple_rgroup_run-2.c. The mask should be restricted by elen in vector, and the condition between the vmv.s.x and the vmv.v.x should take inner_bits_size rather than constants. After this patch, below failures on RV32

[PATCH v3] RISC-V: Bugfix for vec_init repeating auto vectorization in RV32

2023-06-14 Thread Pan Li via Gcc-patches
From: Pan Li When constructing a vector mask from individual elements we wrongly assumed that we can broadcast BITS_PER_WORD (i.e. XLEN). The maximum is actually the vector element length (i.e. ELEN). This patch fixes this. After this patch, below failures on RV32 will be fixed. FAIL: gcc.tar

[committed] RISC-V: Ensure vector args and return use function stack to pass [PR110119]

2023-06-14 Thread Pan Li via Gcc-patches
From: Lehua Ding The V2 patch address comments from Juzhe, thanks. Hi, The reason for this bug is that in the case where the vector register is set to a fixed length (with `--param=riscv-autovec-preference=fixed-vlmax` option), TARGET_PASS_BY_REFERENCE thinks that variables of type vint32m1 can

[PATCH v2] RISC-V: Use merge approach to optimize vector permutation

2023-06-14 Thread Pan Li via Gcc-patches
From: Juzhe-Zhong This patch is to optimize the permuation case that is suiteable use merge approach. Consider this following case: typedef int8_t vnx16qi __attribute__((vector_size (16))); void __attribute__ ((noipa)) merge0 (vnx16qi x, vnx16qi y, vnx16qi *out) { vnx16qi v = __builtin_shuffl

[PATCH v3] RISC-V: Use merge approach to optimize vector permutation

2023-06-14 Thread Pan Li via Gcc-patches
From: Juzhe-Zhong This patch is to optimize the permuation case that is suiteable use merge approach. Consider this following case: typedef int8_t vnx16qi __attribute__((vector_size (16))); void __attribute__ ((noipa)) merge0 (vnx16qi x, vnx16qi y, vnx16qi *out) { vnx16qi v = __builtin_shuffl

[PATCH v1] RISC-V: Bugfix for RVV integer reduction in ZVE32/64.

2023-06-16 Thread Pan Li via Gcc-patches
From: Pan Li The rvv integer reduction has 3 different patterns for zve128+, zve64 and zve32. They take the same iterator with different attributions. However, we need the generated function code_for_reduc (code, mode1, mode2). The implementation of code_for_reduc may look like below. code_for_r

[PATCH v1] RISC-V: Refactor riscv mode after for VXRM and FRM

2023-07-11 Thread Pan Li via Gcc-patches
From: Pan Li When investigate the FRM dynmaic rounding mode, we find the global unknown status is quite different between the fixed-point and floating-point. Thus, we separate the unknown function with extracting some inner common functions. We will also prepare more test cases in another PATCH.

[PATCH v2] RISC-V: Refactor riscv mode after for VXRM and FRM

2023-07-11 Thread Pan Li via Gcc-patches
From: Pan Li When investigate the FRM dynmaic rounding mode, we find the global unknown status is quite different between the fixed-point and floating-point. Thus, we separate the unknown function with extracting some inner common functions. We will also prepare more test cases in another PATCH.

[PATCH v1] RISC-V: Add more tests for RVV floating-point FRM.

2023-07-12 Thread Pan Li via Gcc-patches
From: Pan Li Add more test cases include both the asm check and run for RVV FRM. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-frm-insert-10.c: New test. * gcc.target/riscv/rvv/base/float-point-frm-insert-7.c: New test. * gcc.ta

[PATCH v3] RISC-V: Refactor riscv mode after for VXRM and FRM

2023-07-12 Thread Pan Li via Gcc-patches
From: Pan Li When investigate the FRM dynmaic rounding mode, we find the global unknown status is quite different between the fixed-point and floating-point. Thus, we separate the unknown function with extracting some inner common functions. We will also prepare more test cases in another PATCH.

[PATCH v2] RISC-V: Add more tests for RVV floating-point FRM.

2023-07-12 Thread Pan Li via Gcc-patches
From: Pan Li Add more test cases include both the asm check and run for RVV FRM. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-frm-insert-10.c: New test. * gcc.target/riscv/rvv/base/float-point-frm-insert-7.c: New test. * gcc.ta

[PATCH v1] RISC-V: Support basic floating-point dynamic rounding mode

2023-07-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the basic floating-point dynamic rounding modes for the RVV. We implement the dynamic rounding mode by below steps. 1. Set entry to DYN and exit to DYN_EXIT. 2. Add one rtl variable into machine_function for backup/restore. 3. Backup frm value when e

[PATCH v1] RISC-V: Fix RVV frm run test failure on RV32

2023-07-14 Thread Pan Li via Gcc-patches
From: Pan Li Refine the run test case to avoid interactive checking in RV32, by separating each checks in different functions. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-frm-run-1.c: Fix failure on RV32. --- .../riscv/rvv/base/float

[PATCH v1|GCC-13] RISC-V: Bugfix for riscv-vsetvl pass.

2023-07-15 Thread Pan Li via Gcc-patches
From: Ju-Zhe Zhong This patch comes from part of below change, which locate one bug of rvv vsetvel pass when auto-vectorization. https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624523.html Unforunately, It is not easy to reproduce this bug by intrinsic APIs but it is worth to backport to GC

[PATCH v2] RISC-V: Fix RVV frm run test failure on RV32

2023-07-17 Thread Pan Li via Gcc-patches
From: Pan Li Refine the run test case to avoid interactive checking in RV32, by separating each checks in different functions. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-frm-run-1.c: Fix run failure. --- .../riscv/rvv/base/float-point-frm-r

[PATCH v1] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-18 Thread Pan Li via Gcc-patches
From: Pan Li In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value

[PATCH v2] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-18 Thread Pan Li via Gcc-patches
From: Pan Li In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value

[PATCH v3] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-19 Thread Pan Li via Gcc-patches
From: Pan Li In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value

[PATCH v1] RISC-V: Align the pattern format in vector.md

2023-07-19 Thread Pan Li via Gcc-patches
From: Pan Li There are some format-unaligned pattern in vector.md, this patch would like to align the format for these patterns. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/vector.md: Align pattern format. --- gcc/config/riscv/vector.md | 850 +

[PATCH v4] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-19 Thread Pan Li via Gcc-patches
From: Pan Li In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value

[PATCH v1] RISC-V: Fix one incorrect match operand for RVV reduction

2023-07-20 Thread Pan Li via Gcc-patches
From: Pan Li There are 2 of the RVV reduction pattern mask operand takes vector_merge_operand instead of vector_mask_operand by mistake. This patch would like to fix this. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/vector.md: Fix incorrect match_operand. gcc/testsuite/Change

[PATCH v5] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-23 Thread Pan Li via Gcc-patches
From: Pan Li In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value

[PATCH v1] RISC-V: Bugfix for allowing incorrect dyn for static rounding

2023-07-23 Thread Pan Li via Gcc-patches
From: Pan Li According to the spec, dyn rounding mode is invalid for RVV floating-point, this patch would like to fix this. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vector-builtins-shapes.cc (struct alu_frm_def): Take range check. gcc/testsuite/ChangeLog:

[PATCH v6] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-23 Thread Pan Li via Gcc-patches
From: Pan Li In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value

[PATCH v7] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-24 Thread Pan Li via Gcc-patches
From: Pan Li Update in PATCH v7: 1. Take previous/next_nonnote_nondebug_insn_bb for seeking the insn. 2. Splitting the function in detection and emit when needed. Original commit logs: In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in

[PATCH v1] RISC-V: Remove unnecessary vread_csr/vwrite_csr intrinsic.

2023-07-27 Thread Pan Li via Gcc-patches
From: Pan Li According to below RVV doc, the related intrinsic is not longer needed. https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/249 Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv_vector.h (enum RVV_CSR): Removed. (vread_csr): Ditto. (vwrite_csr

[PATCH v8] RISC-V: Support CALL for RVV floating-point dynamic rounding

2023-07-27 Thread Pan Li via Gcc-patches
From: Pan Li Update in PATCH v8: 1. Emit non-abnormal backup insn to edge. 2. Fix _after return when call. 3. Refine some run tests. 4. Cleanup code. Original commit logs: In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH.

[PATCH v1] RISC-V: Bugfix for RVV floating-point rm suffix sequence

2023-07-30 Thread Pan Li via Gcc-patches
From: Pan Li According to below RVV intrinsic doc, the RVV floating-point intrinsic name with rounding mode should be: _rm_m instead of: _m_rm https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/226 This patch fix this naming sequence issue and adjust the test cases. Signed-off-by: Pan

[PATCH v1] RISC-V: Support RVV VFSUB and VFRSUB rounding mode intrinsic API

2023-07-31 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for both the VFSUB and VFRSUB as below samples. * __riscv_vfsub_vv_f32m1_rm * __riscv_vfsub_vv_f32m1_rm_m * __riscv_vfsub_vf_f32m1_rm * __riscv_vfsub_vf_f32m1_rm_m * __riscv_vfrsub_vf_f32m1_rm * __riscv_vfrsub_vf_f32m1_rm_m Sig

[PATCH v1] RISC-V: Support RVV VFWADD rounding mode intrinsic API

2023-08-01 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWADD VFSUB and VFRSUB as below samples. * __riscv_vfwadd_vv_f64m2_rm * __riscv_vfwadd_vv_f64m2_rm_m * __riscv_vfwadd_vf_f64m2_rm * __riscv_vfwadd_vf_f64m2_rm_m * __riscv_vfwadd_wv_f64m2_rm * __riscv_vfwadd_wv_f64m2_rm_

[PATCH v2] RISC-V: Support RVV VFWADD rounding mode intrinsic API

2023-08-01 Thread Pan Li via Gcc-patches
From: Pan Li Update in v2: 1. Add vfwalu type to frm_mode. 2. Enhance the test cases for frm. Original log: This patch would like to support the rounding mode API for the VFWADD VFSUB and VFRSUB as below samples. * __riscv_vfwadd_vv_f64m2_rm * __riscv_vfwadd_vv_f64m2_rm_m * __riscv_vfwadd_vf_

[PATCH v1] RISC-V: Enhance the test case for RVV vfsub/vfrsub rounding

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to enhance the vfsub/vfrsub rounding API test for below 2 purposes. * The non-rm API has no frm related insn generated. * The rm API has the frm backup/restore/set insn generated. Signed-off-by: Pan Li gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv

[PATCH v1] RISC-V: Support RVV VFWSUB rounding mode intrinsic API

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWSUB for the below samples. * __riscv_vfwsub_vv_f64m2_rm * __riscv_vfwsub_vv_f64m2_rm_m * __riscv_vfwsub_vf_f64m2_rm * __riscv_vfwsub_vf_f64m2_rm_m * __riscv_vfwsub_wv_f64m2_rm * __riscv_vfwsub_

[PATCH v1] RISC-V: Support RVV VFMUL rounding mode intrinsic API

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMUL for the below samples. * __riscv_vfmul_vv_f32m1_rm * __riscv_vfmul_vv_f32m1_rm_m * __riscv_vfmul_vf_f32m1_rm * __riscv_vfmul_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vecto

[PATCH v1] RISC-V: Remove redudant extern declaration in function base

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to remove the redudant declaration. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.h: Remove redudant declaration. --- gcc/config/riscv/riscv-vector-builtins-bases.h | 1 - 1 file changed, 1 deletion(-) diff

[PATCH v2] RISC-V: Support RVV VFMUL rounding mode intrinsic API

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li Update in v2: * Sync with upstream for the vfmul duplicated declaration. Original log: This patch would like to support the rounding mode API for the VFMUL for the below samples. * __riscv_vfmul_vv_f32m1_rm * __riscv_vfmul_vv_f32m1_rm_m * __riscv_vfmul_vf_f32m1_rm * __riscv_vfmul

[PATCH v1] RISC-V: Support RVV VFDIV and VFRDIV rounding mode intrinsic API

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFDIV and VFRDIV for the below samples. * __riscv_vfdiv_vv_f32m1_rm * __riscv_vfdiv_vv_f32m1_rm_m * __riscv_vfdiv_vf_f32m1_rm * __riscv_vfdiv_vf_f32m1_rm_m * __riscv_vfrdiv_vf_f32m1_rm * __riscv_vfrdiv_vf_f32m1_rm_m Sig

[PATCH v1] RISC-V: Support RVV VFWMUL rounding mode intrinsic API

2023-08-02 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWMUL for the below samples. * __riscv_vfwmul_vv_f64m2_rm * __riscv_vfwmul_vv_f64m2_rm_m * __riscv_vfwmul_vf_f64m2_rm * __riscv_vfwmul_vf_f64m2_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-

[PATCH v1] RISC-V: Fix one comment for binop_frm insn

2023-08-03 Thread Pan Li via Gcc-patches
From: Pan Li The previous patch missed the vfsub comment for binop_frm, this patch would like to fix this. Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc: Add vfsub. --- gcc/config/riscv/riscv-vector-builtins-bases.cc | 1 + 1 file changed, 1 inser

[PATCH v1] RISC-V: Support RVV VFMACC rounding mode intrinsic API

2023-08-03 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMACC for the below samples. * __riscv_vfmacc_vv_f32m1_rm * __riscv_vfmacc_vv_f32m1_rm_m * __riscv_vfmacc_vf_f32m1_rm * __riscv_vfmacc_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-

[PATCH v1] RISC-V: Support RVV VFNMACC rounding mode intrinsic API

2023-08-03 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFNMACC for the below samples. * __riscv_vfnmacc_vv_f32m1_rm * __riscv_vfnmacc_vv_f32m1_rm_m * __riscv_vfnmacc_vf_f32m1_rm * __riscv_vfnmacc_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/r

[PATCH v1] RISC-V: Support RVV VFMSAC rounding mode intrinsic API

2023-08-03 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMSAC for the below samples. * __riscv_vfmsac_vv_f32m1_rm * __riscv_vfmsac_vv_f32m1_rm_m * __riscv_vfmsac_vf_f32m1_rm * __riscv_vfmsac_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-

[PATCH v1] RISC-V: Support RVV VFNMSAC rounding mode intrinsic API

2023-08-03 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFNMSAC for the below samples. * __riscv_vfnmsac_vv_f32m1_rm * __riscv_vfnmsac_vv_f32m1_rm_m * __riscv_vfnmsac_vf_f32m1_rm * __riscv_vfnmsac_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/r

[PATCH v1] RISC-V: Support RVV VFMADD rounding mode intrinsic API

2023-08-03 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMADD as the below samples. * __riscv_vfmadd_vv_f32m1_rm * __riscv_vfmadd_vv_f32m1_rm_m * __riscv_vfmadd_vf_f32m1_rm * __riscv_vfmadd_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-v

[PATCH v1] RISC-V: Refactor RVV frm_mode attr for rounding mode intrinsic

2023-08-05 Thread Pan Li via Gcc-patches
From: Pan Li The frm_mode attr has some assumptions for each define insn as below. 1. The define insn has at least 9 operands. 2. The operands[9] must be frm reg. 3. The operands[9] must be const int. Actually, the frm operand can be operands[8], operands[9] or operands[10], and not all the def

[PATCH v1] Mode-Switching: Fix SET_SRC ICE when only one operand

2023-08-07 Thread Pan Li via Gcc-patches
From: Pan Li In same cases, like gcc/testsuite/gcc.dg/pr78148.c in RISC-V, there will be only 1 operand when SET_SRC in create_pre_exit. For example as below. (insn 13 9 14 2 (clobber (reg/i:TI 10 a0)) "gcc/testsuite/gcc.dg/pr78148.c":24:1 -1 (expr_list:REG_UNUSED (reg/i:TI 10 a0) (nil)))

[PATCH v2] Mode-Switching: Fix SET_SRC ICE when USE or CLOBBER

2023-08-07 Thread Pan Li via Gcc-patches
From: Pan Li In same cases, like gcc/testsuite/gcc.dg/pr78148.c in RISC-V, there will be only 1 operand when SET_SRC in create_pre_exit. For example as below. (insn 13 9 14 2 (clobber (reg/i:TI 10 a0)) "gcc/testsuite/gcc.dg/pr78148.c":24:1 -1 (expr_list:REG_UNUSED (reg/i:TI 10 a0) (nil)))

[PATCH v2] RISC-V: Refactor RVV frm_mode attr for rounding mode intrinsic

2023-08-07 Thread Pan Li via Gcc-patches
From: Pan Li The frm_mode attr has some assumptions for each define insn as below. 1. The define insn has at least 9 operands. 2. The operands[9] must be frm reg. 3. The operands[9] must be const int. Actually, the frm operand can be operands[8], operands[9] or operands[10], and not all the def

[PATCH v3] Mode-Switching: Fix SET_SRC ICE when CLOBBER insn

2023-08-08 Thread Pan Li via Gcc-patches
From: Pan Li In same cases, like gcc/testsuite/gcc.dg/pr78148.c in RISC-V, there will be only 1 operand when SET_SRC in create_pre_exit. For example as below. (insn 13 9 14 2 (clobber (reg/i:TI 10 a0)) "gcc/testsuite/gcc.dg/pr78148.c":24:1 -1 (expr_list:REG_UNUSED (reg/i:TI 10 a0) (nil)))

[PATCH v3] RISC-V: Refactor RVV frm_mode attr for rounding mode intrinsic

2023-08-09 Thread Pan Li via Gcc-patches
From: Pan Li The frm_mode attr has some assumptions for each define insn as below. 1. The define insn has at least 9 operands. 2. The operands[9] must be frm reg. 3. The operands[9] must be const int. Actually, the frm operand can be operands[8], operands[9] or operands[10], and not all the def

[PATCH v1] RISC-V: Support RVV VFMACC rounding mode intrinsic API

2023-08-09 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMACC for the below samples. * __riscv_vfmacc_vv_f32m1_rm * __riscv_vfmacc_vv_f32m1_rm_m * __riscv_vfmacc_vf_f32m1_rm * __riscv_vfmacc_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-

[PATCH v1] RISC-V: Support RVV VFNMACC rounding mode intrinsic API

2023-08-10 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFNMACC for the below samples. * __riscv_vfnmacc_vv_f32m1_rm * __riscv_vfnmacc_vv_f32m1_rm_m * __riscv_vfnmacc_vf_f32m1_rm * __riscv_vfnmacc_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/r

[PATCH v1] RISC-V: Support RVV VFMSAC rounding mode intrinsic API

2023-08-10 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMSAC for the below samples. * __riscv_vfmsac_vv_f32m1_rm * __riscv_vfmsac_vv_f32m1_rm_m * __riscv_vfmsac_vf_f32m1_rm * __riscv_vfmsac_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: (class vfmsac_frm): N

[PATCH v1] RISC-V: Support RVV VFNMSAC rounding mode intrinsic API

2023-08-10 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFNMSAC for the below samples. * __riscv_vfnmsac_vv_f32m1_rm * __riscv_vfnmsac_vv_f32m1_rm_m * __riscv_vfnmsac_vf_f32m1_rm * __riscv_vfnmsac_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/r

[PATCH v1] RISC-V: Support RVV VFMADD rounding mode intrinsic API

2023-08-11 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMADD as the below samples. * __riscv_vfmadd_vv_f32m1_rm * __riscv_vfmadd_vv_f32m1_rm_m * __riscv_vfmadd_vf_f32m1_rm * __riscv_vfmadd_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-v

[PATCH v1] RISC-V: Support RVV VFNMADD rounding mode intrinsic API

2023-08-11 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFNMADD as the below samples. * __riscv_vfnmadd_vv_f32m1_rm * __riscv_vfnmadd_vv_f32m1_rm_m * __riscv_vfnmadd_vf_f32m1_rm * __riscv_vfnmadd_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/ri

[PATCH v1] RISC-V: Support RVV VFMSUB rounding mode intrinsic API

2023-08-11 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFMSUB as the below samples. * __riscv_vfmsub_vv_f32m1_rm * __riscv_vfmsub_vv_f32m1_rm_m * __riscv_vfmsub_vf_f32m1_rm * __riscv_vfmsub_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-v

[PATCH v1] RISC-V: Support RVV VFNMSUB rounding mode intrinsic API

2023-08-11 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFNMSUB as the below samples. * __riscv_vfnmsub_vv_f32m1_rm * __riscv_vfnmsub_vv_f32m1_rm_m * __riscv_vfnmsub_vf_f32m1_rm * __riscv_vfnmsub_vf_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/ri

[PATCH v4] Mode-Switching: Fix SET_SRC ICE for create_pre_exit

2023-08-12 Thread Pan Li via Gcc-patches
From: Pan Li In same cases, like gcc/testsuite/gcc.dg/pr78148.c in RISC-V, there will be only 1 operand when SET_SRC in create_pre_exit. For example as below. (insn 13 9 14 2 (clobber (reg/i:TI 10 a0)) "gcc/testsuite/gcc.dg/pr78148.c":24:1 -1 (expr_list:REG_UNUSED (reg/i:TI 10 a0) (nil)))

[PATCH v1] RISC-V: Support RVV VFWMACC rounding mode intrinsic API

2023-08-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWMACC as the below samples. * __riscv_vfwmacc_vv_f64m2_rm * __riscv_vfwmacc_vv_f64m2_rm_m * __riscv_vfwmacc_vf_f64m2_rm * __riscv_vfwmacc_vf_f64m2_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/ri

[PATCH v1] RISC-V: Support RVV VFWNMACC rounding mode intrinsic API

2023-08-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWNMACC as the below samples. * __riscv_vfwnmacc_vv_f64m2_rm * __riscv_vfwnmacc_vv_f64m2_rm_m * __riscv_vfwnmacc_vf_f64m2_rm * __riscv_vfwnmacc_vf_f64m2_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/ris

[PATCH v1] RISC-V: Support RVV VFWMSAC rounding mode intrinsic API

2023-08-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWMSAC as the below samples. * __riscv_vfwmsac_vv_f64m2_rm * __riscv_vfwmsac_vv_f64m2_rm_m * __riscv_vfwmsac_vf_f64m2_rm * __riscv_vfwmsac_vf_f64m2_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/ri

[PATCH v1] RISC-V: Support RVV VFWNMSAC rounding mode intrinsic API

2023-08-13 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFWNMSAC as the below samples. * __riscv_vfwnmsac_vv_f64m2_rm * __riscv_vfwnmsac_vv_f64m2_rm_m * __riscv_vfwnmsac_vf_f64m2_rm * __riscv_vfwnmsac_vf_f64m2_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/ris

[PATCH v1] RISC-V: Support RVV VFSQRT rounding mode intrinsic API

2023-08-14 Thread Pan Li via Gcc-patches
From: Pan Li This patch would like to support the rounding mode API for the VFSQRT as the below samples. * __riscv_vfsqrt_v_f32m1_rm * __riscv_vfsqrt_v_f32m1_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (class unop_frm): New class fo

  1   2   3   >