public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kito Cheng <kito@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1170] RISC-V: Fix a bug that is the CMO builtins are missing parameter Date: Mon, 20 Jun 2022 08:45:09 +0000 (GMT) [thread overview] Message-ID: <20220620084509.B86253858C51@sourceware.org> (raw) https://gcc.gnu.org/g:970b03c0037549a571ecea9afa41de78eb859b3a commit r13-1170-g970b03c0037549a571ecea9afa41de78eb859b3a Author: yulong <shiyulong@iscas.ac.cn> Date: Wed Jun 8 10:19:21 2022 +0800 RISC-V: Fix a bug that is the CMO builtins are missing parameter We changed builtins format about zicbom and zicboz subextensions and modified test cases. diff with the previous version: 1.We modified the FUNCTION_TYPE from RISCV_VOID_FTYPE_SI/DI to RISCV_VOID_FTYPE_VOID_PTR. 2.We added a new RISCV_ATYPE_VOID_PTR in riscv-builtins.cc and a new DEF_RISCV_FTYPE (1, (VOID, VOID_PTR)) in riscv-ftypes.def. 3.We deleted DEF_RISCV_FTYPE (1, (VOID, SI/DI)). 4.We modified the input parameters of the test cases. Thanks, Simon and Kito. gcc/ChangeLog: * config/riscv/riscv-builtins.cc (RISCV_ATYPE_VOID_PTR): New. * config/riscv/riscv-cmo.def (RISCV_BUILTIN): Changed the FUNCTION_TYPE of RISCV_BUILTIN. * config/riscv/riscv-ftypes.def (0): Remove unused. (1): New. gcc/testsuite/ChangeLog: * gcc.target/riscv/cmo-zicbom-1.c: modified the input parameters. * gcc.target/riscv/cmo-zicbom-2.c: modified the input parameters. * gcc.target/riscv/cmo-zicboz-1.c: modified the input parameters. * gcc.target/riscv/cmo-zicboz-2.c: modified the input parameters. Diff: --- gcc/config/riscv/riscv-builtins.cc | 1 + gcc/config/riscv/riscv-cmo.def | 16 ++++++++-------- gcc/config/riscv/riscv-ftypes.def | 3 +-- gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 26 +++++++++++++++++--------- gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 26 +++++++++++++++++--------- gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 10 +++++++--- gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 10 +++++++--- 7 files changed, 58 insertions(+), 34 deletions(-) diff --git a/gcc/config/riscv/riscv-builtins.cc b/gcc/config/riscv/riscv-builtins.cc index 795132a0c16..1218fdfc67d 100644 --- a/gcc/config/riscv/riscv-builtins.cc +++ b/gcc/config/riscv/riscv-builtins.cc @@ -133,6 +133,7 @@ AVAIL (prefetchi64, TARGET_ZICBOP && TARGET_64BIT) #define RISCV_ATYPE_USI unsigned_intSI_type_node #define RISCV_ATYPE_SI intSI_type_node #define RISCV_ATYPE_DI intDI_type_node +#define RISCV_ATYPE_VOID_PTR ptr_type_node /* RISCV_FTYPE_ATYPESN takes N RISCV_FTYPES-like type codes and lists their associated RISCV_ATYPEs. */ diff --git a/gcc/config/riscv/riscv-cmo.def b/gcc/config/riscv/riscv-cmo.def index b30ecf96ec1..9fe5094ce1a 100644 --- a/gcc/config/riscv/riscv-cmo.def +++ b/gcc/config/riscv/riscv-cmo.def @@ -1,16 +1,16 @@ // zicbom -RISCV_BUILTIN (clean_si, "zicbom_cbo_clean", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, clean32), -RISCV_BUILTIN (clean_di, "zicbom_cbo_clean", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, clean64), +RISCV_BUILTIN (clean_si, "zicbom_cbo_clean", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, clean32), +RISCV_BUILTIN (clean_di, "zicbom_cbo_clean", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, clean64), -RISCV_BUILTIN (flush_si, "zicbom_cbo_flush", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, flush32), -RISCV_BUILTIN (flush_di, "zicbom_cbo_flush", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, flush64), +RISCV_BUILTIN (flush_si, "zicbom_cbo_flush", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, flush32), +RISCV_BUILTIN (flush_di, "zicbom_cbo_flush", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, flush64), -RISCV_BUILTIN (inval_si, "zicbom_cbo_inval", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, inval32), -RISCV_BUILTIN (inval_di, "zicbom_cbo_inval", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, inval64), +RISCV_BUILTIN (inval_si, "zicbom_cbo_inval", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, inval32), +RISCV_BUILTIN (inval_di, "zicbom_cbo_inval", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, inval64), // zicboz -RISCV_BUILTIN (zero_si, "zicboz_cbo_zero", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, zero32), -RISCV_BUILTIN (zero_di, "zicboz_cbo_zero", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, zero64), +RISCV_BUILTIN (zero_si, "zicboz_cbo_zero", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, zero32), +RISCV_BUILTIN (zero_di, "zicboz_cbo_zero", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, zero64), // zicbop RISCV_BUILTIN (prefetchi_si, "zicbop_cbo_prefetchi", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE_SI, prefetchi32), diff --git a/gcc/config/riscv/riscv-ftypes.def b/gcc/config/riscv/riscv-ftypes.def index 62421292ce7..c2b45c63ea1 100644 --- a/gcc/config/riscv/riscv-ftypes.def +++ b/gcc/config/riscv/riscv-ftypes.def @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see DEF_RISCV_FTYPE (0, (USI)) DEF_RISCV_FTYPE (1, (VOID, USI)) -DEF_RISCV_FTYPE (0, (SI)) -DEF_RISCV_FTYPE (0, (DI)) +DEF_RISCV_FTYPE (1, (VOID, VOID_PTR)) DEF_RISCV_FTYPE (1, (SI, SI)) DEF_RISCV_FTYPE (1, (DI, DI)) diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c index e2ba2183511..6341f7874d3 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c @@ -1,21 +1,29 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gc_zicbom -mabi=lp64" } */ -int foo1() +int var; + +void foo1() { - return __builtin_riscv_zicbom_cbo_clean(); + __builtin_riscv_zicbom_cbo_clean(0); + __builtin_riscv_zicbom_cbo_clean(&var); + __builtin_riscv_zicbom_cbo_clean((void*)0x111); } -int foo2() +void foo2() { - return __builtin_riscv_zicbom_cbo_flush(); + __builtin_riscv_zicbom_cbo_flush(0); + __builtin_riscv_zicbom_cbo_flush(&var); + __builtin_riscv_zicbom_cbo_flush((void*)0x111); } -int foo3() +void foo3() { - return __builtin_riscv_zicbom_cbo_inval(); + __builtin_riscv_zicbom_cbo_inval(0); + __builtin_riscv_zicbom_cbo_inval(&var); + __builtin_riscv_zicbom_cbo_inval((void*)0x111); } -/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */ -/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */ -/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.clean" 3 } } */ +/* { dg-final { scan-assembler-times "cbo.flush" 3 } } */ +/* { dg-final { scan-assembler-times "cbo.inval" 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c index a605e8b1bdc..a04f106c8b0 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c @@ -1,21 +1,29 @@ /* { dg-do compile } */ /* { dg-options "-march=rv32gc_zicbom -mabi=ilp32" } */ -int foo1() +int var; + +void foo1() { - return __builtin_riscv_zicbom_cbo_clean(); + __builtin_riscv_zicbom_cbo_clean(0); + __builtin_riscv_zicbom_cbo_clean(&var); + __builtin_riscv_zicbom_cbo_clean((void*)0x111); } -int foo2() +void foo2() { - return __builtin_riscv_zicbom_cbo_flush(); + __builtin_riscv_zicbom_cbo_flush(0); + __builtin_riscv_zicbom_cbo_flush(&var); + __builtin_riscv_zicbom_cbo_flush((void*)0x111); } -int foo3() +void foo3() { - return __builtin_riscv_zicbom_cbo_inval(); + __builtin_riscv_zicbom_cbo_inval(0); + __builtin_riscv_zicbom_cbo_inval(&var); + __builtin_riscv_zicbom_cbo_inval((void*)0x111); } -/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */ -/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */ -/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.clean" 3 } } */ +/* { dg-final { scan-assembler-times "cbo.flush" 3 } } */ +/* { dg-final { scan-assembler-times "cbo.inval" 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c index 96c1674ef2d..5eb78ab94b5 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c @@ -1,9 +1,13 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gc_zicboz -mabi=lp64" } */ -int foo1() +int var; + +void foo1() { - return __builtin_riscv_zicboz_cbo_zero(); + __builtin_riscv_zicboz_cbo_zero(0); + __builtin_riscv_zicboz_cbo_zero(&var); + __builtin_riscv_zicboz_cbo_zero((void*)0x121); } -/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.zero" 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c index 9d99839b1e7..fdc9c719669 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c @@ -1,9 +1,13 @@ /* { dg-do compile } */ /* { dg-options "-march=rv32gc_zicboz -mabi=ilp32" } */ -int foo1() +int var; + +void foo1() { - return __builtin_riscv_zicboz_cbo_zero(); + __builtin_riscv_zicboz_cbo_zero(0); + __builtin_riscv_zicboz_cbo_zero(&var); + __builtin_riscv_zicboz_cbo_zero((void*)0x121); } -/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.zero" 3 } } */
reply other threads:[~2022-06-20 8:45 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220620084509.B86253858C51@sourceware.org \ --to=kito@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).