RISC-V: Support RVV VFWMUL rounding mode intrinsic API
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 <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (vfwmul_frm_obj): New declaration. (vfwmul_frm): Ditto. * config/riscv/riscv-vector-builtins-bases.h: (vfwmul_frm): Ditto. * config/riscv/riscv-vector-builtins-functions.def (vfwmul_frm): New function definition. * config/riscv/vector.md: (frm_mode) Add vfwmul to frm_mode. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-widening-mul.c: New test.
This commit is contained in:
parent
b7ab3938c6
commit
dd03fb9962
5 changed files with 51 additions and 1 deletions
|
@ -322,6 +322,7 @@ public:
|
|||
/* Implements below instructions for frm
|
||||
- vfwadd
|
||||
- vfwsub
|
||||
- vfwmul
|
||||
*/
|
||||
template<rtx_code CODE>
|
||||
class widen_binop_frm : public function_base
|
||||
|
@ -2113,6 +2114,7 @@ static CONSTEXPR const binop_frm<DIV> vfdiv_frm_obj;
|
|||
static CONSTEXPR const reverse_binop<DIV> vfrdiv_obj;
|
||||
static CONSTEXPR const reverse_binop_frm<DIV> vfrdiv_frm_obj;
|
||||
static CONSTEXPR const widen_binop<MULT> vfwmul_obj;
|
||||
static CONSTEXPR const widen_binop_frm<MULT> vfwmul_frm_obj;
|
||||
static CONSTEXPR const vfmacc vfmacc_obj;
|
||||
static CONSTEXPR const vfnmsac vfnmsac_obj;
|
||||
static CONSTEXPR const vfmadd vfmadd_obj;
|
||||
|
@ -2347,6 +2349,7 @@ BASE (vfdiv_frm)
|
|||
BASE (vfrdiv)
|
||||
BASE (vfrdiv_frm)
|
||||
BASE (vfwmul)
|
||||
BASE (vfwmul_frm)
|
||||
BASE (vfmacc)
|
||||
BASE (vfnmsac)
|
||||
BASE (vfmadd)
|
||||
|
|
|
@ -158,6 +158,7 @@ extern const function_base *const vfdiv_frm;
|
|||
extern const function_base *const vfrdiv;
|
||||
extern const function_base *const vfrdiv_frm;
|
||||
extern const function_base *const vfwmul;
|
||||
extern const function_base *const vfwmul_frm;
|
||||
extern const function_base *const vfmacc;
|
||||
extern const function_base *const vfnmsac;
|
||||
extern const function_base *const vfmadd;
|
||||
|
|
|
@ -328,6 +328,8 @@ DEF_RVV_FUNCTION (vfrdiv_frm, alu_frm, full_preds, f_vvf_ops)
|
|||
// 13.5. Vector Widening Floating-Point Multiply
|
||||
DEF_RVV_FUNCTION (vfwmul, alu, full_preds, f_wvv_ops)
|
||||
DEF_RVV_FUNCTION (vfwmul, alu, full_preds, f_wvf_ops)
|
||||
DEF_RVV_FUNCTION (vfwmul_frm, alu_frm, full_preds, f_wvv_ops)
|
||||
DEF_RVV_FUNCTION (vfwmul_frm, alu_frm, full_preds, f_wvf_ops)
|
||||
|
||||
// 13.6. Vector Single-Width Floating-Point Fused Multiply-Add Instructions
|
||||
DEF_RVV_FUNCTION (vfmacc, alu, full_preds, f_vvvv_ops)
|
||||
|
|
|
@ -866,7 +866,7 @@
|
|||
|
||||
;; Defines rounding mode of an floating-point operation.
|
||||
(define_attr "frm_mode" "rne,rtz,rdn,rup,rmm,dyn,dyn_exit,dyn_call,none"
|
||||
(cond [(eq_attr "type" "vfalu,vfwalu,vfmul,vfdiv")
|
||||
(cond [(eq_attr "type" "vfalu,vfwalu,vfmul,vfdiv,vfwmul")
|
||||
(cond
|
||||
[(match_test "INTVAL (operands[9]) == riscv_vector::FRM_RNE")
|
||||
(const_string "rne")
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */
|
||||
|
||||
#include "riscv_vector.h"
|
||||
|
||||
typedef float float32_t;
|
||||
|
||||
vfloat64m2_t
|
||||
test_vfwmul_vv_f32m1_rm (vfloat32m1_t op1, vfloat32m1_t op2, size_t vl) {
|
||||
return __riscv_vfwmul_vv_f64m2_rm (op1, op2, 0, vl);
|
||||
}
|
||||
|
||||
vfloat64m2_t
|
||||
test_vfwmul_vv_f32m1_rm_m (vbool32_t mask, vfloat32m1_t op1, vfloat32m1_t op2,
|
||||
size_t vl) {
|
||||
return __riscv_vfwmul_vv_f64m2_rm_m (mask, op1, op2, 1, vl);
|
||||
}
|
||||
|
||||
vfloat64m2_t
|
||||
test_vfwmul_vf_f32m1_rm (vfloat32m1_t op1, float32_t op2, size_t vl) {
|
||||
return __riscv_vfwmul_vf_f64m2_rm (op1, op2, 2, vl);
|
||||
}
|
||||
|
||||
vfloat64m2_t
|
||||
test_vfwmul_vf_f32m1_rm_m (vbool32_t mask, vfloat32m1_t op1, float32_t op2,
|
||||
size_t vl) {
|
||||
return __riscv_vfwmul_vf_f64m2_rm_m (mask, op1, op2, 3, vl);
|
||||
}
|
||||
|
||||
vfloat64m2_t
|
||||
test_vfwmul_vv_f32m1 (vfloat32m1_t op1, vfloat32m1_t op2, size_t vl) {
|
||||
return __riscv_vfwmul_vv_f64m2 (op1, op2, vl);
|
||||
}
|
||||
|
||||
vfloat64m2_t
|
||||
test_vfwmul_vv_f32m1_m (vbool32_t mask, vfloat32m1_t op1, vfloat32m1_t op2,
|
||||
size_t vl) {
|
||||
return __riscv_vfwmul_vv_f64m2_m (mask, op1, op2, vl);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times {vfwmul\.[vw][vf]\s+v[0-9]+,\s*v[0-9]+,\s*[fav]+[0-9]+} 6 } } */
|
||||
/* { dg-final { scan-assembler-times {frrm\s+[axs][0-9]+} 4 } } */
|
||||
/* { dg-final { scan-assembler-times {fsrm\s+[axs][0-9]+} 4 } } */
|
||||
/* { dg-final { scan-assembler-times {fsrmi\s+[01234]} 4 } } */
|
Loading…
Add table
Reference in a new issue