I would prefer first approach since it no changes other than adding
testcase, that might confusing other people.


Li, Pan2 <pan2...@intel.com> 於 2023年10月11日 週三 23:12 寫道:

> Sorry for misleading here.
>
> When implement the llrint after lrint, I realize llrint (DF => SF) are
> supported by the lrint already in the previous patche(es).
> Because they same the same standard name as well as the mode iterator.
>
> Thus, I may have 2 options here for the patch naming.
>
> 1. Only mentioned test cases for llrint.
> 2. Named as support similar to lrint.
>
> After some consideration from the situation like search from the git logs,
> I choose option 2 here and add some description in
> as well.
>
> Finally, is there any best practices for this case? Thank again for
> comments.
>
> Pan
>
> -----Original Message-----
> From: Kito Cheng <kito.ch...@gmail.com>
> Sent: Thursday, October 12, 2023 1:05 PM
> To: Li, Pan2 <pan2...@intel.com>
> Cc: juzhe.zh...@rivai.ai; gcc-patches <gcc-patches@gcc.gnu.org>; Wang,
> Yanzhang <yanzhang.w...@intel.com>
> Subject: Re: [PATCH v1] RISC-V: Support FP llrint auto vectorization
>
> Did I miss something? the title says support but it seems only testcase??
>
> On Wed, Oct 11, 2023 at 8:38 PM Li, Pan2 <pan2...@intel.com> wrote:
> >
> > Committed, thanks Juzhe.
> >
> >
> >
> > Pan
> >
> >
> >
> > From: juzhe.zh...@rivai.ai <juzhe.zh...@rivai.ai>
> > Sent: Thursday, October 12, 2023 11:34 AM
> > To: Li, Pan2 <pan2...@intel.com>; gcc-patches <gcc-patches@gcc.gnu.org>
> > Cc: Li, Pan2 <pan2...@intel.com>; Wang, Yanzhang <
> yanzhang.w...@intel.com>; kito.cheng <kito.ch...@gmail.com>
> > Subject: Re: [PATCH v1] RISC-V: Support FP llrint auto vectorization
> >
> >
> >
> > LGTM
> >
> >
> >
> > ________________________________
> >
> > juzhe.zh...@rivai.ai
> >
> >
> >
> > From: pan2.li
> >
> > Date: 2023-10-12 11:28
> >
> > To: gcc-patches
> >
> > CC: juzhe.zhong; pan2.li; yanzhang.wang; kito.cheng
> >
> > Subject: [PATCH v1] RISC-V: Support FP llrint auto vectorization
> >
> > From: Pan Li <pan2...@intel.com>
> >
> >
> >
> > This patch would like to support the FP llrint auto vectorization.
> >
> >
> >
> > * long long llrint (double)
> >
> >
> >
> > This will be the CVT from DF => DI from the standard name's perpsective,
> >
> > which has been covered in previous PATCH(es). Thus, this patch only add
> >
> > some test cases.
> >
> >
> >
> > gcc/testsuite/ChangeLog:
> >
> >
> >
> > * gcc.target/riscv/rvv/autovec/unop/test-math.h: Add type int64_t.
> >
> > * gcc.target/riscv/rvv/autovec/unop/math-llrint-0.c: New test.
> >
> > * gcc.target/riscv/rvv/autovec/unop/math-llrint-run-0.c: New test.
> >
> > * gcc.target/riscv/rvv/autovec/vls/math-llrint-0.c: New test.
> >
> >
> >
> > Signed-off-by: Pan Li <pan2...@intel.com>
> >
> > ---
> >
> > .../riscv/rvv/autovec/unop/math-llrint-0.c    | 14 +++++
> >
> > .../rvv/autovec/unop/math-llrint-run-0.c      | 63 +++++++++++++++++++
> >
> > .../riscv/rvv/autovec/unop/test-math.h        |  2 +
> >
> > .../riscv/rvv/autovec/vls/math-llrint-0.c     | 30 +++++++++
> >
> > 4 files changed, 109 insertions(+)
> >
> > create mode 100644
> gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-0.c
> >
> > create mode 100644
> gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-run-0.c
> >
> > create mode 100644
> gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-llrint-0.c
> >
> >
> >
> > diff --git
> a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-0.c
> b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-0.c
> >
> > new file mode 100644
> >
> > index 00000000000..2d90d232ba1
> >
> > --- /dev/null
> >
> > +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-0.c
> >
> > @@ -0,0 +1,14 @@
> >
> > +/* { 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_int64_t___builtin_llrint:
> >
> > +**   ...
> >
> > +**   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]+
> >
> > +**   ...
> >
> > +*/
> >
> > +TEST_UNARY_CALL_CVT (double, int64_t, __builtin_llrint)
> >
> > diff --git
> a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-run-0.c
> b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-run-0.c
> >
> > new file mode 100644
> >
> > index 00000000000..6b69f5568e9
> >
> > --- /dev/null
> >
> > +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/math-llrint-run-0.c
> >
> > @@ -0,0 +1,63 @@
> >
> > +/* { 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];
> >
> > +int64_t out[ARRAY_SIZE];
> >
> > +int64_t ref[ARRAY_SIZE];
> >
> > +
> >
> > +TEST_UNARY_CALL_CVT (double, int64_t, __builtin_llrint)
> >
> > +TEST_ASSERT (int64_t)
> >
> > +
> >
> > +TEST_INIT_CVT (double, 1.2, int64_t, __builtin_llrint (1.2), 1)
> >
> > +TEST_INIT_CVT (double, -1.2, int64_t, __builtin_llrint (-1.2), 2)
> >
> > +TEST_INIT_CVT (double, 0.5, int64_t, __builtin_llrint (0.5), 3)
> >
> > +TEST_INIT_CVT (double, -0.5, int64_t, __builtin_llrint (-0.5), 4)
> >
> > +TEST_INIT_CVT (double, 0.1, int64_t, __builtin_llrint (0.1), 5)
> >
> > +TEST_INIT_CVT (double, -0.1, int64_t, __builtin_llrint (-0.1), 6)
> >
> > +TEST_INIT_CVT (double, 3.0, int64_t, __builtin_llrint (3.0), 7)
> >
> > +TEST_INIT_CVT (double, -3.0, int64_t, __builtin_llrint (-3.0), 8)
> >
> > +TEST_INIT_CVT (double, 4503599627370495.5, int64_t, __builtin_llrint
> (4503599627370495.5), 9)
> >
> > +TEST_INIT_CVT (double, 4503599627370497.0, int64_t, __builtin_llrint
> (4503599627370497.0), 10)
> >
> > +TEST_INIT_CVT (double, -4503599627370495.5, int64_t, __builtin_llrint
> (-4503599627370495.5), 11)
> >
> > +TEST_INIT_CVT (double, -4503599627370496.0, int64_t, __builtin_llrint
> (-4503599627370496.0), 12)
> >
> > +TEST_INIT_CVT (double, 0.0, int64_t, __builtin_llrint (-0.0), 13)
> >
> > +TEST_INIT_CVT (double, -0.0, int64_t, __builtin_llrint (-0.0), 14)
> >
> > +TEST_INIT_CVT (double, 9223372036854774784.0, int64_t, __builtin_llrint
> (9223372036854774784.0), 15)
> >
> > +TEST_INIT_CVT (double, 9223372036854775808.0, int64_t, __builtin_llrint
> (9223372036854775808.0), 16)
> >
> > +TEST_INIT_CVT (double, -9223372036854775808.0, int64_t,
> __builtin_llrint (-9223372036854775808.0), 17)
> >
> > +TEST_INIT_CVT (double, -9223372036854777856.0, int64_t,
> __builtin_llrint (-9223372036854777856.0), 18)
> >
> > +TEST_INIT_CVT (double, __builtin_inf (), int64_t, __builtin_llrint
> (__builtin_inf ()), 19)
> >
> > +TEST_INIT_CVT (double, -__builtin_inf (), int64_t, __builtin_llrint
> (-__builtin_inf ()), 20)
> >
> > +TEST_INIT_CVT (double, __builtin_nan (""), int64_t, 0x7fffffffffffffff,
> 21)
> >
> > +
> >
> > +int
> >
> > +main ()
> >
> > +{
> >
> > +  RUN_TEST_CVT (double, int64_t, 1, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 2, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 3, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 4, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 5, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 6, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 7, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 8, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 9, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 10, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 11, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 12, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 13, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 14, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 15, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 16, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 17, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 18, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 19, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 20, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +  RUN_TEST_CVT (double, int64_t, 21, __builtin_llrint, in, out, ref,
> ARRAY_SIZE);
> >
> > +
> >
> > +  return 0;
> >
> > +}
> >
> > diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/test-math.h
> b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/test-math.h
> >
> > index a1c9d55bd48..3867bc50a14 100644
> >
> > --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/test-math.h
> >
> > +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/test-math.h
> >
> > @@ -68,6 +68,8 @@
> >
> > #define FRM_RMM 4
> >
> > #define FRM_DYN 7
> >
> > +typedef long long int64_t;
> >
> > +
> >
> > static inline void
> >
> > set_rm (unsigned rm)
> >
> > {
> >
> > diff --git
> a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-llrint-0.c
> b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-llrint-0.c
> >
> > new file mode 100644
> >
> > index 00000000000..b0bf422f685
> >
> > --- /dev/null
> >
> > +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/math-llrint-0.c
> >
> > @@ -0,0 +1,30 @@
> >
> > +/* { dg-do compile } */
> >
> > +/* { dg-options "-march=rv64gcv_zvl4096b -mabi=lp64d -O3
> --param=riscv-autovec-lmul=m8 -ffast-math -fdump-tree-optimized" } */
> >
> > +
> >
> > +#include "def.h"
> >
> > +
> >
> > +DEF_OP_V_CVT (llrint, 1, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 2, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 4, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 8, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 16, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 32, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 64, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 128, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 256, double, int64_t, __builtin_llrint)
> >
> > +DEF_OP_V_CVT (llrint, 512, double, int64_t, __builtin_llrint)
> >
> > +
> >
> > +/* { 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 } } */
> >
> > --
> >
> > 2.34.1
> >
> >
> >
> >
>

Reply via email to