Skip to content

Commit 9f44cc9

Browse files
committed
Add RISC-V CMO extension's intrinsics
1 parent e1aa759 commit 9f44cc9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/c-api.adoc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,38 @@ RISC-V intrinsics examples:
485485
vint8m1_t __riscv_vadd_vv_i8m1(vint8m1_t vs2, vint8m1_t vs1, size_t vl); // vadd.vv vd, vs2, vs1
486486
----
487487

488+
=== CMO Intrinsics
489+
490+
The RISC-V CMO extension provides instruction for perform operations on copies
491+
of data in the memory hierarchy.
492+
493+
In order to access the RISC-V CMO intrinsics, it is necessary to
494+
include the header file `riscv_cmo.h`.
495+
496+
The functions are only available if the compiler's `-march` string enables the
497+
required ISA extension.
498+
499+
.CMO Extension Intrinsics
500+
[%autowidth]
501+
|===
502+
|*Prototype* |*Instruction* |*Extension* |*Notes*
503+
|`+void __riscv_cbo_clean(void *addr);+` |`cbo.clean` |Zicbom |
504+
|`+void __riscv_cbo_flush(void *addr);+` |`cbo.flush` |Zicbom |
505+
|`+void __riscv_cbo_inval(void *addr);+` |`cbo.inval` |Zicbom |
506+
|`+void __riscv_cbo_zero(void *addr);+` |`cbo.zero` |Zicboz |
507+
|`+void __riscv_cbo_prefetch(void *addr, const int rw, const int locality);+` |`prefetch.[r][w]` |Zicbop | `rw`= [0,1], `locality` = [0..4].
508+
|`+int __riscv_cbo_prefetchi(const int locality);+` |`prefetch.i` |Zicbop |
509+
|===
510+
511+
Note: riscv_cbo_prefetch is a wrapper around of builtin_prefetch
512+
[source, C]
513+
----
514+
void __riscv_cbo_prefetch(void *addr, const int rw, const int locality)
515+
{
516+
__builtin_prefetch(addr, rw, locality);
517+
}
518+
----
519+
488520
=== NTLH Intrinsics
489521

490522

0 commit comments

Comments
 (0)