* [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions
@ 2022-03-04 2:49 yulong
2022-03-04 2:49 ` [PATCH 1/3] RISC-V: Add mininal support for Zicbo[mzp] yulong
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: yulong @ 2022-03-04 2:49 UTC (permalink / raw)
To: gcc-patches
Cc: andrew, palmer, kito.cheng, jim.wilson.gcc, research_trasio,
wuwei2016, cmuellner, ptomsich, sinan, jiawei, shihua,
yulong-plct
From: yulong-plct <yulong@nj.iscas.ac.cn>
This patchset adds support for three recently ratified RISC-V extensions:
- Zicbom (Cache-Block Management Instructions)
- Zicbop (Cache-Block Prefetch hint instructions)
- Zicboz (Cache-Block Zero Instructions)
Patch 1: Add Zicbom/z/p mininal support
Patch 2: Add Zicbom/z/p instructions arch support
Patch 3: Add Zicbom/z/p instructions testcases
cf. <https://github.com/riscv/riscv-CMOs/blob/fc8e97a9531ac9811971a182ae431976b86216e1/specifications/cmobase-v1.0-rc2.pdf>
*** BLURB HERE ***
yulong-plct (3):
RISC-V: Add mininal support for Zicbo[mzp]
RISC-V:Cache Management Operation instructions
RISC-V:Cache Management Operation instructions testcases
gcc/common/config/riscv/riscv-common.cc | 6 +++
gcc/config/riscv/predicates.md | 4 ++
gcc/config/riscv/riscv-builtins.cc | 16 ++++++
gcc/config/riscv/riscv-cmo.def | 17 ++++++
gcc/config/riscv/riscv-ftypes.def | 4 ++
gcc/config/riscv/riscv-opts.h | 9 ++++
gcc/config/riscv/riscv.md | 52 +++++++++++++++++++
gcc/config/riscv/riscv.opt | 3 ++
gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 21 ++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 21 ++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 23 ++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 23 ++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 9 ++++
gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 9 ++++
14 files changed, 217 insertions(+)
create mode 100644 gcc/config/riscv/riscv-cmo.def
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] RISC-V: Add mininal support for Zicbo[mzp]
2022-03-04 2:49 [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions yulong
@ 2022-03-04 2:49 ` yulong
2022-03-04 2:49 ` [PATCH 2/3] RISC-V:Cache Management Operation instructions yulong
2022-03-04 2:49 ` [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases yulong
2 siblings, 0 replies; 8+ messages in thread
From: yulong @ 2022-03-04 2:49 UTC (permalink / raw)
To: gcc-patches
Cc: andrew, palmer, kito.cheng, jim.wilson.gcc, research_trasio,
wuwei2016, cmuellner, ptomsich, sinan, jiawei, shihua,
yulong-plct
From: yulong-plct <yulong@nj.iscas.ac.cn>
This commit adds minimal support for 'Zicbom','Zicboz' and 'Zicbop' extensions.
7
8 gcc/ChangeLog:
9
10 * common/config/riscv/riscv-common.cc: Add zicbom, zicboz, zicbop extensions.
11 * config/riscv/riscv-opts.h (MASK_ZICBOZ): New.
12 (MASK_ZICBOM): New.
13 (MASK_ZICBOP): New.
14 (TARGET_ZICBOZ): New.
15 (TARGET_ZICBOM): New.
16 (TARGET_ZICBOP): New.
17 * config/riscv/riscv.opt: New.
---
gcc/common/config/riscv/riscv-common.cc | 6 ++++++
gcc/config/riscv/riscv-opts.h | 9 +++++++++
gcc/config/riscv/riscv.opt | 3 +++
3 files changed, 18 insertions(+)
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index a904893b9ed..3ba8f240977 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -164,6 +164,9 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
{"zksed", ISA_SPEC_CLASS_NONE, 1, 0},
{"zksh", ISA_SPEC_CLASS_NONE, 1, 0},
{"zkt", ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zicboz",ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zicbom",ISA_SPEC_CLASS_NONE, 1, 0},
+ {"zicbop",ISA_SPEC_CLASS_NONE, 1, 0},
{"zve32x", ISA_SPEC_CLASS_NONE, 1, 0},
{"zve32f", ISA_SPEC_CLASS_NONE, 1, 0},
@@ -1049,6 +1052,9 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
{"zksed", &gcc_options::x_riscv_zk_subext, MASK_ZKSED},
{"zksh", &gcc_options::x_riscv_zk_subext, MASK_ZKSH},
{"zkt", &gcc_options::x_riscv_zk_subext, MASK_ZKT},
+ {"zicboz", &gcc_options::x_riscv_zicmo_subext, MASK_ZICBOZ},
+ {"zicbom", &gcc_options::x_riscv_zicmo_subext, MASK_ZICBOM},
+ {"zicbop", &gcc_options::x_riscv_zicmo_subext, MASK_ZICBOP},
{"zve32x", &gcc_options::x_target_flags, MASK_VECTOR},
{"zve32f", &gcc_options::x_target_flags, MASK_VECTOR},
diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h
index 929e4e3a7c5..d17cf6ea18a 100644
--- a/gcc/config/riscv/riscv-opts.h
+++ b/gcc/config/riscv/riscv-opts.h
@@ -83,6 +83,15 @@ enum stack_protector_guard {
#define TARGET_ZBC ((riscv_zb_subext & MASK_ZBC) != 0)
#define TARGET_ZBS ((riscv_zb_subext & MASK_ZBS) != 0)
+#define MASK_ZICBOZ (1 << 0)
+#define MASK_ZICBOM (1 << 1)
+#define MASK_ZICBOP (1 << 2)
+
+
+#define TARGET_ZICBOZ ((riscv_zicmo_subext & MASK_ZICBOZ) != 0)
+#define TARGET_ZICBOM ((riscv_zicmo_subext & MASK_ZICBOM) != 0)
+#define TARGET_ZICBOP ((riscv_zicmo_subext & MASK_ZICBOP) != 0)
+
#define MASK_ZBKB (1 << 0)
#define MASK_ZBKC (1 << 1)
#define MASK_ZBKX (1 << 2)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 9fffc08220d..2058a874d31 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -200,6 +200,9 @@ int riscv_zi_subext
TargetVariable
int riscv_zb_subext
+TargetVariable
+int riscv_zicmo_subext
+
TargetVariable
int riscv_zk_subext
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] RISC-V:Cache Management Operation instructions
2022-03-04 2:49 [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions yulong
2022-03-04 2:49 ` [PATCH 1/3] RISC-V: Add mininal support for Zicbo[mzp] yulong
@ 2022-03-04 2:49 ` yulong
2022-03-04 2:49 ` [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases yulong
2 siblings, 0 replies; 8+ messages in thread
From: yulong @ 2022-03-04 2:49 UTC (permalink / raw)
To: gcc-patches
Cc: andrew, palmer, kito.cheng, jim.wilson.gcc, research_trasio,
wuwei2016, cmuellner, ptomsich, sinan, jiawei, shihua,
yulong-plct
From: yulong-plct <yulong@nj.iscas.ac.cn>
This commit adds cbo.clea,cbo.flush,cbo.inval,cbo.zero,prefetch.i,prefetch.r and prefetch.w instructions.
7
8 gcc/ChangeLog:
9
10 * config/riscv/predicates.md (imm5_operand): Add a new operand type for prefetch instructions.
11 * config/riscv/riscv-builtins.cc (AVAIL): Add new AVAILs for CMO ISA Extensions.
12 (RISCV_ATYPE_SI): New.
13 (RISCV_ATYPE_DI): New.
14 * config/riscv/riscv-ftypes.def (0): New.
15 (1): New.
16 * config/riscv/riscv.md (riscv_clean_<mode>): Add a new mode for cbo.clean instruction.
17 (riscv_flush_<mode>): Add a new mode for cbo.flush instruction.
18 (riscv_inval_<mode>): Add a new mode for cbo.inval instruction.
19 (riscv_zero_<mode>): Add a new mode for cbo.zero instruction.
20 (prefetch): Add a new mode for prefetch.r and prefetch.w instructions.
21 (riscv_prefetchi_<mode>): Add a new mode for prefetch.i instruction.
22 * config/riscv/riscv-cmo.def: New file.
---
gcc/config/riscv/predicates.md | 4 +++
gcc/config/riscv/riscv-builtins.cc | 16 +++++++++
gcc/config/riscv/riscv-cmo.def | 17 ++++++++++
gcc/config/riscv/riscv-ftypes.def | 4 +++
gcc/config/riscv/riscv.md | 52 ++++++++++++++++++++++++++++++
5 files changed, 93 insertions(+)
create mode 100644 gcc/config/riscv/riscv-cmo.def
diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index 97cdbdf053b..3fb4d95ab08 100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -239,3 +239,7 @@
(define_predicate "const63_operand"
(and (match_code "const_int")
(match_test "INTVAL (op) == 63")))
+
+(define_predicate "imm5_operand"
+ (and (match_code "const_int")
+ (match_test "INTVAL (op) < 5")))
\ No newline at end of file
diff --git a/gcc/config/riscv/riscv-builtins.cc b/gcc/config/riscv/riscv-builtins.cc
index 0658f8d3047..795132a0c16 100644
--- a/gcc/config/riscv/riscv-builtins.cc
+++ b/gcc/config/riscv/riscv-builtins.cc
@@ -87,6 +87,18 @@ struct riscv_builtin_description {
AVAIL (hard_float, TARGET_HARD_FLOAT)
+
+AVAIL (clean32, TARGET_ZICBOM && !TARGET_64BIT)
+AVAIL (clean64, TARGET_ZICBOM && TARGET_64BIT)
+AVAIL (flush32, TARGET_ZICBOM && !TARGET_64BIT)
+AVAIL (flush64, TARGET_ZICBOM && TARGET_64BIT)
+AVAIL (inval32, TARGET_ZICBOM && !TARGET_64BIT)
+AVAIL (inval64, TARGET_ZICBOM && TARGET_64BIT)
+AVAIL (zero32, TARGET_ZICBOZ && !TARGET_64BIT)
+AVAIL (zero64, TARGET_ZICBOZ && TARGET_64BIT)
+AVAIL (prefetchi32, TARGET_ZICBOP && !TARGET_64BIT)
+AVAIL (prefetchi64, TARGET_ZICBOP && TARGET_64BIT)
+
/* Construct a riscv_builtin_description from the given arguments.
INSN is the name of the associated instruction pattern, without the
@@ -119,6 +131,8 @@ AVAIL (hard_float, TARGET_HARD_FLOAT)
/* Argument types. */
#define RISCV_ATYPE_VOID void_type_node
#define RISCV_ATYPE_USI unsigned_intSI_type_node
+#define RISCV_ATYPE_SI intSI_type_node
+#define RISCV_ATYPE_DI intDI_type_node
/* RISCV_FTYPE_ATYPESN takes N RISCV_FTYPES-like type codes and lists
their associated RISCV_ATYPEs. */
@@ -128,6 +142,8 @@ AVAIL (hard_float, TARGET_HARD_FLOAT)
RISCV_ATYPE_##A, RISCV_ATYPE_##B
static const struct riscv_builtin_description riscv_builtins[] = {
+ #include "riscv-cmo.def"
+
DIRECT_BUILTIN (frflags, RISCV_USI_FTYPE, hard_float),
DIRECT_NO_TARGET_BUILTIN (fsflags, RISCV_VOID_FTYPE_USI, hard_float)
};
diff --git a/gcc/config/riscv/riscv-cmo.def b/gcc/config/riscv/riscv-cmo.def
new file mode 100644
index 00000000000..8829a1d664d
--- /dev/null
+++ b/gcc/config/riscv/riscv-cmo.def
@@ -0,0 +1,17 @@
+// zicbom
+RISCV_BUILTIN (clean_si, "clean", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, clean32),
+RISCV_BUILTIN (clean_di, "clean", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, clean64),
+
+RISCV_BUILTIN (flush_si, "flush", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, flush32),
+RISCV_BUILTIN (flush_di, "flush", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, flush64),
+
+RISCV_BUILTIN (inval_si, "inval", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, inval32),
+RISCV_BUILTIN (inval_di, "inval", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, inval64),
+
+// zicboz
+RISCV_BUILTIN (zero_si, "zero", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE, zero32),
+RISCV_BUILTIN (zero_di, "zero", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE, zero64),
+
+// zicbop
+RISCV_BUILTIN (prefetchi_si, "prefetchi", RISCV_BUILTIN_DIRECT, RISCV_SI_FTYPE_SI, prefetchi32),
+RISCV_BUILTIN (prefetchi_di, "prefetchi", RISCV_BUILTIN_DIRECT, RISCV_DI_FTYPE_DI, prefetchi64),
\ No newline at end of file
diff --git a/gcc/config/riscv/riscv-ftypes.def b/gcc/config/riscv/riscv-ftypes.def
index 2214c496f9b..62421292ce7 100644
--- a/gcc/config/riscv/riscv-ftypes.def
+++ b/gcc/config/riscv/riscv-ftypes.def
@@ -28,3 +28,7 @@ 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, (SI, SI))
+DEF_RISCV_FTYPE (1, (DI, DI))
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index b3c5bce842a..43ad6e5a481 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -45,6 +45,11 @@
;; Stack tie
UNSPEC_TIE
+ UNSPEC_CLEAN
+ UNSPEC_FLUSH
+ UNSPEC_INVAL
+ UNSPEC_ZERO
+ UNSPEC_PREI
])
(define_c_enum "unspecv" [
@@ -69,6 +74,7 @@
;; Stack Smash Protector
UNSPEC_SSP_SET
UNSPEC_SSP_TEST
+
])
(define_constants
@@ -2863,6 +2869,52 @@
"<load>\t%3, %1\;<load>\t%0, %2\;xor\t%0, %3, %0\;li\t%3, 0"
[(set_attr "length" "12")])
+(define_insn "riscv_clean_<mode>"
+[(unspec:X [(match_operand:X 0 "register_operand" "r")] UNSPEC_CLEAN)]
+"TARGET_ZICBOM"
+"cbo.clean\t%0"
+)
+
+(define_insn "riscv_flush_<mode>"
+[(unspec:X [(match_operand:X 0 "register_operand" "r")] UNSPEC_FLUSH)]
+"TARGET_ZICBOM"
+"cbo.flush\t%0"
+)
+
+(define_insn "riscv_inval_<mode>"
+[(unspec:X [(match_operand:X 0 "register_operand" "r")] UNSPEC_INVAL)]
+"TARGET_ZICBOM"
+"cbo.inval\t%0"
+)
+
+(define_insn "riscv_zero_<mode>"
+[(unspec:X [(match_operand:X 0 "register_operand" "r")] UNSPEC_ZERO)]
+"TARGET_ZICBOZ"
+"cbo.zero\t%0"
+)
+
+(define_insn "prefetch"
+[(prefetch (match_operand 0 "address_operand" "p")
+ (match_operand 1 "imm5_operand" "i")
+ (match_operand 2 "const_int_operand" "n"))]
+"TARGET_ZICBOP"
+{
+ switch (INTVAL (operands[1]))
+ {
+ case 0: return "prefetch.r\t%a0";
+ case 1: return "prefetch.w\t%a0";
+ default: gcc_unreachable ();
+ }
+})
+
+(define_insn "riscv_prefetchi_<mode>"
+[(unspec:X [(match_operand:X 0 "address_operand" "p")
+ (match_operand:X 1 "imm5_operand" "i")]
+ UNSPEC_PREI)]
+"TARGET_ZICBOP"
+"prefetch.i\t%0"
+)
+
(include "bitmanip.md")
(include "sync.md")
(include "peephole.md")
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases
2022-03-04 2:49 [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions yulong
2022-03-04 2:49 ` [PATCH 1/3] RISC-V: Add mininal support for Zicbo[mzp] yulong
2022-03-04 2:49 ` [PATCH 2/3] RISC-V:Cache Management Operation instructions yulong
@ 2022-03-04 2:49 ` yulong
2022-03-18 6:58 ` Kito Cheng
2 siblings, 1 reply; 8+ messages in thread
From: yulong @ 2022-03-04 2:49 UTC (permalink / raw)
To: gcc-patches
Cc: andrew, palmer, kito.cheng, jim.wilson.gcc, research_trasio,
wuwei2016, cmuellner, ptomsich, sinan, jiawei, shihua,
yulong-plct
From: yulong-plct <yulong@nj.iscas.ac.cn>
This commit adds testcases about CMO instructions.
7
8 gcc/testsuite/ChangeLog:
9
10 * gcc.target/riscv/cmo-zicbom-1.c: New test.
11 * gcc.target/riscv/cmo-zicbom-2.c: New test.
12 * gcc.target/riscv/cmo-zicbop-1.c: New test.
13 * gcc.target/riscv/cmo-zicbop-2.c: New test.
14 * gcc.target/riscv/cmo-zicboz-1.c: New test.
15 * gcc.target/riscv/cmo-zicboz-2.c: New test.
---
gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 21 +++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 21 +++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 23 +++++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 23 +++++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 9 ++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 9 ++++++++
6 files changed, 106 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
new file mode 100644
index 00000000000..16935ff3d31
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zicbom -mabi=lp64" } */
+
+int foo1()
+{
+ return __builtin_riscv_clean();
+}
+
+int foo2()
+{
+ return __builtin_riscv_flush();
+}
+
+int foo3()
+{
+ return __builtin_riscv_inval();
+}
+
+/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
new file mode 100644
index 00000000000..fc14f2b9c2b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zicbom -mabi=ilp32" } */
+
+int foo1()
+{
+ return __builtin_riscv_clean();
+}
+
+int foo2()
+{
+ return __builtin_riscv_flush();
+}
+
+int foo3()
+{
+ return __builtin_riscv_inval();
+}
+
+/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
new file mode 100644
index 00000000000..b8bac2e8c51
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile target { { rv64-*-*}}} */
+/* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */
+
+void foo (char *p)
+{
+ __builtin_prefetch (p, 0, 0);
+ __builtin_prefetch (p, 0, 1);
+ __builtin_prefetch (p, 0, 2);
+ __builtin_prefetch (p, 0, 3);
+ __builtin_prefetch (p, 1, 0);
+ __builtin_prefetch (p, 1, 1);
+ __builtin_prefetch (p, 1, 2);
+ __builtin_prefetch (p, 1, 3);
+}
+
+int foo1()
+{
+ return __builtin_riscv_prefetchi(1);
+}
+
+/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
+/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
+/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
new file mode 100644
index 00000000000..5ace6e2b349
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile target { { rv32-*-*}}} */
+/* { dg-options "-march=rv32gc_zicbop -mabi=ilp32" } */
+
+void foo (char *p)
+{
+ __builtin_prefetch (p, 0, 0);
+ __builtin_prefetch (p, 0, 1);
+ __builtin_prefetch (p, 0, 2);
+ __builtin_prefetch (p, 0, 3);
+ __builtin_prefetch (p, 1, 0);
+ __builtin_prefetch (p, 1, 1);
+ __builtin_prefetch (p, 1, 2);
+ __builtin_prefetch (p, 1, 3);
+}
+
+int foo1()
+{
+ return __builtin_riscv_prefetchi(1);
+}
+
+/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
+/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
+/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
new file mode 100644
index 00000000000..c2401fe0cf9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zicboz -mabi=lp64" } */
+
+int foo1()
+{
+ return __builtin_riscv_zero();
+}
+
+/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
new file mode 100644
index 00000000000..98fb3bf978a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zicboz -mabi=ilp32" } */
+
+int foo1()
+{
+ return __builtin_riscv_zero();
+}
+
+/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
\ No newline at end of file
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases
2022-03-04 2:49 ` [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases yulong
@ 2022-03-18 6:58 ` Kito Cheng
2022-03-18 10:15 ` Philipp Tomsich
0 siblings, 1 reply; 8+ messages in thread
From: Kito Cheng @ 2022-03-18 6:58 UTC (permalink / raw)
To: yulong
Cc: GCC Patches, Christoph Muellner, ptomsich, Andrew Waterman,
Sinan Lin, jiawei, Tsukasa OI, wuwei2016,
廖仕华
I would suggest rename those __builtin_riscv_* to
__builtin_riscv_cmo_*, that's less confusing, __builtin_riscv_zero
just seems like it will return a zero value.
On Fri, Mar 4, 2022 at 10:52 AM <yulong@nj.iscas.ac.cn> wrote:
>
> From: yulong-plct <yulong@nj.iscas.ac.cn>
>
> This commit adds testcases about CMO instructions.
> 7
> 8 gcc/testsuite/ChangeLog:
> 9
> 10 * gcc.target/riscv/cmo-zicbom-1.c: New test.
> 11 * gcc.target/riscv/cmo-zicbom-2.c: New test.
> 12 * gcc.target/riscv/cmo-zicbop-1.c: New test.
> 13 * gcc.target/riscv/cmo-zicbop-2.c: New test.
> 14 * gcc.target/riscv/cmo-zicboz-1.c: New test.
> 15 * gcc.target/riscv/cmo-zicboz-2.c: New test.
>
> ---
> gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 21 +++++++++++++++++
> gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 21 +++++++++++++++++
> gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 23 +++++++++++++++++++
> gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 23 +++++++++++++++++++
> gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 9 ++++++++
> gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 9 ++++++++
> 6 files changed, 106 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
>
> diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> new file mode 100644
> index 00000000000..16935ff3d31
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> @@ -0,0 +1,21 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv64gc_zicbom -mabi=lp64" } */
> +
> +int foo1()
> +{
> + return __builtin_riscv_clean();
> +}
> +
> +int foo2()
> +{
> + return __builtin_riscv_flush();
> +}
> +
> +int foo3()
> +{
> + return __builtin_riscv_inval();
> +}
> +
> +/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
> +/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
> +/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
> \ No newline at end of file
> diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> new file mode 100644
> index 00000000000..fc14f2b9c2b
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> @@ -0,0 +1,21 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv32gc_zicbom -mabi=ilp32" } */
> +
> +int foo1()
> +{
> + return __builtin_riscv_clean();
> +}
> +
> +int foo2()
> +{
> + return __builtin_riscv_flush();
> +}
> +
> +int foo3()
> +{
> + return __builtin_riscv_inval();
> +}
> +
> +/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
> +/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
> +/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
> \ No newline at end of file
> diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> new file mode 100644
> index 00000000000..b8bac2e8c51
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> @@ -0,0 +1,23 @@
> +/* { dg-do compile target { { rv64-*-*}}} */
> +/* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */
> +
> +void foo (char *p)
> +{
> + __builtin_prefetch (p, 0, 0);
> + __builtin_prefetch (p, 0, 1);
> + __builtin_prefetch (p, 0, 2);
> + __builtin_prefetch (p, 0, 3);
> + __builtin_prefetch (p, 1, 0);
> + __builtin_prefetch (p, 1, 1);
> + __builtin_prefetch (p, 1, 2);
> + __builtin_prefetch (p, 1, 3);
> +}
> +
> +int foo1()
> +{
> + return __builtin_riscv_prefetchi(1);
> +}
> +
> +/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
> +/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
> +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
> \ No newline at end of file
> diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> new file mode 100644
> index 00000000000..5ace6e2b349
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> @@ -0,0 +1,23 @@
> +/* { dg-do compile target { { rv32-*-*}}} */
> +/* { dg-options "-march=rv32gc_zicbop -mabi=ilp32" } */
> +
> +void foo (char *p)
> +{
> + __builtin_prefetch (p, 0, 0);
> + __builtin_prefetch (p, 0, 1);
> + __builtin_prefetch (p, 0, 2);
> + __builtin_prefetch (p, 0, 3);
> + __builtin_prefetch (p, 1, 0);
> + __builtin_prefetch (p, 1, 1);
> + __builtin_prefetch (p, 1, 2);
> + __builtin_prefetch (p, 1, 3);
> +}
> +
> +int foo1()
> +{
> + return __builtin_riscv_prefetchi(1);
> +}
> +
> +/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
> +/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
> +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
> \ No newline at end of file
> diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> new file mode 100644
> index 00000000000..c2401fe0cf9
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> @@ -0,0 +1,9 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv64gc_zicboz -mabi=lp64" } */
> +
> +int foo1()
> +{
> + return __builtin_riscv_zero();
> +}
> +
> +/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
> \ No newline at end of file
> diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
> new file mode 100644
> index 00000000000..98fb3bf978a
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
> @@ -0,0 +1,9 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv32gc_zicboz -mabi=ilp32" } */
> +
> +int foo1()
> +{
> + return __builtin_riscv_zero();
> +}
> +
> +/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
> \ No newline at end of file
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases
2022-03-18 6:58 ` Kito Cheng
@ 2022-03-18 10:15 ` Philipp Tomsich
2022-03-18 10:37 ` Kito Cheng
0 siblings, 1 reply; 8+ messages in thread
From: Philipp Tomsich @ 2022-03-18 10:15 UTC (permalink / raw)
To: Kito Cheng
Cc: yulong, GCC Patches, Christoph Muellner, Andrew Waterman,
Sinan Lin, jiawei, Tsukasa OI, wuwei2016,
廖仕华
On Fri, Mar 18, 2022 at 7:58 AM Kito Cheng <kito.cheng@gmail.com> wrote:
> I would suggest rename those __builtin_riscv_* to
> __builtin_riscv_cmo_*, that's less confusing, __builtin_riscv_zero
> just seems like it will return a zero value.
>
You meant cbo_zero, right?
CMO was only the task-group name, but the extensions ended up having "cbo"
in their name…
On Fri, Mar 4, 2022 at 10:52 AM <yulong@nj.iscas.ac.cn> wrote:
> >
> > From: yulong-plct <yulong@nj.iscas.ac.cn>
> >
> > This commit adds testcases about CMO instructions.
> > 7
> > 8 gcc/testsuite/ChangeLog:
> > 9
> > 10 * gcc.target/riscv/cmo-zicbom-1.c: New test.
> > 11 * gcc.target/riscv/cmo-zicbom-2.c: New test.
> > 12 * gcc.target/riscv/cmo-zicbop-1.c: New test.
> > 13 * gcc.target/riscv/cmo-zicbop-2.c: New test.
> > 14 * gcc.target/riscv/cmo-zicboz-1.c: New test.
> > 15 * gcc.target/riscv/cmo-zicboz-2.c: New test.
> >
> > ---
> > gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 21 +++++++++++++++++
> > gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 21 +++++++++++++++++
> > gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 23 +++++++++++++++++++
> > gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 23 +++++++++++++++++++
> > gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 9 ++++++++
> > gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 9 ++++++++
> > 6 files changed, 106 insertions(+)
> > create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> > create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> > create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> > create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> > create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> > create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
> >
> > diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> > new file mode 100644
> > index 00000000000..16935ff3d31
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
> > @@ -0,0 +1,21 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-march=rv64gc_zicbom -mabi=lp64" } */
> > +
> > +int foo1()
> > +{
> > + return __builtin_riscv_clean();
> > +}
> > +
> > +int foo2()
> > +{
> > + return __builtin_riscv_flush();
> > +}
> > +
> > +int foo3()
> > +{
> > + return __builtin_riscv_inval();
> > +}
> > +
> > +/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
> > +/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
> > +/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
> > \ No newline at end of file
> > diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> > new file mode 100644
> > index 00000000000..fc14f2b9c2b
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
> > @@ -0,0 +1,21 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-march=rv32gc_zicbom -mabi=ilp32" } */
> > +
> > +int foo1()
> > +{
> > + return __builtin_riscv_clean();
> > +}
> > +
> > +int foo2()
> > +{
> > + return __builtin_riscv_flush();
> > +}
> > +
> > +int foo3()
> > +{
> > + return __builtin_riscv_inval();
> > +}
> > +
> > +/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
> > +/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
> > +/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
> > \ No newline at end of file
> > diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> > new file mode 100644
> > index 00000000000..b8bac2e8c51
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
> > @@ -0,0 +1,23 @@
> > +/* { dg-do compile target { { rv64-*-*}}} */
> > +/* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */
> > +
> > +void foo (char *p)
> > +{
> > + __builtin_prefetch (p, 0, 0);
> > + __builtin_prefetch (p, 0, 1);
> > + __builtin_prefetch (p, 0, 2);
> > + __builtin_prefetch (p, 0, 3);
> > + __builtin_prefetch (p, 1, 0);
> > + __builtin_prefetch (p, 1, 1);
> > + __builtin_prefetch (p, 1, 2);
> > + __builtin_prefetch (p, 1, 3);
> > +}
> > +
> > +int foo1()
> > +{
> > + return __builtin_riscv_prefetchi(1);
> > +}
> > +
> > +/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
> > +/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
> > +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
> > \ No newline at end of file
> > diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> > new file mode 100644
> > index 00000000000..5ace6e2b349
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
> > @@ -0,0 +1,23 @@
> > +/* { dg-do compile target { { rv32-*-*}}} */
> > +/* { dg-options "-march=rv32gc_zicbop -mabi=ilp32" } */
> > +
> > +void foo (char *p)
> > +{
> > + __builtin_prefetch (p, 0, 0);
> > + __builtin_prefetch (p, 0, 1);
> > + __builtin_prefetch (p, 0, 2);
> > + __builtin_prefetch (p, 0, 3);
> > + __builtin_prefetch (p, 1, 0);
> > + __builtin_prefetch (p, 1, 1);
> > + __builtin_prefetch (p, 1, 2);
> > + __builtin_prefetch (p, 1, 3);
> > +}
> > +
> > +int foo1()
> > +{
> > + return __builtin_riscv_prefetchi(1);
> > +}
> > +
> > +/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
> > +/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
> > +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
> > \ No newline at end of file
> > diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> > new file mode 100644
> > index 00000000000..c2401fe0cf9
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
> > @@ -0,0 +1,9 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-march=rv64gc_zicboz -mabi=lp64" } */
> > +
> > +int foo1()
> > +{
> > + return __builtin_riscv_zero();
> > +}
> > +
> > +/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
> > \ No newline at end of file
> > diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
> b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
> > new file mode 100644
> > index 00000000000..98fb3bf978a
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
> > @@ -0,0 +1,9 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-march=rv32gc_zicboz -mabi=ilp32" } */
> > +
> > +int foo1()
> > +{
> > + return __builtin_riscv_zero();
> > +}
> > +
> > +/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
> > \ No newline at end of file
> > --
> > 2.17.1
> >
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases
2022-03-18 10:15 ` Philipp Tomsich
@ 2022-03-18 10:37 ` Kito Cheng
0 siblings, 0 replies; 8+ messages in thread
From: Kito Cheng @ 2022-03-18 10:37 UTC (permalink / raw)
To: Philipp Tomsich
Cc: Christoph Muellner, Andrew Waterman, Sinan Lin, jiawei,
Tsukasa OI, wuwei2016, GCC Patches, yulong,
廖仕华
> You meant cbo_zero, right?
> CMO was only the task-group name, but the extensions ended up having "cbo"
> in their name…
Yeah, named with an extension name makes more sense, thank you for
pointing that out.
Either __builtin_riscv_cbo_zero or __builtin_riscv_zicboz_cbo_zero is
fine to me since I expect those builtin are used for compiler internal
only, and used to implement intrinsics in future.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases
2022-03-25 6:20 [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions yulong
@ 2022-03-25 6:20 ` yulong
0 siblings, 0 replies; 8+ messages in thread
From: yulong @ 2022-03-25 6:20 UTC (permalink / raw)
To: gcc-patches
Cc: andrew, palmer, kito.cheng, jim.wilson.gcc, wuwei2016, cmuellner,
ptomsich, jiawei, shihua, sinan, yulong-plct
From: yulong-plct <yulong@nj.iscas.ac.cn>
This commit adds testcases about CMO instructions.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/cmo-zicbom-1.c: New test.
* gcc.target/riscv/cmo-zicbom-2.c: New test.
* gcc.target/riscv/cmo-zicbop-1.c: New test.
* gcc.target/riscv/cmo-zicbop-2.c: New test.
* gcc.target/riscv/cmo-zicboz-1.c: New test.
* gcc.target/riscv/cmo-zicboz-2.c: New test.
---
gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 21 +++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 21 +++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 23 +++++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 23 +++++++++++++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 9 ++++++++
gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 9 ++++++++
6 files changed, 106 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
new file mode 100644
index 00000000000..26f980feb98
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zicbom -mabi=lp64" } */
+
+int foo1()
+{
+ return __builtin_riscv_zicbom_cbo_clean();
+}
+
+int foo2()
+{
+ return __builtin_riscv_zicbom_cbo_flush();
+}
+
+int foo3()
+{
+ return __builtin_riscv_zicbom_cbo_inval();
+}
+
+/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
new file mode 100644
index 00000000000..a997f22c233
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zicbom -mabi=ilp32" } */
+
+int foo1()
+{
+ return __builtin_riscv_zicbom_cbo_clean();
+}
+
+int foo2()
+{
+ return __builtin_riscv_zicbom_cbo_flush();
+}
+
+int foo3()
+{
+ return __builtin_riscv_zicbom_cbo_inval();
+}
+
+/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */
+/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
new file mode 100644
index 00000000000..a6132d4d893
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile target { { rv64-*-*}}} */
+/* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */
+
+void foo (char *p)
+{
+ __builtin_prefetch (p, 0, 0);
+ __builtin_prefetch (p, 0, 1);
+ __builtin_prefetch (p, 0, 2);
+ __builtin_prefetch (p, 0, 3);
+ __builtin_prefetch (p, 1, 0);
+ __builtin_prefetch (p, 1, 1);
+ __builtin_prefetch (p, 1, 2);
+ __builtin_prefetch (p, 1, 3);
+}
+
+int foo1()
+{
+ return __builtin_riscv_zicbop_cbo_prefetchi(1);
+}
+
+/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
+/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
+/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
new file mode 100644
index 00000000000..b88c1e42d99
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile target { { rv32-*-*}}} */
+/* { dg-options "-march=rv32gc_zicbop -mabi=ilp32" } */
+
+void foo (char *p)
+{
+ __builtin_prefetch (p, 0, 0);
+ __builtin_prefetch (p, 0, 1);
+ __builtin_prefetch (p, 0, 2);
+ __builtin_prefetch (p, 0, 3);
+ __builtin_prefetch (p, 1, 0);
+ __builtin_prefetch (p, 1, 1);
+ __builtin_prefetch (p, 1, 2);
+ __builtin_prefetch (p, 1, 3);
+}
+
+int foo1()
+{
+ return __builtin_riscv_zicbop_cbo_prefetchi(1);
+}
+
+/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */
+/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */
+/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
new file mode 100644
index 00000000000..3f1488a21b4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zicboz -mabi=lp64" } */
+
+int foo1()
+{
+ return __builtin_riscv_zicboz_cbo_zero();
+}
+
+/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
new file mode 100644
index 00000000000..a707b07a595
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zicboz -mabi=ilp32" } */
+
+int foo1()
+{
+ return __builtin_riscv_zicboz_cbo_zero();
+}
+
+/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */
\ No newline at end of file
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-03-25 6:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 2:49 [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions yulong
2022-03-04 2:49 ` [PATCH 1/3] RISC-V: Add mininal support for Zicbo[mzp] yulong
2022-03-04 2:49 ` [PATCH 2/3] RISC-V:Cache Management Operation instructions yulong
2022-03-04 2:49 ` [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases yulong
2022-03-18 6:58 ` Kito Cheng
2022-03-18 10:15 ` Philipp Tomsich
2022-03-18 10:37 ` Kito Cheng
2022-03-25 6:20 [PATCH 0/3] RISC-V: Add Ratified Cache Management Operation ISA Extensions yulong
2022-03-25 6:20 ` [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases yulong
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).