Message ID | 20231013013803.3680171-1-pan2.li@intel.com |
---|---|
State | New |
Headers | show |
Series | [v1] RISC-V: Support FP lfloor/lfloorf auto vectorization | expand |
OK. juzhe.zhong@rivai.ai From: pan2.li Date: 2023-10-13 09:38 To: gcc-patches CC: juzhe.zhong; pan2.li; yanzhang.wang; kito.cheng Subject: [PATCH v1] RISC-V: Support FP lfloor/lfloorf auto vectorization From: Pan Li <pan2.li@intel.com> This patch would like to support the FP lfloor/lfloorf auto vectorization. * long lfloor (double) for rv64 * long lfloorf (float) for rv32 Due to the limitation that only the same size of data type are allowed in the vectorier, the standard name lfloormn2 only act on DF => DI for rv64, and SF => SI for rv32. Given we have code like: void test_lfloor (long *out, double *in, unsigned count) { for (unsigned i = 0; i < count; i++) out[i] = __builtin_lfloor (in[i]); } Before this patch: .L3: ... fld fa5,0(a1) fcvt.l.d a5,fa5,rdn sd a5,-8(a0) ... bne a1,a4,.L3 After this patch: frrm a6 ... fsrmi 2 // RDN .L3: ... vsetvli a3,zero,e64,m1,ta,ma vfcvt.x.f.v v1,v1 vsetvli zero,a2,e64,m1,ta,ma vse32.v v1,0(a0) ... bne a2,zero,.L3 ... fsrm a6 The rest part like SF => DI/HF => DI/DF => SI/HF => SI will be covered by TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION. gcc/ChangeLog: * config/riscv/autovec.md (lfloor<mode><v_i_l_ll_convert>2): New pattern for lfloor/lfloorf. * config/riscv/riscv-protos.h (enum insn_type): New enum value. (expand_vec_lfloor): New func decl for expanding lfloor. * config/riscv/riscv-v.cc (expand_vec_lfloor): New func impl for expanding lfloor. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c: New test. * gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c: New test. * gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com> --- gcc/config/riscv/autovec.md | 11 +++ gcc/config/riscv/riscv-protos.h | 2 + gcc/config/riscv/riscv-v.cc | 10 +++ .../riscv/rvv/autovec/unop/math-lfloor-0.c | 19 +++++ .../riscv/rvv/autovec/unop/math-lfloor-1.c | 19 +++++ .../rvv/autovec/unop/math-lfloor-run-0.c | 69 +++++++++++++++++++ .../rvv/autovec/unop/math-lfloor-run-1.c | 69 +++++++++++++++++++ .../riscv/rvv/autovec/vls/math-lfloor-0.c | 30 ++++++++ .../riscv/rvv/autovec/vls/math-lfloor-1.c | 30 ++++++++ 9 files changed, 259 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index 267691a0095..c5b1e52cbf9 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -2242,6 +2242,7 @@ (define_expand "<u>avg<v_double_trunc>3_ceil" ;; - lrint/lrintf ;; - irintf ;; - lceil/lceilf +;; - lfloor/lfloorf ;; ------------------------------------------------------------------------- (define_expand "ceil<mode>2" [(match_operand:V_VLSF 0 "register_operand") @@ -2342,3 +2343,13 @@ (define_expand "lceil<mode><v_i_l_ll_convert>2" DONE; } ) + +(define_expand "lfloor<mode><v_i_l_ll_convert>2" + [(match_operand:<V_I_L_LL_CONVERT> 0 "register_operand") + (match_operand:V_VLS_FCONVERT_I_L_LL 1 "register_operand")] + "TARGET_VECTOR && !flag_trapping_math && !flag_rounding_math" + { + riscv_vector::expand_vec_lfloor (operands[0], operands[1], <MODE>mode, <V_I_L_LL_CONVERT>mode); + DONE; + } +) diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index ab65ab19524..49bdcdf2f93 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -304,6 +304,7 @@ enum insn_type : unsigned int UNARY_OP_FRM_DYN = UNARY_OP | FRM_DYN_P, UNARY_OP_FRM_RMM = UNARY_OP | FRM_RMM_P, UNARY_OP_FRM_RUP = UNARY_OP | FRM_RUP_P, + UNARY_OP_FRM_RDN = UNARY_OP | FRM_RDN_P, UNARY_OP_TAMU_FRM_DYN = UNARY_OP_TAMU | FRM_DYN_P, UNARY_OP_TAMU_FRM_RUP = UNARY_OP_TAMU | FRM_RUP_P, UNARY_OP_TAMU_FRM_RDN = UNARY_OP_TAMU | FRM_RDN_P, @@ -479,6 +480,7 @@ void expand_vec_roundeven (rtx, rtx, machine_mode, machine_mode); void expand_vec_lrint (rtx, rtx, machine_mode, machine_mode); void expand_vec_lround (rtx, rtx, machine_mode, machine_mode); void expand_vec_lceil (rtx, rtx, machine_mode, machine_mode); +void expand_vec_lfloor (rtx, rtx, machine_mode, machine_mode); #endif bool sew64_scalar_helper (rtx *, rtx *, rtx, machine_mode, bool, void (*)(rtx *, rtx)); diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index b03213dd8ed..21d86c3f917 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -4142,4 +4142,14 @@ expand_vec_lceil (rtx op_0, rtx op_1, machine_mode vec_fp_mode, emit_vec_cvt_x_f (op_0, op_1, UNARY_OP_FRM_RUP, vec_fp_mode); } +void +expand_vec_lfloor (rtx op_0, rtx op_1, machine_mode vec_fp_mode, + machine_mode vec_long_mode) +{ + gcc_assert (known_eq (GET_MODE_SIZE (vec_fp_mode), + GET_MODE_SIZE (vec_long_mode))); + + emit_vec_cvt_x_f (op_0, op_1, UNARY_OP_FRM_RDN, vec_fp_mode); +} + } // namespace riscv_vector diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c new file mode 100644 index 00000000000..ac2d1722300 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "test-math.h" + +/* +** test_double_long___builtin_lfloor: +** frrm\s+[atx][0-9]+ +** ... +** fsrmi\s+2 +** ... +** vsetvli\s+[atx][0-9]+,\s*zero,\s*e64,\s*m1,\s*ta,\s*ma +** vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+ +** ... +** fsrm\s+[atx][0-9]+ +** ret +*/ +TEST_UNARY_CALL_CVT (double, long, __builtin_lfloor) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c new file mode 100644 index 00000000000..164e97c17d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32f -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "test-math.h" + +/* +** test_float_long___builtin_lfloorf: +** frrm\s+[atx][0-9]+ +** ... +** fsrmi\s+2 +** ... +** vsetvli\s+[atx][0-9]+,\s*zero,\s*e32,\s*m1,\s*ta,\s*ma +** vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+ +** ... +** fsrm\s+[atx][0-9]+ +** ret +*/ +TEST_UNARY_CALL_CVT (float, long, __builtin_lfloorf) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c new file mode 100644 index 00000000000..3b710485e88 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c @@ -0,0 +1,69 @@ +/* { dg-do run { target { riscv_v && rv64 } } } */ +/* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ + +#include "test-math.h" + +#define ARRAY_SIZE 128 + +double in[ARRAY_SIZE]; +long out[ARRAY_SIZE]; +long ref[ARRAY_SIZE]; + +TEST_UNARY_CALL_CVT (double, long, __builtin_lfloor) +TEST_ASSERT (long) + +TEST_INIT_CVT (double, 1.2, long, __builtin_lfloor (1.2), 1) +TEST_INIT_CVT (double, -1.2, long, __builtin_lfloor (-1.2), 2) +TEST_INIT_CVT (double, 0.5, long, __builtin_lfloor (0.5), 3) +TEST_INIT_CVT (double, -0.5, long, __builtin_lfloor (-0.5), 4) +TEST_INIT_CVT (double, 0.1, long, __builtin_lfloor (0.1), 5) +TEST_INIT_CVT (double, -0.1, long, __builtin_lfloor (-0.1), 6) +TEST_INIT_CVT (double, 3.0, long, __builtin_lfloor (3.0), 7) +TEST_INIT_CVT (double, -3.0, long, __builtin_lfloor (-3.0), 8) +TEST_INIT_CVT (double, 4503599627370495.5, long, __builtin_lfloor (4503599627370495.5), 9) +TEST_INIT_CVT (double, 4503599627370497.0, long, __builtin_lfloor (4503599627370497.0), 10) +TEST_INIT_CVT (double, -4503599627370495.5, long, __builtin_lfloor (-4503599627370495.5), 11) +TEST_INIT_CVT (double, -4503599627370496.0, long, __builtin_lfloor (-4503599627370496.0), 12) +TEST_INIT_CVT (double, 0.0, long, __builtin_lfloor (-0.0), 13) +TEST_INIT_CVT (double, -0.0, long, __builtin_lfloor (-0.0), 14) +TEST_INIT_CVT (double, 9223372036854774784.0, long, __builtin_lfloor (9223372036854774784.0), 15) +TEST_INIT_CVT (double, 9223372036854775808.0, long, 0x7fffffffffffffff, 16) +TEST_INIT_CVT (double, -9223372036854775808.0, long, __builtin_lfloor (-9223372036854775808.0), 17) +TEST_INIT_CVT (double, -9223372036854777856.0, long, 0x8000000000000000, 18) +TEST_INIT_CVT (double, __builtin_inf (), long, __builtin_lfloor (__builtin_inf ()), 19) +TEST_INIT_CVT (double, -__builtin_inf (), long, __builtin_lfloor (-__builtin_inf ()), 20) +TEST_INIT_CVT (double, __builtin_nan (""), long, 0x7fffffffffffffff, 21) + +/* + Similar to lround, some reference are hard-code instead of leveraging + scalar __builtin_lfloor because the return value of a NaN or an infinity, + or the rounded value is too large to be stored in a long is UNSPECIFIED. +*/ + +int +main () +{ + RUN_TEST_CVT (double, long, 1, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 2, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 3, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 4, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 5, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 6, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 7, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 8, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 9, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 10, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 11, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 12, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 13, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 14, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 15, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 16, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 17, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 18, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 19, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 20, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 21, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c new file mode 100644 index 00000000000..60f50fc8836 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c @@ -0,0 +1,69 @@ +/* { dg-do run { target { riscv_v && rv32 } } } */ +/* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ + +#include "test-math.h" + +#define ARRAY_SIZE 128 + +float in[ARRAY_SIZE]; +long out[ARRAY_SIZE]; +long ref[ARRAY_SIZE]; + +TEST_UNARY_CALL_CVT (float, long, __builtin_lfloorf) +TEST_ASSERT (long) + +TEST_INIT_CVT (float, 1.2, long, __builtin_lfloorf (1.2), 1) +TEST_INIT_CVT (float, -1.2, long, __builtin_lfloorf (-1.2), 2) +TEST_INIT_CVT (float, 0.5, long, __builtin_lfloorf (0.5), 3) +TEST_INIT_CVT (float, -0.5, long, __builtin_lfloorf (-0.5), 4) +TEST_INIT_CVT (float, 0.1, long, __builtin_lfloorf (0.1), 5) +TEST_INIT_CVT (float, -0.1, long, __builtin_lfloorf (-0.1), 6) +TEST_INIT_CVT (float, 3.0, long, __builtin_lfloorf (3.0), 7) +TEST_INIT_CVT (float, -3.0, long, __builtin_lfloorf (-3.0), 8) +TEST_INIT_CVT (float, 8388607.5, long, __builtin_lfloorf (8388607.5), 9) +TEST_INIT_CVT (float, 8388609.0, long, __builtin_lfloorf (8388609.0), 10) +TEST_INIT_CVT (float, -8388607.5, long, __builtin_lfloorf (-8388607.5), 11) +TEST_INIT_CVT (float, -8388609.0, long, __builtin_lfloorf (-8388609.0), 12) +TEST_INIT_CVT (float, 0.0, long, __builtin_lfloorf (-0.0), 13) +TEST_INIT_CVT (float, -0.0, long, __builtin_lfloorf (-0.0), 14) +TEST_INIT_CVT (float, 2147483520.0, long, __builtin_lfloorf (2147483520.0), 15) +TEST_INIT_CVT (float, 2147483648.0, long, 0x7fffffff, 16) +TEST_INIT_CVT (float, -2147483648.0, long, __builtin_lfloorf (-2147483648.0), 17) +TEST_INIT_CVT (float, -2147483904.0, long, 0x80000000, 18) +TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lfloorf (__builtin_inff ()), 19) +TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lfloorf (-__builtin_inff ()), 20) +TEST_INIT_CVT (float, __builtin_nanf (""), long, 0x7fffffff, 21) + +/* + Similar to lround, some reference are hard-code instead of leveraging + scalar __builtin_lfloor because the return value of a NaN or an infinity, + or the rounded value is too large to be stored in a long is UNSPECIFIED. +*/ + +int +main () +{ + RUN_TEST_CVT (float, long, 1, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 2, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 3, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 4, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 5, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 6, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 7, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 8, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 9, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 10, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 11, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 12, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 13, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 14, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 15, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 16, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 17, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 18, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 19, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 20, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 21, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c new file mode 100644 index 00000000000..fe61e997de4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -ffast-math -fdump-tree-optimized" } */ + +#include "def.h" + +DEF_OP_V_CVT (lfloor, 1, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 2, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 4, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 8, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 16, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 32, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 64, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 128, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 256, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 512, double, long, __builtin_lfloor) + +/* { dg-final { scan-assembler-not {csrr} } } */ +/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */ +/* { dg-final { scan-assembler-times {vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+} 9 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c new file mode 100644 index 00000000000..a64e5c4d252 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv_zvl4096b -mabi=ilp32f -O3 --param=riscv-autovec-lmul=m8 -ffast-math -fdump-tree-optimized" } */ + +#include "def.h" + +DEF_OP_V_CVT (lfloorf, 1, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 2, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 4, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 8, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 16, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 32, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 64, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 128, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 256, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 512, float, long, __builtin_lfloorf) + +/* { dg-final { scan-assembler-not {csrr} } } */ +/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */ +/* { dg-final { scan-assembler-times {vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+} 9 } } */
Committed, thanks Juzhe.
Pan
From: juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
Sent: Friday, October 13, 2023 9:42 AM
To: Li, Pan2 <pan2.li@intel.com>; gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Li, Pan2 <pan2.li@intel.com>; Wang, Yanzhang <yanzhang.wang@intel.com>; kito.cheng <kito.cheng@gmail.com>
Subject: Re: [PATCH v1] RISC-V: Support FP lfloor/lfloorf auto vectorization
OK.
diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index 267691a0095..c5b1e52cbf9 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -2242,6 +2242,7 @@ (define_expand "<u>avg<v_double_trunc>3_ceil" ;; - lrint/lrintf ;; - irintf ;; - lceil/lceilf +;; - lfloor/lfloorf ;; ------------------------------------------------------------------------- (define_expand "ceil<mode>2" [(match_operand:V_VLSF 0 "register_operand") @@ -2342,3 +2343,13 @@ (define_expand "lceil<mode><v_i_l_ll_convert>2" DONE; } ) + +(define_expand "lfloor<mode><v_i_l_ll_convert>2" + [(match_operand:<V_I_L_LL_CONVERT> 0 "register_operand") + (match_operand:V_VLS_FCONVERT_I_L_LL 1 "register_operand")] + "TARGET_VECTOR && !flag_trapping_math && !flag_rounding_math" + { + riscv_vector::expand_vec_lfloor (operands[0], operands[1], <MODE>mode, <V_I_L_LL_CONVERT>mode); + DONE; + } +) diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index ab65ab19524..49bdcdf2f93 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -304,6 +304,7 @@ enum insn_type : unsigned int UNARY_OP_FRM_DYN = UNARY_OP | FRM_DYN_P, UNARY_OP_FRM_RMM = UNARY_OP | FRM_RMM_P, UNARY_OP_FRM_RUP = UNARY_OP | FRM_RUP_P, + UNARY_OP_FRM_RDN = UNARY_OP | FRM_RDN_P, UNARY_OP_TAMU_FRM_DYN = UNARY_OP_TAMU | FRM_DYN_P, UNARY_OP_TAMU_FRM_RUP = UNARY_OP_TAMU | FRM_RUP_P, UNARY_OP_TAMU_FRM_RDN = UNARY_OP_TAMU | FRM_RDN_P, @@ -479,6 +480,7 @@ void expand_vec_roundeven (rtx, rtx, machine_mode, machine_mode); void expand_vec_lrint (rtx, rtx, machine_mode, machine_mode); void expand_vec_lround (rtx, rtx, machine_mode, machine_mode); void expand_vec_lceil (rtx, rtx, machine_mode, machine_mode); +void expand_vec_lfloor (rtx, rtx, machine_mode, machine_mode); #endif bool sew64_scalar_helper (rtx *, rtx *, rtx, machine_mode, bool, void (*)(rtx *, rtx)); diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index b03213dd8ed..21d86c3f917 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -4142,4 +4142,14 @@ expand_vec_lceil (rtx op_0, rtx op_1, machine_mode vec_fp_mode, emit_vec_cvt_x_f (op_0, op_1, UNARY_OP_FRM_RUP, vec_fp_mode); } +void +expand_vec_lfloor (rtx op_0, rtx op_1, machine_mode vec_fp_mode, + machine_mode vec_long_mode) +{ + gcc_assert (known_eq (GET_MODE_SIZE (vec_fp_mode), + GET_MODE_SIZE (vec_long_mode))); + + emit_vec_cvt_x_f (op_0, op_1, UNARY_OP_FRM_RDN, vec_fp_mode); +} + } // namespace riscv_vector diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c new file mode 100644 index 00000000000..ac2d1722300 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-0.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "test-math.h" + +/* +** test_double_long___builtin_lfloor: +** frrm\s+[atx][0-9]+ +** ... +** fsrmi\s+2 +** ... +** vsetvli\s+[atx][0-9]+,\s*zero,\s*e64,\s*m1,\s*ta,\s*ma +** vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+ +** ... +** fsrm\s+[atx][0-9]+ +** ret +*/ +TEST_UNARY_CALL_CVT (double, long, __builtin_lfloor) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c new file mode 100644 index 00000000000..164e97c17d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32f -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "test-math.h" + +/* +** test_float_long___builtin_lfloorf: +** frrm\s+[atx][0-9]+ +** ... +** fsrmi\s+2 +** ... +** vsetvli\s+[atx][0-9]+,\s*zero,\s*e32,\s*m1,\s*ta,\s*ma +** vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+ +** ... +** fsrm\s+[atx][0-9]+ +** ret +*/ +TEST_UNARY_CALL_CVT (float, long, __builtin_lfloorf) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c new file mode 100644 index 00000000000..3b710485e88 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-0.c @@ -0,0 +1,69 @@ +/* { dg-do run { target { riscv_v && rv64 } } } */ +/* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ + +#include "test-math.h" + +#define ARRAY_SIZE 128 + +double in[ARRAY_SIZE]; +long out[ARRAY_SIZE]; +long ref[ARRAY_SIZE]; + +TEST_UNARY_CALL_CVT (double, long, __builtin_lfloor) +TEST_ASSERT (long) + +TEST_INIT_CVT (double, 1.2, long, __builtin_lfloor (1.2), 1) +TEST_INIT_CVT (double, -1.2, long, __builtin_lfloor (-1.2), 2) +TEST_INIT_CVT (double, 0.5, long, __builtin_lfloor (0.5), 3) +TEST_INIT_CVT (double, -0.5, long, __builtin_lfloor (-0.5), 4) +TEST_INIT_CVT (double, 0.1, long, __builtin_lfloor (0.1), 5) +TEST_INIT_CVT (double, -0.1, long, __builtin_lfloor (-0.1), 6) +TEST_INIT_CVT (double, 3.0, long, __builtin_lfloor (3.0), 7) +TEST_INIT_CVT (double, -3.0, long, __builtin_lfloor (-3.0), 8) +TEST_INIT_CVT (double, 4503599627370495.5, long, __builtin_lfloor (4503599627370495.5), 9) +TEST_INIT_CVT (double, 4503599627370497.0, long, __builtin_lfloor (4503599627370497.0), 10) +TEST_INIT_CVT (double, -4503599627370495.5, long, __builtin_lfloor (-4503599627370495.5), 11) +TEST_INIT_CVT (double, -4503599627370496.0, long, __builtin_lfloor (-4503599627370496.0), 12) +TEST_INIT_CVT (double, 0.0, long, __builtin_lfloor (-0.0), 13) +TEST_INIT_CVT (double, -0.0, long, __builtin_lfloor (-0.0), 14) +TEST_INIT_CVT (double, 9223372036854774784.0, long, __builtin_lfloor (9223372036854774784.0), 15) +TEST_INIT_CVT (double, 9223372036854775808.0, long, 0x7fffffffffffffff, 16) +TEST_INIT_CVT (double, -9223372036854775808.0, long, __builtin_lfloor (-9223372036854775808.0), 17) +TEST_INIT_CVT (double, -9223372036854777856.0, long, 0x8000000000000000, 18) +TEST_INIT_CVT (double, __builtin_inf (), long, __builtin_lfloor (__builtin_inf ()), 19) +TEST_INIT_CVT (double, -__builtin_inf (), long, __builtin_lfloor (-__builtin_inf ()), 20) +TEST_INIT_CVT (double, __builtin_nan (""), long, 0x7fffffffffffffff, 21) + +/* + Similar to lround, some reference are hard-code instead of leveraging + scalar __builtin_lfloor because the return value of a NaN or an infinity, + or the rounded value is too large to be stored in a long is UNSPECIFIED. +*/ + +int +main () +{ + RUN_TEST_CVT (double, long, 1, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 2, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 3, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 4, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 5, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 6, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 7, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 8, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 9, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 10, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 11, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 12, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 13, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 14, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 15, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 16, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 17, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 18, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 19, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 20, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (double, long, 21, __builtin_lfloor, in, out, ref, ARRAY_SIZE); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c new file mode 100644 index 00000000000..60f50fc8836 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-lfloor-run-1.c @@ -0,0 +1,69 @@ +/* { dg-do run { target { riscv_v && rv32 } } } */ +/* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ + +#include "test-math.h" + +#define ARRAY_SIZE 128 + +float in[ARRAY_SIZE]; +long out[ARRAY_SIZE]; +long ref[ARRAY_SIZE]; + +TEST_UNARY_CALL_CVT (float, long, __builtin_lfloorf) +TEST_ASSERT (long) + +TEST_INIT_CVT (float, 1.2, long, __builtin_lfloorf (1.2), 1) +TEST_INIT_CVT (float, -1.2, long, __builtin_lfloorf (-1.2), 2) +TEST_INIT_CVT (float, 0.5, long, __builtin_lfloorf (0.5), 3) +TEST_INIT_CVT (float, -0.5, long, __builtin_lfloorf (-0.5), 4) +TEST_INIT_CVT (float, 0.1, long, __builtin_lfloorf (0.1), 5) +TEST_INIT_CVT (float, -0.1, long, __builtin_lfloorf (-0.1), 6) +TEST_INIT_CVT (float, 3.0, long, __builtin_lfloorf (3.0), 7) +TEST_INIT_CVT (float, -3.0, long, __builtin_lfloorf (-3.0), 8) +TEST_INIT_CVT (float, 8388607.5, long, __builtin_lfloorf (8388607.5), 9) +TEST_INIT_CVT (float, 8388609.0, long, __builtin_lfloorf (8388609.0), 10) +TEST_INIT_CVT (float, -8388607.5, long, __builtin_lfloorf (-8388607.5), 11) +TEST_INIT_CVT (float, -8388609.0, long, __builtin_lfloorf (-8388609.0), 12) +TEST_INIT_CVT (float, 0.0, long, __builtin_lfloorf (-0.0), 13) +TEST_INIT_CVT (float, -0.0, long, __builtin_lfloorf (-0.0), 14) +TEST_INIT_CVT (float, 2147483520.0, long, __builtin_lfloorf (2147483520.0), 15) +TEST_INIT_CVT (float, 2147483648.0, long, 0x7fffffff, 16) +TEST_INIT_CVT (float, -2147483648.0, long, __builtin_lfloorf (-2147483648.0), 17) +TEST_INIT_CVT (float, -2147483904.0, long, 0x80000000, 18) +TEST_INIT_CVT (float, __builtin_inf (), long, __builtin_lfloorf (__builtin_inff ()), 19) +TEST_INIT_CVT (float, -__builtin_inf (), long, __builtin_lfloorf (-__builtin_inff ()), 20) +TEST_INIT_CVT (float, __builtin_nanf (""), long, 0x7fffffff, 21) + +/* + Similar to lround, some reference are hard-code instead of leveraging + scalar __builtin_lfloor because the return value of a NaN or an infinity, + or the rounded value is too large to be stored in a long is UNSPECIFIED. +*/ + +int +main () +{ + RUN_TEST_CVT (float, long, 1, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 2, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 3, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 4, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 5, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 6, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 7, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 8, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 9, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 10, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 11, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 12, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 13, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 14, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 15, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 16, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 17, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 18, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 19, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 20, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + RUN_TEST_CVT (float, long, 21, __builtin_lfloorf, in, out, ref, ARRAY_SIZE); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c new file mode 100644 index 00000000000..fe61e997de4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-0.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -ffast-math -fdump-tree-optimized" } */ + +#include "def.h" + +DEF_OP_V_CVT (lfloor, 1, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 2, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 4, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 8, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 16, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 32, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 64, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 128, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 256, double, long, __builtin_lfloor) +DEF_OP_V_CVT (lfloor, 512, double, long, __builtin_lfloor) + +/* { dg-final { scan-assembler-not {csrr} } } */ +/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */ +/* { dg-final { scan-assembler-times {vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+} 9 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c new file mode 100644 index 00000000000..a64e5c4d252 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-lfloor-1.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv_zvl4096b -mabi=ilp32f -O3 --param=riscv-autovec-lmul=m8 -ffast-math -fdump-tree-optimized" } */ + +#include "def.h" + +DEF_OP_V_CVT (lfloorf, 1, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 2, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 4, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 8, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 16, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 32, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 64, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 128, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 256, float, long, __builtin_lfloorf) +DEF_OP_V_CVT (lfloorf, 512, float, long, __builtin_lfloorf) + +/* { dg-final { scan-assembler-not {csrr} } } */ +/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */ +/* { dg-final { scan-assembler-times {vfcvt\.x\.f\.v\s+v[0-9]+,\s*v[0-9]+} 9 } } */